Home >Backend Development >PHP Tutorial >How to deal with the problem of MySQL 1040 when there are tens of millions of data without changing the configuration file?
How to deal with the problem of MySQL 1040 when there are tens of millions of data without changing the configuration file?
How to deal with the problem of MySQL 1040 when there are tens of millions of data without changing the configuration file?
1040 exceeds the maximum number of connections. If you do not modify the configuration file, try executing it in the mysql shell
<code>set global max_connections = 10000;</code>
I understand that the questioner actually wants to control the number of connections at the logical layer. My personal opinion is:
The client uses a database connection pool. This is the most basic. Control the number of connection pools. Generally, about 10 application servers are enough. In this way, 1000 connections can support 100 application servers
Separation of reading and writing into clusters, as the subject also said, to expand the capabilities of the database itself
Vertically split the database and service it, such as one database for users, one database for orders, and then design a user service and an order service. Only the user service accesses the user library, and other applications use the user service to read and write user data and orders. similar.