1

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.

  • while this wont help you fix your issue it should give you some help for accessing the server via SSH under high memory usage: increase the priority of the sshd so the OOM_killer does not use them. Use a memory limit on apache (f.e. with ulimit) that way you can have "some" reserved memory for sshing to the machine – Dennis Nolte Aug 14 '14 at 12:14
0

I suggest one or more of the following:

  • Move that client to a separate VPS.
  • Decrease MaxClients drastically, try e.g. 10
  • Use nginx instead of Apache, or varnish in front of Apache
  • Use cloudflare
  • Thanks, I don't really want to increase costs as I gather the spec of the VPS should be sufficient even for occasionally high traffic sites - unless I have been misinformed? – muran Aug 14 '14 at 12:47
  • @muran How many requests happen during times of high traffic? How many of those requests are dynamic (PHP) requests? Also, iirc Plesk 11.5 uses nginx in front of Apache by default, if possible, see if you can go to straight nginx (that should reduce the memory usage for large amounts of static requests). – Reece45 Aug 14 '14 at 12:52
  • @Reece45 I honestly don't know the specifics. The promo involves a product going up for pre-order at which point around 3-4000 potential customers hit the site and try and run through the Opencart order process - many refreshing until they make a connection so I would imagine dynamic php requests are high at this time?I have asked the host about nginx and their very unhelpful solution is to add more RAM before the event. I can't see how that is a resolution and I am up against it time wise. – muran Aug 14 '14 at 13:15
  • If people are actually going through a pre order varnish won't help all. The costs of a separate vps are negligible compared to 3k potential orders. If you have a separate vps for this it's also easier to scale up and down when needed. – fifi finance Aug 14 '14 at 13:19
  • I hear your argument @KasperSouren but the promo's run approx. three times a year at most and we can't justify the cost of a separate VPS for one client who is otherwise catered for without issue outside of promo times. I would have thought the spec of the VPS we are running should be sufficient in any case, perhaps just not optimised as our host would like to have us believe? Separating this client out would be ideal but we can't increase their sub to cover the cost of an entirely new VPS and covering that ourselves is just not viable. – muran Aug 14 '14 at 13:31
0

Are you running apc? If not, I'd install that and see if the situation improves. I'd also look at the php fcgi configurations. Since php is run separately from apache under fcgi, I don't believe your problems are with apache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.