MySQL服務器的進程狀態筆記

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是表明當前併發數mysql

發現Threads_created值過大的話,代表MySQL服務器一直在建立線程,這也是比較耗資源,能夠適當增長配置文件中thread_cache_size值
mysql> show variables like 'thread_cache_size';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| thread_cache_size | 9 |
+-------------------+-------+sql

mysql> set global thread_cache_size=32vim

或vim /etc/my.cnf
[mysqld]
thread_concurrency = 32服務器

相關文章
相關標籤/搜索