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

Posted September 28, 2016 5.1k views
APIMonitoringLoad Balancing

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!

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

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

by Erika Heidi
While handling increased system load is a common concern, decreasing downtime and eliminating single points of failure are just as important. High availability is a quality of infrastructure design at scale that addresses these latter considerations. In this guide, we will discuss what exactly high availability means and how it can improve your infrastructure’s reliability.
  • 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) :)

      by Erika Heidi
      As a broader subject, configuration management (CM) refers to the process of systematically handling changes to a system in a way that allows the system to maintain integrity over time. In this tutorial, we will discuss how configuration management works for servers, and what to consider when choosing a tool for building your configuration management infrastructure.

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.