system-design

Scalability in System Design: Vertical Scaling, Horizontal Scaling & Real-World Architecture

Learn how scalability works in system design, why systems need to scale, and how vertical and horizontal scaling help applications handle increasing traffic and workloads. Explore scalability challenges, architectural patterns, practical examples, and real-world strategies for building scalable distributed systems.

Key concepts
scalabilitysystem designvertical scalinghorizontal scalingdistributed systemssystem architecturesystem design interview
Scalability Fundamentals

Understanding Scalability

CORE CONCEPT
Core Concept

SCALABILITY is the ability of a system to handle an increase in workload by adding or adjusting computing resources while maintaining acceptable performance and reliability.

In simple terms, a scalable system can grow as the number of users, requests, or amount of data increases without requiring a complete redesign of its architecture

Consider an Application that initially serves only a few Hundred USERS.

As the application becomes popular, the number of users and incoming requests starts increasing.

Initially: The application handles 1,000 Req/Min without any difficulty.

After growth: The application now receives 50,000 req/min. The existing infrastructure may struggle to process all incoming requests efficiently.


This creates a CHALLENGE :


Que - How can the application handle the increased workload without becoming slow or unavailable?

This is where SCALABILITY becomes important.

Scalability concept showing an application handling increasing traffic as the number of users and incoming requests grows
As application usage increases, the system must have the capacity to handle the growing workload.

In simple terms

More users + More requests + More workload → The system must grow its capacity to handle them.

Core principle

A scalable system can accommodate growth without unacceptable degradation in performance or reliability.
Understanding Workload

What Does Increasing Workload Actually Mean?

When we talk about scaling a system, we are not referring only to an increase in the number of users.

A system can experience growth in several different dimensions, and each one can create a different infrastructure challenge.

Consider an e-commerce application that is becoming increasingly popular.

Different dimensions of increasing application workload including more users, higher request volume, larger datasets, and increased processing demand
System workload can grow in multiple dimensions, not just the number of users.
Real-World Understanding

Why Does a System Need to Scale?

Consider an e-commerce application that initially runs on a single application server and a database.

During its early days, the application handles incoming requests without any significant performance problems.

Simple application architecture where clients send requests through a single application server connected to a database
An application may initially work well with a relatively small infrastructure.

Now imagine the application becomes popular during a major sale.

01

Application Server Overload

A large number of incoming requests compete for CPU, memory, and available connections. The application server may become overloaded.

02

Increasing Response Time

Requests start taking longer to process. Users experience slow product searches, delayed checkout operations, and longer loading times.

03

Database Bottlenecks

The database receives more queries and concurrent connections. It may struggle with query execution, locking, disk I/O, or connection limits.

04

Service Degradation or Failure

If the system cannot process the incoming workload, requests may time out, fail, or become unavailable.

Overloaded application architecture showing excessive incoming traffic overwhelming the application server and database, causing slow responses and failed requests
When workload exceeds available capacity, bottlenecks can appear across different system components.
Scalability in Practice

How Does a Scalable System Handle Growth?

Once an Application starts experiencing increasing workload, its Architecture needs to accommodate that growth.

The GOAL is to increase the system's capacity so that it can process more work without unacceptable degradation.

There are different ways to achieve this, depending on which component is becoming the bottleneck.
Scalable application architecture with a load balancer, multiple application servers, shared cache, and database handling increasing user traffic
A scalable architecture distributes workload across appropriate resources while addressing bottlenecks in dependent components.
CORE CONCEPT
INCREASE RESOURCE CAPACITY

A system can use more powerful computing resources to handle additional workload.

EXAMPLE

Upgrade a server with more CPU cores, RAM, or faster storage.

CORE CONCEPT
ADD MORE INSTANCES

A system can distribute workload across multiple application server instances.

EXAMPLE

Run multiple application servers behind a load balancer.

An Important Architectural Idea

A scalable system should be designed so that its components can accommodate growth according to their individual resource requirements.

For example:
01

Application Layer

Handle more incoming API requests.

02

Database Layer

Handle increased reads, writes, and data volume.

03

Caching Layer

Reduce repeated work and unnecessary database requests.

04

Processing Layer

Handle background jobs and computational workloads.

