CPU Spikes

Hi



I operate a Multi-vendor store (version 2.2.2) and have noticed that I keep getting CPU spikes.



I am using the Martfox E-commerce semi-dedicated VPS hosting package and find that I regularly get resources limited as hit 100% CPU usage but average CPU usage is low.



From the research I’ve done it may be that I need to be clearing the cache so have tried doing so by adding cc to the end of the admin panel address but that doesn’t seem to have helped.



I’m a bit of a novice to the web hosting side so any pointers on how I could resolve these spikes would be gratefully received.



Thank you



Emma

“From the research I've done it may be that I need to be clearing the cache so have tried doing so by adding cc to the end of the admin panel address but that doesn't seem to have helped.”

is worst, it will make this harder on cpu for re-regeneration of pages…



try to see what is the lag… or you on a dedicated box ?? no…semi dedicated vps… they tend to give % to the higest bidder in terms of cpu ressources…



get hosting dedicated…

[quote name='ejfear' timestamp='1338761180' post='137966']

Hi



I operate a Multi-vendor store (version 2.2.2) and have noticed that I keep getting CPU spikes.



I am using the Martfox E-commerce semi-dedicated VPS hosting package and find that I regularly get resources limited as hit 100% CPU usage but average CPU usage is low.



From the research I've done it may be that I need to be clearing the cache so have tried doing so by adding cc to the end of the admin panel address but that doesn't seem to have helped.



I'm a bit of a novice to the web hosting side so any pointers on how I could resolve these spikes would be gratefully received.



Thank you



Emma

[/quote]



100% CPU spikes will be expected on boxes that use SuPHP as the PHP handler.

I'm going to assume that you have 'file' as the cache method and 'mysqli' as the database connection method,



If the above information in untrue then it's either the server or CS-Cart causing this to happen, with that in mind it would be suggested to either upgrade CS-Cart (and/or remove third-party addons) or move to a different server as mentioned by Vanderex

I too will get CPU spikes and it seems to slow down the admin side of my 2.2.5 store. The front-end stays running fairly quick (for CS_Cart) which is good and it only seems to slow down the admin side.



I’m on a ServInt VPS and I asked many times if ServInt techs can help (which they are very helpful in most situations) but with the CPU Usage spikes they only last a few minutes…they will sometimes monitor the site for several hours but they only see an average.



So I just deal with it since I cannot seem to find the reason why it spikes up. :(

It's plausible to expect high CPU spikes during scanning via TrustWave or other PCI compliance companies.

Due to the use of suPHP (Highly Secure, High Load) they can typically bring a server to it's knees temporarily.



What plan do you currently have with ServInt &/or do you have any PCI scanning vendor actively scanning during business hours?

You could you use a PHP opcode cache, such as XCache or APC (reduces cpu load by caching opcodes in memory).

Have you changed your my.cnf & httpd config files from their default? Often on stock VPS's there is no my.cnf file at all … so you really have not optimized your query cache, size, limits, etc… and on the Apache side you can limit the child/spare etc servers…



We host and/or troubleshoot a lot of performance CSCart sites … here's an example of a MySQL config from a 4GIG / 4CPU VPS instance:





[mysqld]

max_connections = 200

safe-show-database

skip-locking

key_buffer = 192M

max_allowed_packet = 64M

table_cache = 768

sort_buffer_size = 2M

read_buffer_size = 2M

tmp_table_size = 128M

read_rnd_buffer_size = 2M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 128M

thread_concurrency = 8

wait_timeout = 360

max_write_lock_count = 1

log=/var/log/mysqld.log



join_buffer_size = 256K

max_heap_table_size = 32M



[mysqldump]

quick

max_allowed_packet = 16M



[mysql]

no-auto-rehash



[isamchk]

key_buffer = 128M

sort_buffer_size = 64M

read_buffer = 2M

write_buffer = 2M



[myisamchk]

key_buffer = 128M

sort_buffer_size = 64M

read_buffer = 2M

write_buffer = 2M



innodb_buffer_pool_size = 128M

innodb_additional_mem_pool_size = 20M

log_slow_queries=/var/log/mysqld.slowquery.log

And on the Apache side:




These can be set in WHM under 'Apache Global Configuration'

Timeout 120

TraceEnable Off

ServerSignature Off

ServerTokens ProductOnly

FileETag None

StartServers 20



MinSpareServers 20

MaxSpareServers 40



ServerLimit 350

MaxClients 350

MaxRequestsPerChild 1000

KeepAlive On

KeepAliveTimeout 5

MaxKeepAliveRequests 150

Thank you for your replies on this and sorry for not responding sooner - I thought I got notified of replies but turns out I forgot to follow the topic so didn't!



We have since moved servers and have just had another load spike that was apparently caused by too many httpd connections. Our host has optimised our Apache configurations and has suggested we try optimising our php scripts but unfortunately all this is a bit above my skill level!



I did try contacting Jesse to help optimise our site but see that he is not taking new clients on so does anyone have any other recommendations?



Thanks



Emma