Temporary Usage Spikes: When's the threshold for scaling up the droplet?

September 28, 2016 142 views
API Load Balancing Monitoring

Contemplating a strategy for dealing painlessly (ie. automatically) with temporary traffic spikes on a droplet running a LAMP stack. (On a basic droplet, and prefer to keep the size until ongoing loads increase.) I realize you could replicate the droplet and load-balance horizontally, however that may be a bit more than I care to deal with at the moment.

I notice the API allows calls for resizing the droplet -- and that there's a reversible mode of resizing (that only adds CPU & RAM). I'm thinking about setting up a system to monitor the server load that issues a resize request when a certain threshold is crossed, and then revert when the load returns to normal. Does that seem like a sensible approach? And would it be considered good practice by DigitalOcean's side If I were to resize frequently?

While we're on the topic, I'd love to hear more thoughts on what you consider a threshold high enough to merit resizing (level/duration). I'm thinking of probing both the overall CPU/RAM load and getting specific performance data from Apache/MySQL for threshold factors. Please share any experiences or pointers for further digging. Thanks!

2 Answers

I don't think DigitalOcean cares how frequently you resize, but I would not recommend it as it have one drawback.

Resize is OK, but keep in mind that every resize is a downtime. To resize droplet you need to completely power it off, do resize, power it on.
Resize sometimes takes longer time to execute. This is note from DigitalOcean Control Panel for CPU&RAM resize:

Note:  This Resize event may take longer than normal

So when you get high spike, you have a lot of consumers using your site, and you just take it off for half hour in middle of that spike. I would say don't do it!

Load balancing is your best bet.
DigitalOcean have many tutorials on this topic. Take a look on it, also I can recommend What is high availability as it have explained how you can make your seutp.

This will take some time to research and setup, but it will fix your problem for long time, you will get better performance and maybe better uptime.
Resizing will only get you downtime, for time it need to execute, and sometimes it can take long

With an increased demand for reliable and performant infrastructures designed to serve critical systems, the terms scalability and high availability couldn’t be more popular. While handling increased system load is a common concern, decreasing downtime and eliminating single...
  • Oh well that changes the picture then. I assumed resize would be practically instantaneous, and the main downtime would be from the server powering down and back up again, which really isn't that much of an issue. A minute or two would be fine, but half-an-hour of downtime, or any other unpredictable but conceivably long duration, would definitely not be okay. Will read up on the links you provided, thank you very much!

    • I have found official response in one tutorial about downtimes:

      Estimated Downtime

      The estimated maximum downtime window for the resize process for a Droplet is: up to one minute per GB of used storage. For example, if your Droplet is using 20GB storage, the entire resize should take less than 20 minutes after it is initiated. The actual time of the process is typically very quick.

      Now that we have the prerequisites out of the way, the next two sections will cover resizing your Droplet via the DigitalOcean Control Panel and API.

      It is from How to resize tutorial

      This actually looks like for CPU, RAM & Disk resize, but I'm not able to find anything more about only CPU&RAM, only that it can take it more than normal.

      About changing configuration what comes to my mind can be:

      1. Making bash script that will check for droplet properties and change files
      2. Using some configuration management like Ansible (easier), Puppet or Chef.

      I think DigitalOcean have great tutorials that should help you but if you don't understand something be free to ask anything on Q&A, and we (community users & DigitalOcean employers will make sure you get your answers) :)

      Resizing your servers can be an effective way of increasing their capacity, by allowing them to utilize more memory (RAM), CPU, and disk storage. The ability to resize a server, also known as vertical scaling, can be useful in a variety of situations that prompt the need for a more powerful server, such as if your concurrent user base increases or if you need to store more data. In this tutorial, we will show you how to resize your server, also known as a droplet, on DigitalOcean.

And while I'm reflecting here, the resize routine should also feature adjusting Apache/MySQL configuration to match different up-scaled CPU/RAM configurations. This question is really more about response strategy than identifying the threshold, but alas I can't seem to edit the original post.

Have another answer? Share your knowledge.