High CPU usage on my wordpress blog

Status
Not open for further replies.

Zeokat

Active Member
788
2009
60
0
I have a wordpress blog, i moved to a VPS (2cpu, 1,5Gb ram) but processes mysql and php have a high cpu usage. I´m using cPanel/WHM.
Anyone knows how to tune up my config to save some cpu?

Thanks.
 
14 comments
Not question of my wordpress setup, i have same wordpress config at another VPS with less resources and cpu load was lower (average 0.60, now the average is 1.15) so something into the server is not properly optimized.

I´m using w3 total cache and cloudflare. The porblem is from server/cPanel side not from wordpress configuration.
 
Is it a managed vps or unmanaged do you have ssh access if so login and just do

Code:
top

this shows live system processes in a nice table, memory information then you can see what is actually causing the high cpu usage and take it from their
 
Well shasow.prx, i´m already using top, thats why i noticed the high cpu load.
top - 19:52:02 up 19:46, 1 user, load average: 2.03, 1.95, 1.62

And processes that uses all cpu are: mysql and php as i said in my FIRST post.

My service is managed, but the people who manage them are .... well....
 
if possible disable all plugins and then reactivate one by one and check the cpu usage..

because some plugins(especiallly backup plugins may hang in cron)
 
Currently 115 users online:
top - 20:21:43 up 20:15, 1 user, load average: 0.72, 0.85, 0.99
Used mysqltunner perl script and followed instructions and deactivated plugin "postviews", and cpu load decreased. I go to activate plugin "postviews" again and will see what happens.

---------- Post added at 07:40 PM ---------- Previous post was at 06:32 PM ----------

After read here and there.... http://boomshadow.net/tech/php-handlers/

I enabled php handler FastCGI and seems that cpu load decreases a little (ram usage increase arround 60MB, affordable).

Load Averages: 0.86 0.71 0.81

After one hour:
Load Averages: 0.53 0.61 0.63

I think that now all is normal ;)
 
Last edited:
You might also like to disable gzip if you're not conserving bandwidth.

You can be correct, perhaps Gzip uses many cpu of my site, but the page size is decreased 80%, too much sacrifice disable Gzip at the moment.

Another thing that should help to keep cpu load lower is disable wp-cron that executes constantly, is a better option add a cronjob. Found a well explained tutorial here: http://wpdailybits.com/blog/replace-wordpress-cron-with-real-cron-job/74


Finally i know what increase my mysql cpu usage, was plugin post-ratings, i disabled it and cpu load lowered a lot.

Sadly my traffic increase more and now the cpu usage is mostly by PHP (fastCGI), i´m researching how to reduce the php cpu usage.... but not seems easy.
 
Thanks for the sugestion Apathetic, i installed APC to start, now is not a peak hour but after install and configure APC (php.ini and w3 total cache) seems that cpu load is arround 0.80-0.90 , decent for two core cpu VPS.

Go to write here steps, because can help newbies like me.

Was easy to install APC using cPanel/WHM, steps for cPanel (v11.32.3):
Software >> Module installers >> PHP Pecl >> Search "APC"
Click install and wait until finishes. Then you need to edit php.ini (/usr/local/lib/php.ini) and add line:
Code:
extension="apc.so"
I added the line after text:
Code:
; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
;extension="eaccelerator.so"
extension="apc.so"
Check that into "extension_dir" exists file "apc.so".

Restart Apache.

After that the apc should be enabled, you can test with a phpinfo file (if APC appears on the config file it´s working):
Code:
<?php phpinfo(); ?>
You can do some finetuning of the APC config (adding lines to php.ini), but depends on your needs and VPS resources (my settings for a wordpress into a VPS with 1GB Ram):
Code:
apc.shm_size=64M
apc.ttl=7200
apc.user_ttl=7200
apc.max_file_size=2M
I´m new using APC, perhaps i miss some settings, but is what i achieved into a fast APC documentation reading.

For sure after install APC cpu load decrease but RAM usage increase arround 80/100 MB in my VPS.

About install Varnish seems a hard task (not for newbies) install it on cPanel/WHM unless i use a payed cPanel/WHM plugin :(
 
Can you give a guide to install in phpbb for centos 6.2 ? How much ram will consume it approximately ? thanks.

If you are speaking about Varnish i have no idea. If you are speaking about APC, i install it using cPanel/WHM, so you will need to google about how to install APC on CentOS using SSH, there are lots of tutorials. After install edit the php.ini correctly and all should be ready.

And about the RAM that it uses, depends on your configuration and the RAM that you want to use for caching, but have 100MB-200MB for caching is enougth.

---------- Post added at 02:43 PM ---------- Previous post was at 02:01 PM ----------

Adding more info... seems that APC affected very deep on my wordpress, after 12 hours my rank in google lowered a lot and visits lowered a lot, i´m not 100% sure if APC affected my site.

But i noticed some thibgs that at the moment i couldnt fix. APC fails when i build a new post, it appears and disappears and if i update sidebar widgets them appear and dissapear too.

Returned to old "Disk cache" on W3 Total cache and will check if my google ranking returns.
 
Last edited:
Status
Not open for further replies.
Back
Top