搞清楚mysql最大连接限制

时间:2016-02-06 19:36:03

标签: mysql

在MYSQL没有响应的高峰时间遇到性能问题。试图找出我是否使用正确的值来进行最大连接。服务器有64GB的RAM。

+------------------------------+------------+
| Variable_name                | Value      |
+------------------------------+------------+
| bulk_insert_buffer_size      | 8388608    |
| innodb_buffer_pool_instances | 1          |
| innodb_buffer_pool_size      | 134217728  |
| innodb_change_buffering      | all        |
| innodb_log_buffer_size       | 8388608    |
| join_buffer_size             | 67108864   |
| key_buffer_size              | 2147483648 |
| myisam_sort_buffer_size      | 8388608    |
| net_buffer_length            | 16384      |
| preload_buffer_size          | 32768      |
| read_buffer_size             | 67108864   |
| read_rnd_buffer_size         | 2097152    |
| sort_buffer_size             | 2097152    |
| sql_buffer_result            | OFF        |
+------------------------------+------------+

lsof | wc -l
124101

lsof -a -p MYSQLDPID | wc -l
518

mysql> SHOW STATUS LIKE '%connection%';
+----------------------+----------+
| Variable_name        | Value    |
+----------------------+----------+
| Connections          | 25019772 |
| Max_used_connections | 451      |
+----------------------+----------+

目前连接限制设置为350.我需要哪些其他变量来计算正确的连接限制?

1 个答案:

答案 0 :(得分:0)

查看STATUS Vatiables。 连接 Max_used_connections 会告诉您服务器使用了多少连接。

SHOW STATUS LIKE '%connection%';

Variable_name   Value
Connection_errors_accept    0
Connection_errors_internal  0
Connection_errors_max_connections   0
Connection_errors_peer_address  0
Connection_errors_select    0
Connection_errors_tcpwrap   0
Connections 13
Max_used_connections    7