Important Distinction

Scalability Does Not Mean Unlimited Capacity

It is important to understand that no system has unlimited resources.

Every application has constraints such as:

CORE CONCEPT
COMPUTE RESOURCES

CPU, memory, and processing capacity.

CORE CONCEPT
STORAGE RESOURCES

Disk capacity, I/O throughput, and data storage limits.

CORE CONCEPT
NETWORK RESOURCES

Bandwidth, latency, and network throughput.

CORE CONCEPT
DEPENDENT SERVICES

Database capacity, cache limits, and external API constraints.

A system may scale successfully at the application layer but still experience limitations in its database or another dependent service.

Therefore, scalability does not mean that a system can handle unlimited traffic.

It means that the system can be expanded in a planned and controlled way as workload increases, within practical technical and financial constraints.

The Core Idea Behind Scalability

Without Scalability

Workload increases → Existing capacity becomes insufficient → Response time increases → Requests may fail.

With Scalability

Workload increases → System capacity is expanded → More work can be processed while maintaining acceptable service levels.
Conceptual comparison of a system whose workload exceeds its capacity and a scalable system whose capacity expands with increasing workload
A scalable system grows its capacity to accommodate increasing demand.
Scalability Fundamentals

Types of Scalability

CORE CONCEPT
Understanding the Approaches

Scalability describes a system's ability to handle increasing workloads.

There are 2 Fundamental APPROACHES to increasing system capacity:

  • 1. Vertical Scaling (Scale Up): Increase the resources of an existing machine.
  • 2. Horizontal Scaling (Scale Out): Add more machines to distribute the workload.

A 3rd approach, Diagonal Scaling, combines BOTH Strategies.


Let's understand each approach using an e-commerce application that is experiencing increasing traffic.

Overview of vertical scaling, horizontal scaling, and diagonal scaling showing three approaches to increasing application capacity
Three approaches to increasing system capacity as application workload grows.

Vertical Scaling

One machine → More resources

Horizontal Scaling

One machine → Multiple machines

Diagonal Scaling

More powerful machines + More machines

1. Vertical Scaling (Scale Up)

CORE CONCEPT
VERTICAL SCALING

Vertical scaling is the process of increasing the computing resources of an existing machine to handle a larger workload.

Instead of adding more servers, we make the existing server more powerful.


How does it work ?

Imagine an E-commerce application running on a single application server.

Initially, the server has :

2 CPU cores

4 GB RAM

Limited processing capacity

As traffic increases, the server starts struggling to process incoming requests.

One solution is to upgrade the existing machine :
Vertical scaling diagram showing a single application server upgraded from lower CPU and memory resources to higher CPU and memory resources
Vertical scaling increases the computing resources of an existing server.

What can be upgraded ?

CORE CONCEPT
CPU

Increase the number of CPU cores or use a more powerful processor.

Example: 2 cores → 8 cores

CORE CONCEPT
MEMORY

Add more RAM to handle larger workloads and more concurrent operations.

Example: 4 GB → 32 GB

CORE CONCEPT
STORAGE

Upgrade to faster or higher-capacity storage.

Example: HDD → NVMe SSD

CORE CONCEPT
NETWORK

Increase network capacity to handle more incoming and outgoing traffic.

Example: Higher network bandwidth

Advantages of Vertical Scaling

🔶 Relatively simple to implement.

🔶 Often requires fewer architectural changes.

🔶 No need to distribute application requests across multiple application instances.

🔶 Can be useful for applications that are difficult to distribute across multiple machines.

🔶 Easier to manage compared with a distributed application architecture in some cases.

Real-world vertical scaling example showing a restaurant upgrading its existing kitchen with a larger oven, more burners, additional staff, and bigger storage to serve more customers
Vertical scaling in real life: upgrading an existing setup with more powerful resources instead of adding another setup.

Real-world analogy

Imagine a small restaurant with one kitchen. Instead of opening another kitchen, you upgrade the existing kitchen with larger ovens, better equipment, and more powerful machines.

Limitations of Vertical Scaling

CORE CONCEPT
1. Hardware Limitations

Every machine has an upper limit on CPU, RAM, storage, and network capacity.

Eventually, you cannot continue upgrading the same machine.

CORE CONCEPT
2. Single Point of Failure

If the application depends on one server and that server fails, the application may become unavailable.

Increasing server resources does not automatically provide redundancy.

CORE CONCEPT
3. Increasing Cost

More powerful machines can become significantly more expensive as resource requirements grow.

CORE CONCEPT
4. Downtime During Upgrades

Depending on the infrastructure and upgrade process, increasing hardware resources may require restarting or migrating the machine, potentially causing downtime.

2. Horizontal Scaling (Scale Out)

CORE CONCEPT
HORIZONTAL SCALING

Horizontal scaling is the process of increasing system capacity by adding more machines or application instances and distributing the workload among them. Instead of making one server more powerful, we introduce additional servers to share the work.

How does it work ?

Consider the same e-commerce application.

Initially, it runs on one application server. As traffic increases, upgrading that server may not be sufficient or cost-effective.

Instead, we introduce multiple application server instances.

A Load Balancer distributes incoming requests across these instances.

Horizontal scaling architecture showing clients sending requests through a load balancer to multiple application server instances
Horizontal scaling distributes incoming workload across multiple application servers.

How are requests distributed ?

Suppose an application receives 9,000 requests per second and has three application server instances.

A load balancer distributes requests among the available servers.


Load balancer distributing 9,000 requests per second across three application servers, with approximately 3,000 requests per second sent to each server
A load balancer distributes incoming requests across multiple application instances.

How does horizontal scaling increase capacity?

Imagine each application server can handle approximately 3,000 requests per second under a particular workload.


Horizontal scaling capacity comparison showing one server handling 3,000 requests per second, two servers handling 6,000, three servers handling 9,000, and five servers handling 15,000 requests per second
As application servers increase, the total processing capacity can increase proportionally, assuming ideal linear scaling.

Advantages of Horizontal Scaling

🔶 Capacity can be expanded by adding more instances.

🔶 Workload can be distributed across multiple machines.

🔶 Can improve fault tolerance when instances are deployed independently.

🔶 Supports elastic infrastructure, where instances can be added or removed according to demand.

🔶 Often suitable for large-scale distributed applications.

Real-world horizontal scaling example showing one coffee shop serving approximately 100 customers per hour expanding into three independent coffee shops that collectively serve approximately 300 customers per hour
Horizontal scaling in real life: instead of upgrading one location, add more independent locations to serve more customers in parallel.

Real-world analogy

Imagine a restaurant receiving more customers. Instead of upgrading one kitchen, you open multiple kitchens and distribute orders among them so that more customers can be served simultaneously.

Limitations of Horizontal Scaling

CORE CONCEPT
1. Increased Architectural Complexity

Multiple application instances need coordination through networking, load balancing, service discovery, and other infrastructure components.

CORE CONCEPT
2. State Management Challenges

If application servers maintain sessions or other state locally, requests routed to different instances can create problems.

Shared session storage or other distributed state-management strategies may be required.

CORE CONCEPT
3. Data Consistency

Distributed applications may need to coordinate data across multiple services or database nodes.

Maintaining consistency can become more challenging.

CORE CONCEPT
4. Shared Resource Bottlenecks

Adding application servers does not automatically increase database capacity.

If all instances depend on one overloaded database, the database can remain the bottleneck.

3. Diagonal Scaling (Scale Up + Scale Out)

CORE CONCEPT
DIAGONAL SCALING

Diagonal scaling combines vertical and horizontal scaling. First, individual machines are upgraded to handle more workload. When additional capacity is required, more machines are added to the system.

How does it work ?

Consider an application that initially runs on one server with :

  • 2 CPU cores AND 4 GB RAM

As traffic increases, the server is upgraded to :

  • 8 CPU cores AND 32 GB RAM

Later, as traffic grows further, additional application server instances are introduced behind a load balancer.

Diagonal scaling diagram showing an application server first upgraded with additional CPU and RAM, followed by adding multiple upgraded application servers behind a load balancer
Diagonal scaling combines more powerful machines with additional application instances.

The scaling progression :

STAGE 01

Initial Infrastructure

One application server with limited computing resources.

STAGE 02

Vertical Scaling

Upgrade the existing server with more CPU, RAM, and storage.

STAGE 03

Horizontal Scaling

Add more upgraded application server instances and distribute traffic using a load balancer.

Advantages of Diagonal Scaling

🔶 Combines the benefits of vertical and horizontal scaling.

🔶 Allows infrastructure to grow in stages.

🔶 Provides flexibility when choosing resource upgrades and additional instances.

🔶 Can help balance infrastructure cost and operational complexity.

Limitations of Diagonal Scaling

🔶 Combines the operational challenges of both approaches.

🔶 Requires careful capacity planning.

🔶 Can increase infrastructure and management costs.

🔶 Does not automatically solve database or shared-service bottlenecks.

Real-world analogy

A restaurant first upgrades its existing kitchen with better equipment. When demand grows further, it opens additional kitchens to serve more customers.

Vertical vs Horizontal vs Diagonal Scaling

Visual comparison of vertical scaling, horizontal scaling, and diagonal scaling showing their different infrastructure expansion strategies
Each approach increases system capacity in a different way.

When should you use each approach ?

CORE CONCEPT
VERTICAL SCALING

Suitable when:

- The workload is relatively small.

- Application architecture is difficult to distribute.

- A simpler infrastructure is preferred.

- The existing machine has room for upgrades.

CORE CONCEPT
HORIZONTAL SCALING

Suitable when:

- Traffic is growing significantly.

- Multiple application instances can process requests independently.

- The system needs elastic capacity.

- Distributed architecture is appropriate.

CORE CONCEPT
DIAGONAL SCALING

Suitable when an application needs both more powerful individual machines and additional instances as its workload grows.

Is Auto Scaling Another Type of Scalability ?

This is an important distinction in system design.

Auto Scaling is not a separate fundamental scaling approach. It is a mechanism that automatically adjusts infrastructure capacity according to workload or predefined policies.

For example :

- When traffic increases, additional application instances can be launched.

- When traffic decreases, unnecessary instances can be removed.



Auto scaling architecture showing application instances automatically increasing when traffic rises and decreasing when traffic falls
Auto Scaling dynamically adjusts the number of application instances according to demand.

Remember the Core Concepts

Vertical Scaling

Scale Up → Increase CPU, RAM, and resources of an existing machine.

Horizontal Scaling

Scale Out → Add more machines and distribute the workload.

Diagonal Scaling

Combine → Upgrade individual machines and add more instances.

Auto Scaling

Automate → Adjust infrastructure capacity according to demand.
Core System Design Concepts

Scalability vs Performance vs Availability

CORE CONCEPT
Understanding the Three Dimensions

A good system is not just one that handles more users. It should also process requests efficiently and remain accessible when failures occur.

These three properties ( Scalability ,Performance and Availability ) are related, but they solve different engineering problems.


Comparison of scalability, performance, and availability as three distinct dimensions of system quality

Scalability - Handling Increasing Workload

CORE CONCEPT
SCALABILITY

Scalability is the ability of a system to accommodate increasing workloads by expanding or adjusting its resources while maintaining acceptable service quality.

Imagine an e-commerce application that initially receives 1,000 req/min .


As the business grows, it starts receiving 50,000 req/min . The existing infrastructure may no longer have enough capacity to process all incoming requests efficiently.

The system needs to increase its capacity to handle this growing demand.


Application expanding its infrastructure as traffic increases from 1,000 to 50,000 requests per minute
Scalability allows system capacity to grow as workload increases.

Two fundamental approaches to scaling:

CORE CONCEPT
Vertical Scaling (Scale Up)

Increase the resources of an existing server.


- Increase CPU cores.

- Add more RAM.

- Use faster storage.

Idea: Make the existing machine more powerful.
CORE CONCEPT
Horizontal Scaling (Scale Out)

Add more machines or application instances to distribute the workload.

- Run multiple application servers.

- Distribute requests using a load balancer.

- Add instances as traffic grows.

Idea:Add more machines to share the workload.

Other characteristics of scalability:

- Handles increasing concurrent users and requests.

- Accommodates growing datasets and processing requirements.

- Allows infrastructure capacity to expand.

- Helps prevent workload growth from overwhelming system resources.

Real-world analogy

