The number of threads on the MySQL server must be within a reasonable range to ensure the healthy and stable operation of the MySQL server. Threads_created indicates the number of created threads. You can view the process status of the MySQL server by viewing Threads_created.
- mysql> show global status like 'Thread%';
- +-------------------+-------+
- | Variable_name | Value |
- +-------------------+-------+
- | Threads_cached | 46 |
- | Threads_connected | 2 |
- | Threads_created | 570 |
- | Threads_running | 1 |
- +-------------------+-------+
If we set thread_cache_size In the MySQL server configuration file, after the client is disconnected, the thread on which the server processes this customer will be cached in response to the next customer rather than destroyed (provided that the number of caches has not reached the upper limit ).
Threads_created indicates the number of created threads. If the value of Threads_created is too large, it indicates that the MySQL server has been creating threads, which is also resource-consuming. You can add the value of thread_cache_size in the configuration file to query the server.
Thread_cache_size Configuration:
- mysql> show variables like 'thread_cache_size';
- +-------------------+-------+
- | Variable_name | Value |
- +-------------------+-------+
- | thread_cache_size | 64 |
- +-------------------+-------+
The server in the example is healthy.
How to enable MySQL slow Query
Two methods for implementing MySQL multi-table join query
Introduction to MySQL CONVERT Functions
How to Create MySQL Functions
Take you to understand mysql Variables