I have a VPS (OpenVZ) running Ubuntu 10.04:
- nginx 1.0.5
- php 5.3.5
- mysql 5.1.41
I have installed WordPress on it and noticed in Firebug that the initial connection to index.php takes several seconds (from 4 up to 13 seconds at one time).
What makes me think it's an issue with MySQL:
- if I install a caching plugin that bypasses the database, the lag dissapears
- the queries themselves execute in a couple of miliseconds
I've tried addding skip-name-resolve or skip-networking to my.cnf as suggested here, with no luck.
One other thing I noticed is that the php-fpm process spikes to 100% CPU load while the page is generated.
I have tried using apache instead and even nginx in front of apache, but now the apache process hogged all the CPU.
One last thing: I run this exact same application on another VPS with similar configuration and there's no delay; index.php loads in under half a second.
Any suggestions on how I might find out what the problem is?