We encountered a situation where we had multiple connections opened to our DB, which seems to cause a high rate of open table cache misses.
I would expect that in this kind of situation we see 100% cache utilisation, but the opposite happened, hit rate was reduced to 0%.
When query rate went down we saw that cache usage increased back to 100%
Do you have any idea what might cuase that?
2
Answers
Take a look at these values
You can get the current values like this
And so you can check whether tables are opened again and again. Info: Flush, dump, etc, also flush the cache
For very large DBs you should also check whether the OS (linux) can do this. Otherwise you’ll have to change it
If you’re experiencing a high rate of open table cache misses with multiple connections to a database, you can try these steps:
Increase the table_open_cache value
If the number of opened tables is increasing rapidly, you can try increasing the table_open_cache value. Make sure your operating system can handle the number of open file descriptors required by the table_open_cache setting.
Check for unused tables
If the cache contains more than table_open_cache entries and a table in the cache is no longer being used by any threads, MySQL will close and remove it from the table cache.
Check for table-flushing operations
If a table-flushing operation occurs, MySQL will close and remove unused tables from the table cache. This happens when someone issues a FLUSH TABLES statement or executes a mysqladmin flush-tables or mysqladmin refresh command.