IT Knowledge Base

Technical Repository

HowTo: MySQL thread_cache_size Tuning

MySQL> SHOW GLOBAL STATUS LIKE 'Connections';

+—————+——-+
| Variable_name | Value |
+—————+——-+
| Connections | 8608 |
+—————+——-+
1 row in set (0.01 sec)

MySQL> SHOW GLOBAL STATUS LIKE 'Threads_created';

+—————–+——-+
| Variable_name | Value |
+—————–+——-+
| Threads_created | 102 |
+—————–+——-+
1 row in set (0.00 sec)

MySQL> SHOW GLOBAL STATUS LIKE 'Max_used_connections';

+———————-+——-+
| Variable_name | Value |
+———————-+——-+
| Max_used_connections | 51 |
+———————-+——-+
1 row in set (0.00 sec)

Calculating the following

Threads_created / Connections

If this is over 0.01, then increase thread_cache_size. At the very least, thread_cache_size should be greater than Max_used_connections.



Leave a Reply