Scalability Fundamentals

Scalability

Scalability is the ability of a system to accommodate an increasing workload without compromising performance or requiring a complete redesign.

Being able to handle more requests.

Importance

Scalability ensures that as demand grows – whether due to more users, data, or transactions – the system continues to operate efficiently. It is vital for user satisfaction, operational stability, and future-proofing your design.

Types of Scaling

Vertical Scaling (Scaling Up):

Buy bigger machine.

Definition:

Enhancing an existing machine's capacity by adding more resources – such as CPU, RAM, or storage – to handle increased load.

Advantages:

  • Simpler architecture since you are upgrading a single machine.
  • Less complexity in managing data consistency and state.
    • Data is consistent here because all the data resides in one system.
    • It is fast it has inter-process communication.
  • No load balancer required.

Limitations:

  • There's an upper limit to how much you can upgrade a single server (hardware limit).
  • Often introduces a single point of failure, making the system more vulnerable if that machine goes down.
  • May require downtime during upgrades.

Horizontal Scaling (Scaling Out):

Buy more machine.

Definition:

Adding more machines or nodes to distribute the load across a larger system.

Advantages:

  • Offers virtually unlimited capacity by adding more nodes.
  • Improves fault tolerance and redundancy since load is distributed across multiple machines.
    • If one of the machine fail, the request can be redirected to other machines.

Limitations:

  • Introduces complexity in terms of load balancing, data consistency, and network latency.
    • Here, data is complicated to maintain, so here data consistency is a real issue.
    • Communication between the two server would be over the network and network calls are slow (Remote Procedure Call).
  • Requires sophisticated infrastructure to manage and coordinate the distributed environment.

Difference Between Them

Horizontal ScalingVertical Scaling
Load Balancing RequiredNo need of Load Balancing
ResilientSingle Point of Failure
Network Call (RPC - Remote Procedure Call)Inter process Communication
Data InconsistencyConsistent
Scales Well as user increasesHardware Limit

What is a Hybrid Scaling Solution?

A hybrid solution uses vertical scaling (adding more resources to individual servers) for components that benefit from enhanced performance, alongside horizontal scaling (adding more nodes) to distribute load and improve redundancy. This allows the system to address diverse performance and scalability requirements across its different parts.

Initially, you can vertically scale as much as you like. Later on, when users start trusting you, you should probably go for horizontal scaling.