High traffic crashes website

February 16, 2018 959 views
Apache WordPress Ubuntu 16.04

Hello,
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.

2 comments
2 Answers

Hi,

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.

well need to see why its going wrong and where it is going wrong need to see what plugin or file is consuming the memory and load of the website.
in my case this Online Test Series Website, i am hosting test series which again takes alot of memory and cpu but its fine with me. page was consuming all the memory, later i found the problem was with the plugin as it is loading all the data in the same time, i am using page builder, it was taking huge time to load on user computer. then i used ajax and cache for it. drastic effect came into existence.
you must note, digital ocean is the best hosting ever, i have been across. i have used around 20 hostings before, but now i am stick to it.

Have another answer? Share your knowledge.