How to troubleshoot MySQL connections too many errors

Source: Internet
Author: User

Q: How to solve the MySQL connection too many errors?

Answer: The system cannot connect the database, the key depends on two data:

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.