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 recently applied the following setup to install WordPress plus W3 Total Cache on an nginx server with a varnish frontend to achieve high scalability. It works great when I'm only running one virtual server, but once I configure more than 1-2 WordPress sites on the same server, the CPU maxes out at 400%, with varnish being the culprit:

763 nobody    20   0  166m  16m 7840 S  400  3.4   5437:22 varnishd     

The amount of free memory is the same before and after this CPU spike, about 25-30 megs based on top.

None of my sites get any amount of traffic right now (at max several hundred real page impressions a day). I'm hosting on a Linode 512 meg VPS and followed the setup details from the blog post, with the exception of a different permalink structure. I do have a few plugins installed and migrated my WordPress installs over by copying a tar file and MySQL dump from the old host.

For starters, how would I go about debugging this further? Is this purely a varnish problem? Am I not purging the cache properly, once I started applying this setup to multiple sites?

I've also seen some debate as to whether varnish is even desirable for this kind of a setup. Should I just use nginx as a reverse proxy instead?

(Note that I've posted this on WordPress Stack Exchange too, but it was suggested it may be off topic there)

share|improve this question
    
I don't know your hosting provider as well as the product you've mentioned above, so I'd like to know some details: is this a network attached disk (NAS, iSCSI or something comparable) you are using for Varnish's cache? I know some issues where exactly these remote file systems provide leaks. Maybe this is the case. Anyway I would recommend to assign Varnish some RAM or local disk for caching. –  Jens Bradler Apr 21 '12 at 9:50
    
It's a Linode VPS, and it's using whatever the default disk is that a VPS uses. I'm using the default config (linked in the article) and only seem to have 27 megs free, so don't think I can assign more RAM. It does have a 256 meg swap associated. If, based on the article, this setup scales well enough for a single site to get 10 million hits a day, I figure i should be able to configure it easily to host 4 sites that currently get next to nothing in traffic, and still deal with the occasional spike. –  Joost Schuur Apr 22 '12 at 13:51
1  
Try using the varnishlog command to see what varnish is doing. It seriously shouldn't be using that much CPUtime! It is worth giving it as much ram for it's cache as you can spare. varnish-cache.org/trac/wiki/Varnishlog –  Kirrus May 3 '12 at 15:59
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.