About PHP MySQL long connection, connection pool some of the way to explore PHP connection to MySQL, with more is the MySQL extension, mysqli extension, Pdo_mysql Extension, is officially provided. PHP operation mechanism is that the page will release all the resources in the PHP process, if there are multiple concurrent access to the local test page http://127.0.0.1/1.php depending on PHP and the Web server, will open the appropriate thread or process to process the request, The result will be released when the request is finished. That is, PHP is unable to transfer some data from the page to the page from the language level, but mysql_pconnect with the ATTR in PDO, setting the array (Pdo::attr_persistent = True) as follows to enable long connections. $conn = new PDO ($DSN, Db_user, Db_password, array (pdo::attr_persistent = true)); the effect of long connection I think is in the case of high load, by multiplexing the long connection, The time to establish a database connection for each page was reduced, while this built MySQL connection time on my machine in the case of database Connnections < 10, MySQL PDO was established with a connection of 0.003MS, Mysqli established connection time for 0.14MS when the database connection close to full, MySQL PDO is established connection times 0.13MS, mysqli build connection Time is 0.13MS
Long connections for PHP and MySQL