Home  >  Article  >  Backend Development  >  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?

WBOY
WBOYOriginal
2016-08-18 09:16:22957browse

How to deal with the problem of MySQL 1040 when there are tens of millions of data without changing the configuration file?

Reply content:

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:

  1. 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

  2. Separation of reading and writing into clusters, as the subject also said, to expand the capabilities of the database itself

  3. 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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn