Database configuration that may be required in high concurrency situations

1. Maximum number of connections

The maximum number of mysql connections is 151 by default, of which 150 are used to connect to the database for ordinary users, and one of them is used to put out fires for administrators. To view the maximum number of connections to the current database, use:

show variables like "max_connections";

View the current actual number of connections:

show processlist ;

The maximum number of connections in MySQL is 16384, and it is also calculated according to this number if it exceeds this number.

Modify the maximum number of connections:

set global max_connections=12000

2, the operating system maximum file descriptor limit

The default operating system maximum file descriptor limit of the server (centos) is 1024. When the amount of concurrency is large, threads may not be available, resulting in inaccessibility. The current maximum file descriptor limit can be viewed through the following command:

[root@sqzr ~]# ulimit -n

If it is small, it can be modified to increase performance

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325808143&siteId=291194637