简体   繁体   中英

How to diagnose intermittently slow PHP to MySQL connection speeds on local network?

Since upgrading to OS X Lion, I have noticed intermittent 6-10 second lags when establishing a connection from PHP 5.3 to a MySQL database on my local network. None of the other developers are experiencing this problem, and neither was I prior to updating.

I have profiled the problem and discovered that the entire lag occurs in PDO::__construct() . I have no idea how else I can try to debug this issue - where do I even begin?

I have MySQL experience for 15 years and any sort of delays when connecting till now were 100% DNS related issues. Both client and server try to resolve names, possibly forward and reverse. If something is wrong in DNS setup, question goes out and never gets responded. Therefore delay until timeout occurs and next best option is taken. I would recommend write both sides IP addresses written into /etc/hosts with names to make sure DNS problems are opted out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM