What is horizontal and vertical scaling? Can somebody please explain in easy manner?

  • 13
    Vertical scaling is where you manage more load by getting a bigger box.
    Horizontal scaling is where you get multiple smaller boxes and a load balancer to direct traffic between them.
    vertical = moar power
    horizontal = moar computerz
  • 5
    @irene Pretty much. Of course vertical scaling only works for a few use cases. Adding more cores and RAM will only get you so far. Also theres still a single point of failure. With horizontal scaling you can quickly/cheaply provision instances on demand and if one fails you just redirect the traffic to another with zero downtime. IMO for most use cases horizontal is more flexible and the better option. Also with things like AWS and Azure you can get someone else to handle all the scaling and load balancing for you (eg. AWS Elastic Beanstalk)
  • 3
    True, certainly if you are hosting on your own hardware anyway. Much easier to just add MOAR POWER. But with things like ElasticBeanstalk you can basically upload your application and it will just run and scale as it needs to and you dont have to do anything at all. One thing to consider with horizontal is obviously “cold starts”. When a brand new instance gets provisioned it will take a minute or two to get going and start up. I know on my project we have 2 instances of our web app and rest API running at any one time, and can add more as needed.
  • 3
    Vertical = cpu++, ram++, nw++, etc.
    Horizontal = server++
  • 3
    Bigger box is usually higher, so it grows vertically, but if you put two servers next to each other, they grow horizontally.
  • 0
    @marci010101 well if you're thinking that way then it's all vice versa: blade type servers are stacked over each other in the rack, which makes server++ a vertical scaling 😁 and bigger boxes tend to be heavier which makes it a bad idea to make the box higher - it's weight center would be too high to keep the server stable on the floor. Hence the box will more likely be wider. Here's your horizontal scaling 😁

    p.S. Once again, it's all vice-versa :)
Add Comment