A little understanding of the permanent connection of the database in PHP

zhaozj2021-02-16  80

The permanent connection of the establishment of the database will mean that after the client requests the database connection to the server, the connection ID is only acquired for the first connection ID, and does not create a new connection.

A typical Apache server is permanently connected to the multi-process coordination operation. When the first time requests the database connection, the server assigns the corresponding one of the sub-processes to complete the connection; after each request database connection, the last request database will be obtained. The connection allows the connection ID of each process.

However, if you use permanent connections, the database server will be aggravated, for example, the maximum allowable connection of the currently connected database server is 20, and since each request database connection is processed, although each The connection ID of the process is the same, but the number of connections is growing, and thus the number of permanent connections is huge. When it is large to more than 20, some unexpected cases are usually the previous 20 connections, and it is possible There is a case where the connection cannot be closed.

转载请注明原文地址:https://www.9cbs.com/read-17300.html

New Post(0)