1, the database system allows the maximum number of max_connections to connect. This parameter can be set. If not set, the default is 100. The maximum is 16384.
2, the database current connection thread number threads_connected. This is a dynamic change.
See Max_connections, Max_connections of the way after.
If the threads_connected = = max_connections, the database system can not provide more connection number, at this time, if the program also want to create a new connection thread, the database system will reject, if the program did not do too much error handling, will appear similar to the strong altar of information.
Because the connection to the database is created and destroyed, the resources of the system are consumed. And to avoid the simultaneous opening of too many connection threads at the same time, programming is now generally using the so-called database connection pooling technology.
However, database connection pooling technology does not prevent program errors from depleting the connection resources.
This situation usually occurs when the program fails to release the database connection resources or other causes in time for the database connection resources to be released, but the high altar system does not expect this low-level programming error to occur.
The easy way to check this error is to constantly monitor threads_connected changes as you refresh the strong altar page. If the max_connections is large enough and the threads_connected value is increasing to max_connections, then the procedure should be checked. Of course, if you are using database connection pooling technology, threads_connected grows to the maximum number of connection threads in the database connection pool, no longer grows.
Judging from the strong altar, the larger possibility is that the database system could not be properly configured. Here are some suggestions. For reference
Ask your engineers to turn MySQL's maximum allowable number of connections from the default of 100 to 32000. This will not be the problem of too many connections.
View Max_connections
Go to MySQL and use the command:
Show variables
To view variable values for the maximum number of connections to a database:
Max_connections
View threads_connected
Go to MySQL and use the command:
Show Status View the current active connection thread variable value:
threads_connected
Set Max_connections
The Setup method is to add the following last red line in the My.cnf file:
[Mysqld]
port=3306
#socket =mysql
Skip-locking
Set-variable = key_buffer=16k
Set-variable = max_allowed_packet=1m
Set-variable = thread_stack=64k
Set-variable = table_cache=4
Set-variable = sort_buffer=64k
Set-variable = net_buffer_length=2k
Set-variable = max_connections=32000
After the modification, restart MySQL. Of course, to make sure the settings are correct, you should check out the max_connections.
Attention:
1, although this is written in 32000. But the actual MySQL server allows the maximum number of connections 16384;
2, in addition to Max_connections, the above other configuration should be based on your system needs to be configured, do not adhere to;
3, add the maximum allowable connection number, the system consumption is not increased.
4, if your MySQL with My.ini as a configuration file, set similar, but the format should be slightly modified.
Note : More wonderful articles please pay attention to the triple programming Tutorial column.