High traffic crashes website

February 16, 2018 192 views
Apache WordPress Ubuntu 16.04

whenever I start getting higher traffic (at around 200 users online), website becomes unavailable.

I don't get any alerts regarding CPU, Memory, Disk or Bandwidth related.

On the site I use WP Super Cache plugin + premium wordpress themes (including AMP).

Please assist to find the reason off website getting not available during these times.

1 Answer


Wordpress depending on the plugins that you are running can require quite a lot of resources and the problems will start when concurrent connections increase. There is usually a resource that becomes pegged at that point, which is most likely CPU, and potentially RAM.

Based on your traffic graph that you provided it looks like 95% of the time the traffic is very low and then suddenly you get a large spike.

What you can do is use a load test to simulate the number of active concurrent connections and then see how your resource usage changes as those connections are processed.

So if you are normally receiving 1-10 connections per second look at your load. Then increase it to 10-25 and look at how load across CPU and RAM changes, then increase it to 25-50, 50-100, 100-200, etc.

That will show you the corresponding load on the system and eventually you will get to a point where the system is overloaded and the website stops loading, which will indicate, ok, this is the breaking point.

But now you will have an idea that a Droplet the size of X, runs out of CPU/RAM at Y load, so you can either increase it if you anticipate a future spike, or work in some more basic caching. Supercache is good, but it's still a wordpress plugin, which means that it will still take up a lot of resources.

What we've done in the past is actually setup two separate web servers on the same system. One that is actually processing wordpress requests and a separate lightweight nginx server in front of it, that is reading off of a very basic static cache which is regenerated every 5-10 minutes. Usually the system is overloaded with requests to your index, or to a particular blog post, so this simple static cache handles those requests at 99% less load because it isn't doing anything dynamic. It's not an ideal solution, but it gives you some breathing room to figure out something more long term.

Have another answer? Share your knowledge.