What scenario is the database long link in PHP applied to? Like what
mysql_pconnect
Reply content:
What scenario is the database long link in PHP applied to? Like whatmysql_pconnect
Are you asking for a permanent (persistent) link to the database?
The official answer is:
The answer is simple – efficiency .
Permanent connections are more efficient when clients connect to your SQL server with very frequent requests. The criteria for frequent connection requests depend on many factors. For example, the type of database, whether the database service and WEB services are on the same server, how SQL server loads the load, and so on. But at least we know that a permanent connection increases efficiency significantly when connection requests are frequent . It allows each sub-process to do only one connection operation in its life cycle, rather than making a connection request to the SQL server each time a page is processed. This means that each sub-procedure establishes a separate, permanent connection to the server.
For example, if you have 20 different sub-procedures that run a script that establishes a permanent connection to the SQL Server, you actually establish 20 different permanent connections to the SQL Server, each of which occupies one.
Note that if the number of child processes that are permanently connected exceeds the number of database connections you set, the system will have some drawbacks. If your database has a limit of 16 simultaneous connections, and in the case of a busy session, there are 17 threads trying to connect, then one of the threads will not be able to connect. If at this time, there is an error in your script that makes the connection impossible to close (for example, an infinite loop), then 16 connections to that database will be affected quickly.
Note : This link is not permanent and does not provide any reply function.
is the chat room counted?