I have a Ubuntu 64-bit 10.04 LTS box running Virtualmin and Apache2, fully updated. It's an ESX VM with 2GB RAM.

There are currently two sites (one CMS and one Wordpress 3) running on the server and both have the same issue. The request takes about 5s and then the page loads.

This behaving seems to be the case with all page loads.

I'm looking for advice on where to start troubleshooting.

Thanks, Sean

  • 2
    Did you try with a static page instead of php ones ? – radius Jun 23 '10 at 11:22
  • Radius, Good advice there. i create a new virtual server and created two files within. index.html (contain just the word "Hello") and index.php contain the phpinfo script (php.net/manual/en/function.phpinfo.php). Both load very quickly. Now I'm thinking the MySQL database connection might be the issue. I'm going to move the database to local and test, I'll report back soon. Sean – SJN Jun 23 '10 at 12:49

Radius' suggestion pointed me in the right direction.

The issue is to the database server, with the DB local the sites are super fast. I'll continue troubleshooting the MySQL performance issue now and ask a new question if I get stuck on that.

Thanks, Sean


Try to access Mysql by ip address, maybe the problem is dns (lan).


You may try running mysql command on the web server to see what is slow why MySQL : time to connect to the server, authentication, queries, etc. and perform the same test on the database server itself.
Then if you find nothing check connectivity between web server and DB server


in the mysql config may help. Make sure your grants are set to allow the IP rather than the hostname. If you are doing a grant on the hostname, the mysql server must look up the reverse DNS lookup before granting access.



service iptables stop

I use CentOS usually so it might be slightly different for ubuntu. This issue when I have had it is related DNS resolution (mentioned above) or incorrectly configured firewalls. Iptables is a firewall installed by default in many distros.

If your distro has SELinux that can also be the culprit you can use

setenforce 0 

to test that, if SELinux is the culprit then you need to turn on an setseboolean

setsebool -P httpd_connect_db on

I believe does the trick if that is the case. -P turns it on permanently.

Most likely since this is not a timeout it is the DNS reason listed above. You need to add the setting user46528 mentioned under /etc/my.cnf.

If your my.cnf is in a different location use

find / -name my.cnf

and don't forget to restart mysqld

service mysqld restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.