When using Yii in high concurrency, the connection to MySQL database failed, to explain, how to resolve
Source: Internet
Author: User
Using Yii when high concurrency occurs, the connection to MySQL database fails to explain
PHP Fatal error:uncaught exception ' cdbexception ' with message ' cdbconnection failed to open the DB connection:sqlstate[ HY000] [2003] Can ' t connect to MySQL server on ' ***.***.***.** ' (4) ' in/**/**/framework/db/cdbconnection.php:348
The error message is as above. The development completes the test everything is normal, the function but after the line, the concurrency peak will appear the individual 500. It's weird. Help me.
------Solution--------------------
Yii Framework cdbconnection default will set ' Emulateprepare ' to true so that pdo-mysql connections connect to the database in a long connection. There are times when the number of connections is too high when concurrency is higher. The issue of a new connection failure. I guess that's it!
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