Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the causes of program connection error caused by too many connections in mysql

Shulou Source: shulou.com Published: 2022-05-31 15:55:44 10月04日 Update

Editor to share with you the reasons for too many connections in mysql that lead to program connection errors, I believe most people do not know much about it, so share this article for your reference. I hope you will gain a lot after reading this article. Let's learn about it together.

1. The parameter setting is too small, and max_connections needs to be configured reasonably according to the performance and actual needs of the host.

2. Disk IWeiO bottleneck, such as being blocked by a SQL, causing subsequent DML operations to wait, such as frequent additions, deletions, changes, and queries. Disk Iscaro encounters a bottleneck, resulting in inability to process busy requests.

3. After MySQL processes a request, the connection is released according to the wait_ timeout value (parameter meaning: the number of seconds to wait before the server closes the non-interactive connection). It is generally set to 100 seconds. The default is 28800 seconds, if the MySQL concurrency is high. By default, memory will not be released until 28800 seconds later, which will cause a large number of connections to be idle and report a "too many connections" error.

4. Restarting the server results in too many database connections

After restarting the MySQL server, due to the high concurrency, InnoDB Bufer Pool will warm up. If you only rely on InnoDB to warm up, the InnoDB O bottleneck will bring very poor performance.

Solution:

In my.cnf, add the following parameters:

Innodb_buffer_pool_dump_at_shutdown = 1

Explanation: dump hot data to the local disk on shutdown

Innodb_buffer_pool_dump_now = 1

Explanation: dump the hot data to the local disk manually.

Innodb_buffer_pool_load_at_startup = 1

Explanation: load hot data into memory at startup

Innodb_buffer_pool_load_now = 1

Explanation: load hot data into memory manually

When you close MySQL, the data in memory is saved to the ib_buffer_pool file on disk, which is located in the data directory. When MySQL starts, it automatically loads hot data into Buffer_Pool.

These are all the contents of this article entitled "what are the reasons for program connection errors caused by too many connections in mysql?" Thank you for your reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Data disk memory interpretation too many parameters server bottleneck article service reason program content performance manual file method processing bad busy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker OPPO Reno vpn Redmi NVidia