MySQL: check statistics and tune table_open_cache
Check MySQL cache statistics and raise table_open_cache and table_open_cache_instances.
To tune a MySQL server, start by collecting cache statistics, then adjust table_open_cache if needed.
General statistics
mysqladmin status -u app_user -p
The password is prompted interactively (-p).
Cache statistics
SHOW GLOBAL STATUS LIKE '%cache%';
Adjust the open tables cache
If the counters show the open tables cache is saturated, increase table_open_cache and table_open_cache_instances. Current value:
SELECT @@table_open_cache;
Notes
- Saturation is usually judged from
Opened_tablesandOpen_tablesin theSHOW GLOBAL STATUSoutput; the source note gives no threshold or target value.