Slow MySQL Remote Connection

CyberLie

New Member
Currently our site is running on 1 server (Ubuntu 10.04 - Rackspace is our host), and in order to be able to handle traffic spikes, we are currently using the highest option that Rackspace offers (30 GB RAM and an 8-core CPU).CPU is our bottleneck, so I would like to put MySQL on its own server. I have tried doing this, but unfortunately it's adding 9 seconds to the page load time. PHP / MySQL is connecting from 1 server to the other through Rackspace's ServiceNet (local ip address). Before using the ServiceNet ip address, the page load was ridiculously slow (over 40 seconds).I have added "skip-name-resolve" to my.cnf, and this did not seem to improve performance at all.I am just wondering what options I have to reduce the remote MySQL connection time. It seems like there has to be something I'm missing because an extra 9 seconds is way too much.Cloned server running MySQL from the other server:\[code\]http://173.45.255.52/index.php?action=browse_members\[/code\]Live server running MySQL locally:http://bros4bros.com/index.php?action=browse_membersUPDATE:I did a simple query, and my page load time was very fast (270 ms), so I did a much larger query (SELECT * FROM cities WHERE 1... this table has almost 3,000,000 records), and the response time is still not much different from the live site: \[code\]http://173.45.255.52/simple_query.php\[/code\]I'm kind of stumped. How can it be adding 9 seconds to the site load time just by running MySQL remotely?A waterfall shows it's just waiting for 9 seconds.
waiting.png
The live site's waterfall is below:
live_waiting.png
UPDATE 2:Using mysql_pconnect instead of mysql_connect makes no difference. There is still an extra 8 - 9 seconds of waiting. Pinging one server to the other is less than 1 ms. I'm tearing my hair out now.Temporarily disabling the firewall has no effect.Using "mysqli_connect" instead of "mysql_connect" successfully connects but queries return no results... SCRATCHES HEADUPDATE 3:Successfully updated the code to use "mysqli_connect" instead of "mysql_connect", and there was no performance benefit. I had to change my "mysql_query" statements to "mysqli_query", etc.
 
Back
Top