Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
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
add comment

5 Answers

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

share|improve this answer
add comment

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

share|improve this answer
add comment

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

share|improve this answer
add comment
skip-name-resolve

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.

share|improve this answer
add comment

Try

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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