Scalability vs Elasticity

Scalability vs Elasticity

In system design we often talk about scalability and elasticity and these are often listed as non-functional requirements in any software project, Many times they are clubbed together under a single umbrella of scalability and sometimes they are listed separately but very vague description is given about each of them and almost all of the time a single solution is given to address both of them.

So let's try to look at them individually and see the differences between them

Scalability

Scalability is the ability of a system, network, or process to handle growing amounts of work, or its potential to be enlarged in order to accommodate that growth. It refers to the capacity of a system to increase its performance or efficiency as the demand for its services grows over time.


Two things I want to point out here

  • increase its performance or efficiency as demand increases
  • over time


Let's try to understand this 


Over time (months-years) there is an expectation from any system that it will grow, As the system grows, the number of users increases, the feature requirements increase, and thus the resource consumption increases as well


You want your system to behave like this.

No alt text provided for this image

Here CPU is taken as an example resource, but it can be applied to other resources, such as memory, response time, feature development time etc.





But if your system behaves like this, where resource usage does not rise linearly, but exponentially, something needs to be fixed. And you can say that your system has scalability issues,


No alt text provided for this image


Ideally, you want your systems to behave like the following graph a flat line horizontal to the x-axis, but we all know that is impossible,


No alt text provided for this image


So scalability issues revolve around making this line as straight and horizontally aligned as possible


No alt text provided for this image


We can also tell if one system is more scalable than another by looking at its slope, more slope means less scalable, hence in the above diagram orange system is much more scalable than the blue one

Elasticity


Elasticity consists of the ability of a system to tackle changes in the workload, these changes are outliers considering the systems’ average workload and typically occur for a short period.

Keys terms here are

  1. tackle changes in the workload
  2. occur for a short period

Let's take an example of a normal system, its resource usage will vary if observed over a short period (hours or days). with spikes occurring at certain times. It is easy to understand why this happens. Take an e-commerce site for example, when there is a Black Friday sale or Christmas coming up, the system used will be much higher than usual. Or a ticketing site, when a top singer is going to have a concert, will also attract a large number of people to come to grab tickets



No alt text provided for this image


So elasticity is about the ability of your system to handle those spikes, A system with the ability to manage more intense spikes is more elastic in nature.


Traditionally the only way to handle those spikes was to flatten them out over the time

No alt text provided for this image


There are a number of ways you can achieve flattening and one of the most simple is to induce a message queue hence delaying some of the requests over time


Now with the advent of cloud, lightweight containers and server-less functions, there is a new way to handle these spikes and that is by scaling and descaling your system by observing your traffic or what most cloud providers would like to call auto-scaling


So does that mean you now just need to be concerned about the scalability of the system and forget about elasticity, the answer is no


As awesome as the auto-scaling thing sounds it doesn’t work in the real world because scaling is not immediately available; even containerized applications have to go through several steps to scale, such as loading the container image and cold-starting it on a new instance. A complex application can take a few minutes from the time it decides to scale to the time it is launched. So you still need to do something about that immediate spike and refusing some of the requests is not what you want,

A lot of cloud providers offer services for queuing up your resources while your system scales but  it's important to thoroughly evaluate these services to determine if they are appropriate for your architecture


I would say that mixing autoscaling with some of the traditional elasticity solutions (i.e. flattening the load) can make your application much more elastic than previously possible. But you still need to take elasticity into consideration when designing your application.

Conclusion

Scalability addresses the challenge of maintaining consistent growth of your system over time, while elasticity addresses the problem of unexpected spikes that can occur in your system during regular operations.

Nice 👍

Like
Reply
Kevin Patel

Software Engineer III @ Google | ACM-ICPC Regionals 2019

2y

Interesting!!

Like
Reply

To view or add a comment, sign in

More articles by Pranav Pandey

Insights from the community

Others also viewed

Explore topics