Thread_cahe_size thread pool, thread cache. It is used to cache Idle threads so that they are not destroyed. If the Idle threads in the thread cache need to re-establish a new connection
Thread_cahe_size thread pool, thread cache. It is used to cache Idle threads so that they are not destroyed. If the Idle threads in the thread cache need to re-establish a new connection
Thread_cahe_size thread pool, thread cache. It is used to cache Idle threads so that they are not destroyed. If the Idle threads in the thread cache need to re-establish a new connection, the cache in the thread pool will be called first and the connection request will be quickly responded.
Each time a connection is established, a thread must match it.
MariaDB [(none)]> show global status like '% thread % ';
+ ------------------------------------------ + ---------- +
| Variable_name | Value |
+ ------------------------------------------ + ---------- +
| Delayed_insert_threads | 0 |
| Innodb_master_thread_1_second_loops | 4338823 |
| Innodb_master_thread_10_second_loops | 432031 |
| Innodb_master_thread_background_loops | 18974 |
| Innodb_master_thread_main_flush_loops | 18974 |
| Innodb_master_thread_sleeps | 4338819 |
| Performance_schema_thread_classes_lost | 0 |
| Performance_schema_thread_instances_lost | 0 |
| Slow_launch_threads | 0 |
| Threadpool_idle_threads | 0 |
| Threadpool_threads | 0 |
| Threads_cached | 0 | indicates the idle thread in the thread cache at this moment.
| Threads_connected | 11 | Number of established connections
| Threads_created | 11032160 | Number of threads created since the last time the service was started
| Threads_running | 2 | Number of currently activated (non-sleep) threads
+ ------------------------------------------ + ---------- +
Thread_cache_size should be set to the same as threads_connected. However, the size of thread_cache_size is much larger than 200.
Configuration:
Mysql> set global thread_cache_size = 30 takes effect immediately
Or
Vim/etc/my. cnf
Thread_concurrency = 30
Restart mysql.
This article permanently updates the link address: