Ad68c84417f5e91402177857cf0715266f63bb5a
By:
TiagoMia

wordpress nginx site very slow -- php error -- cpu high

August 15, 2014 12.8k views

Few hours ago I got a serious performance problem on my company droplet and i can't figure out what's the cause. this is how bad it looks: http://i62.tinypic.com/bkex1.jpg

Both websites are displaying this message: "The page you are looking for is temporarily unavailable. Please try again later."

I tried everything. I tried to deactivated al the plugins for the 2 websites we have (miasa.de and pro.miasa.de), but the CPU was still over 50%. I also updated all the plugins and Wordpress version, but everything still rocketing over 90%

The issue happened few ours after i was trying to install a SSL using this tutorial: https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-nginx-for-ubuntu-12-04
Although, I didn't finish all the process. I have stopped on step five -- I didn't set up the virtual hosts.

I hope you guys can help me through here.

This are the log files i got today from the var/log/nginx: https://drive.google.com/file/d/0B5PDpzeSyKU5bDB1RFVfYm5uT2M/edit?usp=sharing

on the error log what we see is a repetition of this message:

2014/08/15 11:41:51 [error] 18206#0: *5395 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 41.142.99.109, server: miasa.de, request: "POST /xmlrpc.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "miasa.de"

I thank you for your time!

(i also have opened a ticket because the situation is quite urgent -- i will update both sides with the responses i might get. )

6 Answers

Hi,

From my experience - it looks like you`re under attack to /xmlrpc.php (pingback/trackback spam), every access to this file have high CPU consumption . You can easily check this by renaming this file from domain root or limiting access to this file.

regards,
VB

It looks like PHP isn't running or nginx can't connect to it.

@gp+digitalocean it actually runs. i mean, when i deactivated the plugins, the site was slower than normal (cpu +/- on 60%), but it worked. do you know what should i do in this case?

this how the top looks like:

top - 12:16:24 up 135 days,  1:34,  2 users,  load average: 10.05, 10.10, 9.96
Tasks:  91 total,  12 running,  79 sleeping,   0 stopped,   0 zombie
Cpu(s): 93.7%us,  3.6%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.3%si,  2.3%st
Mem:   1018820k total,   933680k used,    85140k free,     6688k buffers
Swap:   262140k total,   151096k used,   111044k free,    24904k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                        
18231 www-data  20   0  342m  79m 3240 R 10.3  8.0   5:22.92 php5-fpm                                                                        
18239 www-data  20   0  342m  79m 3240 R 10.3  8.0   5:21.43 php5-fpm                                                                        
18237 www-data  20   0  351m  87m 3212 R 10.0  8.8   5:22.25 php5-fpm                                                                        
18229 www-data  20   0  342m  78m 3212 R  9.6  7.9   5:23.50 php5-fpm                                                                        
18230 www-data  20   0  336m  72m 3240 R  9.6  7.3   5:23.44 php5-fpm                                                                        
18232 www-data  20   0  345m  81m 3272 R  9.6  8.2   5:22.80 php5-fpm                                                                        
18235 www-data  20   0  351m  87m 3212 R  9.6  8.8   5:22.42 php5-fpm                                                                        
18236 www-data  20   0  342m  79m 3212 R  9.6  8.0   5:21.86 php5-fpm                                                                        
18238 www-data  20   0  342m  79m 3216 R  9.6  8.0   5:22.25 php5-fpm                                                                        
18240 www-data  20   0  342m  79m 3328 R  9.6  8.0   5:21.85 php5-fpm                                                                        
27171 mysql     20   0  867m  26m 2356 S  1.0  2.7 255:46.21 mysqld                                                                          
18205 www-data  20   0  176m 1760  448 S  0.3  0.2   0:02.70 nginx                                                                           
    1 root      20   0 24280  512    0 S  0.0  0.1   0:07.70 init                                                                            
    2 root      20   0     0    0    0 S  0.0  0.0   0:01.32 kthreadd                                                                        
    3 root      20   0     0    0    0 S  0.0  0.0   3:55.71 ksoftirqd/0      

now i just tried to reinstal and reastart the php and nginx following the step five here.

and now i don't see the php on the top. it looks like this:

top - 12:39:27 up 135 days, 1:57, 2 users, load average: 0.35, 1.31, 5.09 
Tasks: 88 total, 2 running, 86 sleeping, 0 stopped, 0 zombie 
Cpu(s): 26.3%us, 69.7%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.3%si, 3.7%st 
Mem: 1018820k total, 313308k used, 705512k free, 16328k buffers 
Swap: 262140k total, 132540k used, 129600k free, 163852k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 
22581 root 20 0 15888 1992 868 S 1.0 0.2 0:00.23 find 
10 root 20 0 0 0 0 S 0.3 0.0 24:31.83 rcu_sched 
24067 root 20 0 7180 776 656 R 0.3 0.1 0:00.01 fuser 
1 root 20 0 24280 552 36 S 0.0 0.1 0:07.71 init 
2 root 20 0 0 0 0 S 0.0 0.0 0:01.32 kthreadd 
3 root 20 0 0 0 0 S 0.0 0.0 3:55.84 ksoftirqd/0 
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 
6 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0 
7 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0H 
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 
11 root RT 0 0 0 0 S 0.0 0.0 3:44.38 watchdog/0 
12 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 cpuset 
13 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper 
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs

the sad news is that the website, back-end and front-end are still down with the same error: The page you are looking for is temporarily unavailable.
Please try again later.

by Etel Sverdlov
LEMP stack is a group of open source software to get web servers up and running. The acronym stands for Linux, nginx (pronounced Engine x), MySQL, and PHP. This tutorial explains how to install the required repos to download nginx and php-fpm, how to install MySQL, how to install nginx, how to install php-fpm, how to configure php and nginx, and how to create a php info page. This tutorial is written for Ubuntu 12.04.

trying to check what is going with nginx i did:

1) i clean archived the old log files on my decktop

2) sudo nginx -s quit

3) then: sudo service nginx restart

4) then i got this new log: https://drive.google.com/file/d/0B5PDpzeSyKU5RWhsa3JUMHNRSWM/edit?usp=sharing

Have another answer? Share your knowledge.