Choosing a Droplet size for spikes in web traffic

Posted May 25, 2020 1k views
UbuntuMySQLPHPWordPressLAMP StackSolutions

Hi, I am building a WordPress website for a client that periodically runs sweepstakes on their website. When they announce the sweepstakes they expect to get anywhere from 2-6k users visiting the site at a time. I am trying to figure out what Droplet will be able to handle this level of spikes in traffic. Any info will help, thank you!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hi @solidsnake,

It’s really hard to actually pinpoint the exact usage you’ll need in terms of RAM and CPU. These parameters might vary based on the server and website optimization, and additionally how heavy the website is. There is no formula to calculate that. What you’ll first need to do is optimize both your website and server.

For the server, I’ll recommend using Opcache + PHP-FPM alongside maybe a database, a caching layer that Redis can help with.

For the website, you’ll need to optimize everything from images to js,css minification, and add some caching plugin. In my experience, for a caching plugin I’ve used W3-Total-Cache.

After you’ve optimized this try to artificially create traffic on the website by creating some scripts to do automatic post requests and see how well the server handles it. After that, you’ll be able to know exactly what size droplet you’ll need to upgrade to.

My recommendation would be to start with a medium-size Droplet, something in the range of s-4vcpu-8gb or s-6vcpu-16gb which translates to 4 CPU and 8GB of RAM or 6 CPU and 16 GB of RAM.

I almost forgot to mention. You’ll need to increase your worker processes in your WebService (Apache/Nginx). These workers are equivalent to sits in a big room. Imagine you have a room with 300 slots, this means only 300 people can enter and sit, if 301 people want to enter and sit, then the last person would need to wait for a slot to be opened by one of the already sitting. The same principle is applied for the workers in Apache and Nginx.


@KDSys thank you for the thoughtful response! W3 Total Cache is definitely on my task list, but will need to spend some time looking into this other stuff. Thanks again!