Php mysql Performance Optimization _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.