Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Your table_definition_cache is too low #44

Open
tiotrom opened this issue Mar 3, 2021 · 7 comments
Open

Your table_definition_cache is too low #44

tiotrom opened this issue Mar 3, 2021 · 7 comments

Comments

@tiotrom
Copy link

tiotrom commented Mar 3, 2021

I see this warning in the admin panel:
Your table_definition_cache is too low (400). This can lead to the database error "Prepared statement needs to be re-prepared". Please set it at least to 405 (or -1 for autosizing). See here for more information.

I've been talking to friendica's admins and devs here https://social.trom.tf/display/dbc8dc44-1360-3da1-2dc9-0f7804630652 but it was suggested that I also ask you here since this is a Friendica ynh install. To increase the table_definition_cache what file I should change and how. Can you please help? Cheers!

@tiotrom
Copy link
Author

tiotrom commented Mar 3, 2021

I installed mysqltuner and these are the outputs:

mysqltuner
 >>  MySQLTuner 1.7.13 - Major Hayden <[email protected]>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: [OK] Currently running supported MySQL version 10.3.27-MariaDB-0+deb10u1
[OK] Operating on 64-bit architecture
 
-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /var/lib/mysql/trom.tf.err(1K)
[OK] Log file /var/lib/mysql/trom.tf.err exists
[!!] Log file /var/lib/mysql/trom.tf.err isn't readable.
 
-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +SEQUENCE 
[--] Data in InnoDB tables: 166.0M (Tables: 188)
[--] Data in MyISAM tables: 988.5K (Tables: 2)
[--] Data in MEMORY tables: 0B (Tables: 1)
[OK] Total fragmented tables: 0
 
-------- Analysis Performance Metrics --------------------------------------------------------------
[--] innodb_stats_on_metadata: OFF
[OK] No stat updates during querying INFORMATION_SCHEMA.
 
-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[--] There are 618 basic passwords in the list.
 
-------- CVE Security Recommendations --------------------------------------------------------------
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION
 
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 14h 35m 54s (4M q [89.498 qps], 35K conn, TX: 7G, RX: 774M)
[--] Reads / Writes: 95% / 5%
[--] Binary logging is disabled
[--] Physical Memory     : 59.0G
[--] Max MySQL memory    : 430.6M
[--] Other process memory: 7.5G
[--] Total buffers: 289.0M global + 960.0K per thread (151 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 322.8M (0.53% of installed RAM)
[OK] Maximum possible memory usage: 430.6M (0.71% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/4M)
[OK] Highest usage of available connections: 23% (36/151)
[OK] Aborted connections: 0.02%  (6/35144)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[!!] Query cache may be disabled by default due to mutex contention.
[!!] Query cache efficiency: 0.0% (0 cached / 4M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 362K sorts)
[!!] Joins performed without indexes: 322
[OK] Temporary tables created on disk: 1% (4K on disk / 274K total)
[OK] Thread cache hit rate: 99% (37 created / 35K connections)
[!!] Table cache hit rate: 0% (10 open / 1M opened)
[OK] Open file limit used: 0% (5/760)
[OK] Table locks acquired immediately: 100% (84 immediate / 84 locks)
 
-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.
[--] Memory used by P_S: 0B
[--] Sys schema isn't installed.
 
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is enabled.
[--] Thread Pool Size: 10 thread(s).
[--] Using default value is good enough for your version (10.3.27-MariaDB-0+deb10u1)
 
-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 50.0% (8K used / 16K cache)
[!!] Key buffer size / total MyISAM indexes: 16.0K/146.0K
[!!] Read Key buffer hit rate: 84.4% (308 cached / 48 reads)
[!!] Write Key buffer hit rate: 77.8% (18 cached / 14 writes)
 
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 128.0M/166.0M
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 48.0M * 2/128.0M should be equal 25%
[OK] InnoDB buffer pool instances: 1
[--] Number of InnoDB Buffer Pool Chunk : 1 for 1 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 99.83% (200488812 hits/ 200831446 total)
[!!] InnoDB Write Log efficiency: 65.91% (395724 hits/ 600368 total)
[OK] InnoDB log waits: 0.00% (0 waits / 204644 writes)
 
-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is enabled.
[OK] Aria pagecache size / total Aria indexes: 128.0M/1B
[!!] Aria pagecache hit rate: 89.6% (21K cached / 2K reads)
 
-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.
 
-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.
 
-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.
 
-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] Binlog format: MIXED
[--] XA support enabled: ON
[--] Semi synchronous replication Master: OFF
[--] Semi synchronous replication Slave: OFF
[--] This is a standalone server
 
-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    MySQL was started within the last 24 hours - recommendations may be inaccurate
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    Adjust your join queries to always utilize indexes
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
    Read this before increasing for MariaDB https://mariadb.com/kb/en/library/optimizing-table_open_cache/
    This is MyISAM only table_cache scalability problem, InnoDB not affected.
    See more details here: https://bugs.mysql.com/bug.php?id=49177
    This bug already fixed in MySQL 5.7.9 and newer MySQL versions.
    Beware that open_files_limit (760) variable 
    should be greater than table_open_cache (10)
    Performance schema should be activated for better diagnostics
    Consider installing Sys schema from https://github.com/mysql/mysql-sys
    Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
Variables to adjust:
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 1M, or use smaller result sets)
    join_buffer_size (> 256.0K, or always use indexes with JOINs)
    table_open_cache (> 10)
    performance_schema = ON enable PFS
    key_buffer_size (> 146.0K)
    innodb_buffer_pool_size (>= 166.0M) if possible.
    innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.

@hieronymousch
Copy link

I can confirm this issue on my instance. I had to manually add table_definition_cache = 500 in mariadb.cnf

@tiotrom
Copy link
Author

tiotrom commented Mar 3, 2021

I can confirm this issue on my instance. I had to manually add table_definition_cache = 500 in mariadb.cnf

Thanks. That fixed it for me ;)

@tiotrom tiotrom closed this as completed Mar 3, 2021
@anmol26s
Copy link

anmol26s commented Mar 3, 2021

@tiotrom
@hieronymousch
Last time I did that on my test server it changed nothing related to the error message. Maybe I forgot to restart the mysql. I will try it in next rounds of improvements. Fail2ban needs to implemented and I would use git for install and updating rather then app.src.
Can you tell me what did you changed?

@tiotrom
Copy link
Author

tiotrom commented Mar 3, 2021

I added table_definition_cache = 500 in mariadb.cnf under [mysqld] and restarted mysql.

@anmol26s
Copy link

anmol26s commented Mar 3, 2021

I let it open till its fixed.

@anmol26s anmol26s reopened this Mar 3, 2021
@tio-trom
Copy link

This is an old issue and I am not experiencing this anymore. It was opened from another account of mine so I cannot close the issue. If anyone can please do. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants