DEV Community

Theerej C
Theerej C

Posted on

Scalability in simple terms - 1

πŸš€ Intro

  • So as usual, I was reading something about system design and came across the concept of scalability as an essential concept. So I thought of going a bit deep into it regarding the fact that a

    A system without scaling is a system without safety

  • So in this blog, I will explain scalability in simple terms which can be understood by anyone.


πŸ“ˆ What is Scalability?

  • So let's look into the talk of the hour β€” scalability. Basically, scalability is a concept where a system should be able to scale into a bigger one or a smaller one.

🏨 Example

Hotel Scenario

  • If there is a hotel which is being operated at a scale of serving 150 persons per hour, during festival season the crowd will require at least that much capacity.
  • But during non-festival days, it requires only 75 servings per hour.

What does the hotel do?

  • Splits the hall into two β†’ serves 75 people during non-rush
  • Opens both sections during rush
  • If still not enough β†’ constructs another building nearby

  • Likewise, in software and IT terminology, scalability refers to the concept of scaling a service or hardware capacity bigger or smaller.

πŸ—οΈ Horizontal vs Vertical (Wide vs Tall)

  • So consider the same hotel example β€” the hotel has two options to expand:

🧱 Vertical Scaling (Tall)

  • Expand the same building (more floors / bigger infrastructure)

🌐 Horizontal Scaling (Wide)

  • Open another branch (separate building)

πŸ’» In Servers

  • Increase server power β†’ Vertical Scaling
  • Add more servers β†’ Horizontal Scaling

⚠️ Limitation

  • In vertical scaling, we cannot upgrade forever (we can’t add infinite RAM or CPU to a single machine)

πŸ‘‰ So practically, horizontal scaling is what is used in the current world.


βš–οΈ Load Balancing (Multi-Serve)

  • Now consider the hotel scales horizontally (good choice).
  • They open another branch in the next street.

🏨 Example

Problem:

  • If all online orders go to Hotel 1, it becomes a choking point

Solution:

  • Split orders:
    • Orders 1, 3, 5 β†’ Hotel 1
    • Orders 2, 4, 6 β†’ Hotel 2

πŸ‘‰ This is exactly the concept of a load balancer


πŸ’» Technical Meaning

  • A load balancer is a service that splits incoming client requests across multiple servers properly.

πŸ”„ Round Robin

  • One of the most commonly used algorithms Server 1 β†’ Server 2 β†’ Server 3 β†’ Server 1 β†’ ...

πŸ‘‰ Requests are distributed in order (circular fashion)


πŸͺ Sticky Sessions & Cookies (Problem Arises)


🏨 Example

  • Two hotels (scaled horizontally)
  • Two customers: A and B

Scenario:

  • Customer A orders β†’ routed to Hotel 1
  • Next order β†’ routed to Hotel 2 β†’ delay happens

πŸ’‘ Solution

  • The system remembers where the customer was first served
  • Future requests go to the same place

πŸ’» Technical Explanation

  • First request β†’ load balancer assigns a server
  • Server sends its ID β†’ stored as a cookie on client side
  • Future requests β†’ include cookie β†’ routed to same server

πŸ” Alternative

  • Load balancer can map: Client IP β†’ Specific Server

πŸ’Ύ RAID (Redundant Array of Independent Disks)


πŸ“– Example

Author Scenario

  • An author writes a book and worries about losing it
  • So every day:
    • Makes a xerox copy
    • Stores it in a bank locker

πŸ‘‰ If something happens β†’ he can recover it


πŸ’» In Computers

  • Data is stored in disks (HDD/SSD)
  • To avoid data loss:
    • Same data is replicated into another disk

❓ Why in Scalability?

  • As systems scale:
    • Multiple failure points exist
    • Data loss risk increases
    • Multiple servers need consistent data

πŸ“Œ Definition

  • RAID is a concept of using multiple disks to store duplicate copies of data

  • There are many types of RAID, but that is a topic for another day.

πŸ”š Closing

There will be a continuation of this in upcoming blogs, as this is just a small portion of system design.


πŸ“š References

Top comments (1)

Collapse
 
_iamnaveen_ profile image
Naveen Kumar

In scaling, can we say it like this...? vertical scaling is paying more to the cooks and giving them better tools and bigger equipment so they can work faster and horizontal scaling is adding more cooks..