0

Ubuntu 10.10 64 bit VPS, 512Mb dedicated RAM. Mysql tuned so that sqltuner is completely happy. Used RAM never above 350Mb out of the 493 available. Load never exceeds 1.04 or so.

httpd.conf tuned as per all the guides for vps of that memory - amount of preforks, spares etc.

But for the FIRST load a site after having not visited for a while, it's taking ages.

First load: Parse Time: 3.576 - Number of Queries: 50 - Query Time: 0.019723195953369

Reload Parse Time: 0.096 - Number of Queries: 39 - Query Time: 0.0066126374511719

Subsequent reloads will be at this speed.

htop shows two items as soon as I load that page for the first time:

php-cgi /usr/sbin/apache2 -k start

I'm using suPHP but I've tried fast-cgi and cgi.

Stuck now, a weekend of tweaking has brought me nothing. Advice appreciated.

  • MySQL can cache the requests. Doy you reload apache or VPS? – alvosu Jan 31 '11 at 10:25
  • @alvosu Well, I HAVE rebooted the vps, but usually after any tweaking of either apache or mysql, I do service apache2 restart or service mysql restart, whichever I've just been fiddling with. But it's not the apache2 itself. If I serve a static html page, it's always blazing fast from the first hit. It's anything involving php. – talkingnews Jan 31 '11 at 14:50

2 Answers2

1

I had the exact same problem on my local server running ubuntu 10.10, LAMP. It was my router configs. Since mine was local I was using dnsmasq to run development sites (website.dev). My router was a DNS relay. Once I turned off DNS relay the problem went away. Once thing to check is the speed when accessing localhost. If that is fast on first load, you probably have to fix your network settings

Matt
  • 111
  • 1
0

I think this is caused by your CMS - it is caching generated pages. But after every change it invalidates this cache. For example Drupal does this.

Not much you can do here - you can for example download all pages on your site after modification, so CMS will cache it all.

Tometzky
  • 2,649
  • 4
  • 26
  • 32