Mysql Performance of php is optimized. Php (as the mainstream development language) can use temporary connections when connecting to MySQL (the best combination with PHP) databases. of course, we can also use permanent connections, using php (as the mainstream development language), we can use temporary connections when connecting MySQL (the best combination with PHP) databases. of course, we can also use permanent connections, because of the overhead of a persistent connection, the time is greatly reduced. but when we use a permanent connection, do we have to pay attention to some problems?
If a permanent connection crashes in the database or another reason, the permanent connection does not know that the database has been closed, and an error occurs when you connect to the database, the solution is to write a method to check the database status at regular intervals. If an error occurs, the database will be connected again.
The permanent connection between php (as the mainstream development language) and MySQL (the best combination with PHP) databases is to create some threads, every time a connection is established, an idle connection is found in the thread pool and then returned. However, apache (the most popular WEB server platform on the Unix platform) server only supports a certain number of threads, when the server traffic is very high, the connection thread of the database may exceed the number supported by the apache (the most popular WEB server platform on the Unix platform) server, this may cause a server crash, so we need to modify the maximum number of threads in the preparation file of the apache (the most popular WEB server platform on Unix) server, to ensure the stability of the server.
When multiple users use a permanent connection at the same time, there may be data errors, dirty data reading, and other situations. this is also a frequent problem!
Http://www.bkjia.com/PHPjc/508623.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/508623.htmlTechArticlephp (as the mainstream development language) in the connection to MySQL (and PHP with the best combination) database when we can use temporary connections, of course, we can also use permanent connections, collection...