mysql> show status like 'Threads%';
+-------------------+--------+
| Variable_name | Value |
+-------------------+--------+
| Threads_cached | 1 |
| Threads_connected | 50 |
| Threads_created | 105965 |
| Threads_running | 1 |
+-------------------+--------+
Threads_connected打开的连接数
Threads_created表示创建过的线程数
Threads_running是代表当前并发数
发现Threads_created值过大的话,表明MySQL服务器一直在创建线程,这也是比较耗资源,可以适当增加配置文件中thread_cache_size值
mysql> show variables like 'thread_cache_size';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| thread_cache_size | 9 |
+-------------------+-------+
mysql> set global thread_cache_size=32
或vim /etc/my.cnf
[mysqld]
thread_concurrency = 32
转载于:https://blog.51cto.com/zuoshou/2164783