A restaurant experiencing more customers can add more tables, staff, and kitchen capacity instead of making every customer wait longer.

Performance — Processing Requests Efficiently

CORE CONCEPT
PERFORMANCE

Performance describes how efficiently a system processes requests and delivers results.

It is commonly evaluated through Response Time, Latency, Throughput, and Resource Utilization.

Consider a user opening a product page on an e-commerce website.

If the application takes 8 seconds to return product details, the user experiences poor performance, even if the application is available and successfully processing requests.


User request travelling through an application and database, showing fast and slow response paths
Performance focuses on how efficiently requests are processed and responses are delivered.

Important performance metrics :

CORE CONCEPT
LATENCY

Latency is the time taken for an operation or request to complete, measured from the relevant starting point to its completion.

Example : A product API takes 200 milliseconds to return a response.

Lower latency generally means faster responses.

CORE CONCEPT
THROUGHPUT

Throughput is the amount of work a system successfully processes within a given period.

Common measurements :

- Requests per second (RPS).

- Transactions per second (TPS).

- Messages processed per second.

Example : An application processes 5,000 requests per second.

CORE CONCEPT
RESOURCE UTILIZATION

Measures how much of the available system resources are being consumed.

Common examples :

- CPU utilization.

- Memory utilization.

- Disk I/O.

- Network bandwidth.

An application server consistently operating at 95% CPU utilization may have limited headroom for additional workload.

How can we improve performance ?

❖ Implement caching to avoid repeated expensive operations.

❖ Optimize database queries and indexing.

❖ Reduce unnecessary network calls.

❖ Use efficient algorithms and data structures.

❖ Optimize application code.

❖ Use asynchronous processing where appropriate.

❖ Reduce payload size and unnecessary data transfer.

Performance optimization techniques including caching, database indexing, query optimization, and reduced network calls
Caching, optimized queries, and efficient processing can improve system performance.

Availability — Keeping the System Accessible

CORE CONCEPT
AVAILABILITY

Availability is the ability of a system to remain operational and accessible when users or other systems need it.

Imagine an online banking application.

Users depend on it to :

- Check account balances

- Transfer money.

- View transaction history.

- Make payments.

If the application's server crashes and users cannot access these services, the system experiences downtime.

Even if the application was extremely fast before the failure, it provides no value while unavailable.


High availability architecture showing redundant application servers and failover when one server fails
Redundancy and failover help maintain service availability when individual components fail.

How is availability measured ?


System availability measurement infographic showing the availability formula, a worked example with 99 hours uptime and 1 hour downtime resulting in 99 percent availability, and annual downtime comparisons for 99 percent, 99.9 percent, 99.99 percent, and 99.999 percent availability
Availability measures the percentage of time a system remains operational. Higher availability means less downtime.

How can we improve availability ?

❖ Use multiple application server instances.

❖ Introduce redundancy to avoid single points of failure.

❖ Use health checks to detect unhealthy instances.

❖ Configure automatic failover where appropriate.

❖ Deploy services across multiple availability zones.

❖ Maintain database backups and recovery strategies.

❖ Monitor services and detect failures quickly.


High availability architecture with multiple application servers, health checks, and automatic failover when one server becomes unhealthy
Redundancy and failover reduce the impact of individual component failures.

Real-world analogy

Availability is like a restaurant remaining open and ready to serve customers, even when one kitchen or employee is unavailable.

Side-by-Side Comparison

These concepts solve different problems, even though they often influence one another.

Side-by-side comparison of scalability, performance, and availability showing their distinct goals and engineering approaches
Three different goals that must be considered together when designing a system.

Understand the difference through three scenarios :

CORE CONCEPT
Scenario 1: High Performance, Low Scalability

An application responds in 100 milliseconds when serving 100 users.

However, when traffic increases to 100,000 users, the single server cannot handle the additional workload.

Result : The application performs well under a small workload but cannot accommodate significant growth.
CORE CONCEPT
Scenario 2: High Scalability, Poor Performance

An application has 20 application server instances and can distribute a large volume of incoming requests.

However, every request executes an inefficient database query that takes 5 seconds.

Result : The application can handle more workload, but individual requests remain slow.
CORE CONCEPT
Scenario 3: High Performance, Low Availability

