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 run small local news Wordpress blog on CentOS 6 64bit VPS 4GB RAM. Recently, website experienced daily visitors growth from 5K to 10K-15K.

Site started crashing with 504 Gateway Timeout.

Error log shows request failed: error reading the headers error.

That's what top shows

Tasks:  65 total,   1 running,  64 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.1%us,  0.4%sy,  0.0%ni, 99.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   4194304k total,   217440k used,  3976864k free,        0k buffers
Swap:  4194304k total,        0k used,  4194304k free,   119688k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                            
  850 root      20   0  461m 9984 7272 S  1.7  0.2   0:04.51 ispmgr                                             
  822 apache    20   0 97384 4560 1932 S  0.3  0.1   0:00.89 nginx                                              
    1 root      20   0 19236 1452 1216 S  0.0  0.0   0:00.02 init                                               
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd/767                                       
    3 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khelper/767                                        
  129 root      16  -4 10644  568  296 S  0.0  0.0   0:00.00 udevd                                              
  495 root      20   0  181m 1464 1048 S  0.0  0.0   0:00.00 rsyslogd                                           
  508 named     20   0  315m  12m 2556 S  0.0  0.3   0:00.02 named                                              
  524 opendkim  20   0 87792 2256 1100 S  0.0  0.1   0:00.00 opendkim                                           
  537 root      20   0 66612 1228  512 S  0.0  0.0   0:00.00 sshd                                               
  544 root      20   0 22184  936  704 S  0.0  0.0   0:00.00 xinetd                                             
  578 root      20   0 11308 1476 1220 S  0.0  0.0   0:00.02 mysqld_safe                                        
  701 mysql     20   0  424m  19m 5968 S  0.0  0.5   0:00.23 mysqld                                             
  743 postgres  20   0  108m 6112 5028 S  0.0  0.1   0:00.69 postmaster                                         
  745 postgres  20   0 82444 1488  404 S  0.0  0.0   0:00.00 postmaster                                         
  747 postgres  20   0  108m 1888  804 S  0.0  0.0   0:00.05 postmaster                                         
  748 postgres  20   0  108m 1672  588 S  0.0  0.0   0:00.04 postmaster                                         
  749 postgres  20   0  108m 1936  752 S  0.0  0.0   0:00.00 postmaster                                         
  750 postgres  20   0 82584 1680  544 S  0.0  0.0   0:00.01 postmaster                                         
  759 root      20   0 19268  780  524 S  0.0  0.0   0:00.00 dovecot         

I suppose that's webserver problem but I have no idea where should I start looking and what good configuration will be?

UPD. VPS uses nginx as front-end proxy for apache 2.2. Php runs as cgi. Max execution time 80 sec.

When website operated normally, top showed few httpd processes.

share|improve this question
1  
Your top shows a "nginx" process and no "apache" (nginx is running with user apache). How is your php-upstream defined? Please provide more information. –  deagh Apr 13 at 9:01
    
Thank you, deagh. I updated post. VPS uses nginx as front-end proxy for apache 2.2. Php runs as cgi. Max execution time 80 sec. When website operated normally, top showed few httpd processes. –  Tari Apr 13 at 9:17
    
Your VM is using very little memory. Did you just restart it? The first line of top output is missing here. Also what is that suspicious program ispmgr? –  Michael Hampton Apr 13 at 14:37

1 Answer 1

You can improve performance a lot by getting rid of Apache. Process PHP with PHP-FPM and put the upstreams from nginx directly to PHP FPM. You should try PHP 5.5 with opcode caching enabled and also use some caching plugins for WP such as WP Super Cache.

share|improve this answer

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.