Server load problems. Varnish vs Nginx vs Apache vs PHP DSO vs FCGI vs suPHP vs APC vs eAccelerator vs memcached

After noticing one of my servers was down i needed a solution to the server load problems i was having.

My sites on the server usually handle the loads that are on them but i was getting a huge spike in traffic that was causing the server to start swapping in and out of the swap….. which snowballed and caused the server to go from a load average of about 1 to well over 100!!!

What was to be done?

I already use supercache on all my sites along with widget cache.  This helps greatly but the problem is i am running multiple sites on these servers and i really need to prevent the servers from becoming overloaded.

 

I was using Apache + mod_fcgi and nginx on cpanel.  It worked well until i went over a certain amount of traffic at the same time.

I quickly replaced nginx with the varnish cpanel plugin which helped a little and caused the load to drop.

I also noticed that FCGI was running away with processes and helping cause the swapping.  Exchaning this for suPHP did help but i found the performance wan’t anywhere near as good.

As i am the only person on the server i have since moved to DSO which dropped my load average down to around 1 which is perfect for me.

The only problem being that dso runs as the apache user nobody:nobody.   as i wanted to change from super cache to w3 (as i’ve seen some stats indicating that w3 total cache can handle a higher load) i have had to go through sorting file permissions of each site so that the W3 plugin can write the cache.

playing around with APC , eAccelerator and memcached  i have found the best results are in using enhanced disk for my page cache and APC for the database, object and minify.  MY sites are now ready for any spike in traffic that can be thrown at them!

 

Bookmark the permalink.

3 Comments

  1. I have been trying to setup my server with W3 Total Cache. I can not get APC working for database or minify. What PHP handler did you use to get that working? If i use APC for database caching it will only cache 1 query, where if I use disk it will cache most queries. Also I can not get disk enhanced to work where as disk basic will. Please help!

  2. I’ve resorted back to using prefork with dso at the moment whilst i work on getting php-fpm working.

    Maybe your APC size settings are too small and its filling up too quickly?

  3. The problem with multiple sites (like i have also) is that APC, Xcache etc. fill up insanely fast. You will see files from any site in the cache. If you have, say, 20-40 sites (like i have)..it becomes clear that, say, a 64MB cache can simply not hold all the PHP files for all the sites. (As for APC/Xcache..i myself have not seen any differences whatsoever in using them). As for php-fpm…i think i will only touch this once there is a clean solution for using this within Cpanel/Easyapache. (With PHP5.4 hopefully). Honestly, all the sites talking about getting php-fpm work under cpanel/WHM sound like some nerd hacking blah blah…certainly nothing i want to try on a production server. As for Nginx..its likely that Nginx is totally overrated when it comes to PHP and WordPress, in particular MANY WP sites on one server. There might actually not be any performance gain exchanging Apache for Nginx…so the hassle of going for Nginx at the end might not even be worth it. I am telling you, you can read months about apache optimization and caches, varnish etc…and STILL know not more than before. Varnish is also just some half… solution since it really doesnt cache a lot with wordpress – UNLESS you start configuring custom VCLs to make it actually cache wordpress sites properly…

Leave a Reply

Your email address will not be published. Required fields are marked *