I have a VPS which runs multiple Opencart sites and for the most part performs the task very well.
Spec:
CPU
GenuineIntel, Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
Version
Parallels Plesk Panel v11.5.30_build115130819.13 os_CentOS 6
OS
CentOS 6.2 (Final)
RAM:
4GB
However, I have one client who often runs popular promotions causing a drive in traffic to their site which can be around 3000 - 4000 visitors over 1-2 hours, many of whom are trying to complete the order process.
When these promotions run I can watch the RAM decrease to a point where it reaches 100% utilisation and causes all sites and even SSH access to the VPS to be lost with the error log showing:
[error] (12)Cannot allocate memory: mod_fcgid: can't run /var/www/cgi-bin/cgi_wrapper/cgi_wrapper [warn] (12)Cannot allocate memory: mod_fcgid: spawn process /var/www/cgi-bin/cgi_wrapper/cgi_wrapper error
Restarting Apache or the VPS does not help and RAM utilisation only returns to normal as people give up and stop continually hitting the site. Even upping the RAM to 6GB has not resolved the issue but I assume this will be the same with any reasonable amount of RAM.
I have reported this to my host who have been quite unhelpful. They have said they have optimised the way Apache works but I'm still seeing the same problem with every promo causing a complete outage.
After their optimisation my Apache config looks like this:
IfModule prefork.c
StartServers 2
MinSpareServers 2
MaxSpareServers 5
ServerLimit 80
MaxClients 200
MaxRequestsPerChild 400
IfModule worker.c
StartServers 1
MaxClients 10
MinSpareThreads 1
MaxSpareThreads 4
ThreadsPerChild 25
MaxRequestsPerChild 0
I've also just noticed that they have set KeepAlive Off.
This same client has a promo running in the near future and I would love to get to the bottom of this to ensure the site remains active throughout.
Any suggestions would be greatly appreciated and please ask if more info is required.
Thanks in advance.