High CPU usage for blog

I'm new to running nginx and been keeping a close watch on CPU usage, which has been hovering over 100% for a few hours. When running the top command, I get the following:

 PID USER       PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 5069 www-data  20   0 59760  32m 4508 R   22  6.5   0:17.85 php5-cgi
 5072 www-data  20   0 37076 8836 2968 R   13  1.7   0:11.64 php5-cgi
 5068 www-data  20   0 52868  26m 4844 S   12  5.3   0:17.71 php5-cgi
 5070 www-data  20   0 52940  26m 4880 S   12  5.3   0:14.64 php5-cgi
 5063 www-data  20   0 53428  26m 4176 S   12  5.2   0:18.18 php5-cgi
 5071 www-data  20   0 53408  25m 3324 R   11  5.1   0:14.01 php5-cgi

Is this normal behavior just running a wordpress blog? The graph is showing 120% CPU usage and I much prefer to keep it under 40% as it was the previous day. Any tips? So far I've enabled WP Super Cache.

Thanks.

4 Replies

Keep in mind that you have four processors available, so 400% CPU is the max.

As you noted, some caching plugins can reduce CPU activity by storing the results of previous computations. To reduce it further, you may want to search for discussions about any other plugins you're using and see if any are well-known CPU hogs.

Do you have an opcode cache installed? If not, install APC or XCache.

You might want to switch to php-fpm rather than php-cgi.

You could also use Nginx's FastCGI cache to reduce load a lot as well as massively improving the speed of your blog to visitors.

I've installed APC and so far it seems to have calmed down quite a bit! I'm sure most if not all the pages have been cached by now. Much appreciative of your guys suggestions.

~~![](<URL url=)http://i.imgur.com/9aG39.png" />

With regards to php-fpm is it a simple switch over from php-cgi? I'm a bit nervous testing it on a production server as I haven't worked with it before.~~

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct