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.

On a ubuntu server, I run a LAMP environment with APC, and fast-cgi as php mod, to host 2 wordpress sites, and both sites have Wordpress Total Cache (W3TC) plugin configured.

The server's specs are: 2gb ram and 1 cpu (cpu MHz: 2100.076, cache size: 2048 KB).

One of the sites, generates a pretty heavy load on the server and oftenly the server stops to respond because of the high load.

  • I've deactivated unused Apache modules
  • I have set that all the caching from W3TC to be done in memory with APC
  • I did some apache tweaking

But none of that actually helps me with the brutal CPU usage, from php-cgi.

While I implement varnish and try to have a replica on another server I have so I can also do some load balancing, I'm wondering how can I set some kind of load limit on php-cgi or apache its self, and show a custom message like: Sorry, the server is under heavy load, please try again later

Have to mention that I also use, cloudflare.

Any other tips, are very welcome as well.

share|improve this question
    
I don't know the answer, but I always assumed this was done by the load balancing server. Is there no way to setup cloudflare to display a specific message if the server doesn't respond? –  user606723 Apr 4 '13 at 13:11
    
I had same problem when i used CloudFlare. After i used they DNS, 8 cores system went to 50% usage. The most processes was Apache. Also MySLQ was 100-120-150% all the time. Few days after i stopped to use it and cpu usage is back to 6-10%, also MySQL usage is back to 10-30%. All the time same number of users was online (its game server). I am using CentOS 5, 8 cores, 16gb of RAM. –  EmptySD May 7 '13 at 7:55
add comment

1 Answer 1

What are the typical request rates for PHP generated and static content? Have you checked the hit rate in APC for caching and for opcode? What version of PHP?

show a custom message

The sensible place to do this would be on a reverse proxy - but you say you've not go this in place yet. Another approach would be to run a minimal webserver and load balancer on the current box (in addition to the main content) and redirect that way - but that's even more work than getting Varnish set up.

Similarly wrapping the front end in a proxy script would have the desired effect - but again, the effort is more than implementing Varnish.

share|improve this answer
    
PHP 5.3.20-1 with suhosin v0.9.33, but honestly, I have no idea how to find out the request rates for PHP. APC Hits: 69735 (99.1%), Misses: 635 (0.9%) –  w0rldart Apr 4 '13 at 19:51
    
And the amount of work is not an issue, I like work, especially when it will improve something –  w0rldart Apr 4 '13 at 19:52
    
Any update based on the comments? :) –  w0rldart Apr 9 '13 at 11:32
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.