An application responds in 50 milliseconds under normal conditions.

However, it runs on a single application server without redundancy.

If that server crashes, the application becomes unavailable.

Result : The application is fast when operational, but it cannot reliably remain accessible during failures.

Designing a System with All Three Properties

Typography as="h3" className="text-rose-300 font-medium text-[16px]" value="Can a system be scalable, performant, and highly available ?"/>
Yes, A well-designed architecture aims to achieve all three, although engineering trade-offs and constraints always exist.

Consider a growing e-commerce platform.

It needs to handle increasing traffic, return product information quickly, and remain accessible even when individual servers fail.

Combined system architecture using a load balancer, multiple application servers, distributed cache, database replication, and redundant infrastructure to support scalability, performance, and availability
A system can combine multiple architectural techniques to improve scalability, performance, and availability.

How does this architecture address each dimension ?

CORE CONCEPT
1. SCALABILITY

Multiple application server instances distribute incoming traffic.

Additional instances can be added as workload increases.

Techniques : Load balancing and horizontal scaling.
CORE CONCEPT
2. PERFORMANCE

Frequently accessed product information can be served from a cache.

Database queries can be optimized to reduce processing time.

Techniques : Redis caching, indexing, and query optimization.
CORE CONCEPT
3. AVAILABILITY

Multiple application instances provide redundancy.

If one instance fails, the load balancer can stop sending traffic to it and route requests to healthy instances.

Database replication and failover can help reduce database-related downtime.

Techniques : Redundancy, health checks, and failover.
Interview Prep

Interview Questions

Answer
Scalability is the ability of a system to accommodate increasing workloads by expanding or adjusting its resources while maintaining acceptable service quality. Workload can grow through more users, higher request volume, larger datasets, or increased processing requirements.
Understanding Scalability
Comparison of a system whose workload exceeds its capacity and a scalable system whose capacity expands with increasing workload
Key Takeaway
Scalability is about increasing system capacity as workload grows.
Watch Out

Common Mistakes

01

Vertical scaling means adding more servers

Common Misconception
Vertical scaling means increasing the resources of an existing machine, such as CPU, RAM, and storage. Adding more machines is horizontal scaling.
Key Idea
Scale Up = More resources. Scale Out = More machines.
02

Horizontal scaling automatically makes a system highly available

Common Misconception
Multiple application servers can improve redundancy, but availability also requires health checks, failure detection, traffic rerouting, and resilient dependencies. A shared database can still become a single point of failure.
Key Idea
More servers do not automatically guarantee high availability.
03

Adding more servers always increases system capacity linearly

Common Misconception
Real systems have shared dependencies and coordination overhead. Database limitations, network bandwidth, connection pools, and synchronization can prevent ideal linear scaling.
Key Idea
Always identify bottlenecks before adding more instances.
04

A load balancer makes an application scalable by itself

Common Misconception
A load balancer distributes incoming traffic, but it cannot increase the processing capacity of an overloaded database or another shared dependency.
Key Idea
Load balancing is one part of a scalable architecture.
05

Stateful applications cannot scale horizontally

Common Misconception
Stateful applications can scale horizontally using shared session storage, distributed state management, sticky sessions where appropriate, or other coordination mechanisms.
Key Idea
Stateful systems can scale horizontally with proper state management.
06

Stateless architecture means the application stores no data

Common Misconception
Stateless application servers do not rely on locally stored client session state between requests. They can still interact with databases, caches, and external storage systems.
Key Idea
Stateless refers to request handling, not the absence of application data.
07

Auto Scaling is a separate fundamental type of scalability

Common Misconception
Vertical and horizontal scaling are the fundamental approaches. Auto Scaling is an automation mechanism that adjusts infrastructure capacity according to workload or predefined policies.
Key Idea
Scaling defines how capacity changes; Auto Scaling automates those changes.
08

Scalability, performance, and availability mean the same thing

Common Misconception
Scalability handles increasing workloads, performance focuses on processing efficiency, and availability measures whether a system remains operational and accessible. They are related but distinct properties.
Key Idea
A good system design considers all three dimensions.

Resource Info

Quick reference

Estimated read time

25 min

Difficulty

Beginner

Category

system-design