Sitemap
Rajdeep Mudiar

Rajdeep Mudiar

AI • ML • Deep Learning • NLP • Computer Vision Breaking down AI research, news, roadmaps, and resources into simple, practical insights. Building, learning, a

Scalability

8 min readAug 25, 2026

--

As an application grows, the number of users, requests, and amount of data also increases. A system that works perfectly for 1,000 users may struggle when it reaches 1 million users.

This is where scalability becomes important. A scalable system can handle increasing demand by adding resources without requiring a complete redesign.

1. What is Scalability?

Scalability is the ability of a system to handle increased load by adding resources.

The goal isn’t simply to make a system faster. The goal is to make sure the system can continue performing reliably as the number of users, requests, and data grows.

For example, an application handling 1,000 requests per second today might need to handle 100,000 requests per second in the future.

Press enter or click to view image in full size

Process

  1. Users send requests to the application.
  2. The system measures the current workload.
  3. Traffic starts increasing.
  4. The system identifies the bottleneck.
  5. Additional resources are added.
  6. Traffic is distributed efficiently.
  7. The system continues serving users without major performance degradation.

Example

Imagine JK, Jyotirmoy, and Bishal launch a university notes application.

Initially, only 100 students use it, so one server is enough.

But when 50,000 students start using it simultaneously, the server becomes overloaded.

Instead of letting the application crash, they scale the system by adding more resources and distributing the workload.

2. Measuring Scalability

Before scaling a system, we need to understand how much load it is currently handling.

Important metrics include:

  • Requests Per Second (RPS) → Number of requests handled per second.
  • Concurrent Users → Users active at the same time.
  • Data Volume → Amount of stored or processed data.
  • Throughput → Amount of data processed per unit of time.
  • Query Rate → Database queries per second.
  • Message Rate → Messages processed through a queue per second.
Press enter or click to view image in full size

Process

  1. Measure the current traffic.
  2. Measure response time.
  3. Monitor CPU and memory usage.
  4. Monitor database queries.
  5. Identify the bottleneck.
  6. Increase the load gradually.
  7. Observe how the system behaves.

Example

Suppose:

JK sends 100 requests/sec.
Jyotirmoy sends 200 requests/sec.
Bishal sends 300 requests/sec.

The system now needs to handle 600 requests/sec.

If response time suddenly increases from 50 ms to 500 ms, we know that the system is approaching a scalability bottleneck.

3. Vertical Scaling

Vertical Scaling, also called Scaling Up, means making an existing server more powerful instead of adding more servers.

We can increase:

  • CPU
  • RAM
  • Storage
  • Network capacity

For example, we can upgrade a server from 4 CPU cores and 16 GB RAM to 16 CPU cores and 64 GB RAM.

Process

  1. Start with one server.
  2. Traffic increases.
  3. Monitor resource usage.
  4. Identify insufficient CPU/RAM/storage.
  5. Upgrade the server.
  6. The server can now handle more traffic.
  7. Continue until the hardware limit is reached.

Example

Suppose JK, Jyotirmoy, and Bishal’s notes application initially runs on:

4 CPU + 8 GB RAM

As more students join, they upgrade it to:

16 CPU + 32 GB RAM

The same server can now handle more requests.

However, eventually the server reaches its maximum capacity.

Advantages

  • Simple
  • No major architectural changes
  • Lower network complexity
  • Easy to implement

Disadvantages

  • Hardware has limits
  • Expensive at higher capacities
  • Single point of failure
  • Upgrades may require downtime
Press enter or click to view image in full size

4. Horizontal Scaling

Horizontal Scaling, also called Scaling Out, means adding more servers instead of making one server more powerful.

For example:

              Load Balancer
/ | \
Server 1 Server 2 Server 3

Instead of one powerful server handling everything, multiple servers share the workload.

Process

  1. Start with one application server.
  2. Traffic increases.
  3. One server approaches its capacity.
  4. Add additional servers.
  5. Place a load balancer in front.
  6. Distribute requests across servers.
  7. Add more servers whenever traffic increases.

Example

JK, Jyotirmoy, and Bishal’s university app becomes popular.

Instead of upgrading one massive server, they deploy:

  • Server 1
  • Server 2
  • Server 3
  • Server 4

The load balancer distributes students among them.

If Server 2 crashes, the remaining servers continue handling requests.

Advantages

  • Better fault tolerance
  • Can keep adding servers
  • Better handling of traffic spikes
  • Geographic distribution is possible

Disadvantages

  • More architectural complexity
  • Data synchronization becomes harder
  • Network communication introduces overhead
  • Applications usually need to be stateless
Press enter or click to view image in full size

5. Stateless vs Stateful Services

For horizontal scaling to work effectively, application servers should ideally be stateless.

A stateless server does not keep a user’s session data locally. Therefore, any server can handle the next request.

Session information can instead be stored in a shared system such as Redis.

Process

  1. User sends a request.
  2. Load balancer selects any server.
  3. Server retrieves session information from Redis.
  4. Server processes the request.
  5. Response is returned.
  6. The next request can go to another server.

Example

Suppose:

  • JK’s first request → Server 1
  • JK’s second request → Server 3
  • JK’s third request → Server 2

Because his session is stored in Redis, all three servers can understand who JK is.

Press enter or click to view image in full size

6. Database Scaling

Databases are usually harder to scale than application servers because they manage state, consistency, durability and transactions.

Get Rajdeep Mudiar’s stories in your inbox

Join Medium for free to get updates from this writer.

Different database bottlenecks require different solutions:

  • Read-heavy → Read Replicas
  • Write-heavy → Sharding
  • Read + write heavy → Sharding + Replicas
  • Flexible large-scale workloads → NoSQL

Process

  1. Monitor database performance.
  2. Identify whether reads or writes are the bottleneck.
  3. If reads dominate → add replicas.
  4. If data/write volume becomes huge → shard the database.
  5. Consider NoSQL for suitable workloads.
  6. Continuously monitor performance.

Example

JK, Jyotirmoy, and Bishal notice that students mostly read notes rather than upload them.

Instead of increasing the primary database’s power, they add multiple read replicas.

Now read requests can be distributed.

Press enter or click to view image in full size

7. Read Replication

In a read-heavy system, we can create copies of the primary database called read replicas.

The primary handles writes while replicas handle reads.

Process

  1. Application sends a write request.
  2. Primary database processes it.
  3. Changes are replicated.
  4. Users send read requests.
  5. Read requests are distributed among replicas.
  6. Primary handles critical writes.

Example

JK uploads a new note.

JK → Primary Database
↓
Replication
↙ ↘
Replica 1 Replica 2

Jyotirmoy and Bishal can retrieve notes from the replicas without overloading the primary database.

Press enter or click to view image in full size

8. Database Sharding

When a database becomes extremely large, we can split the data across multiple databases.

This technique is called Sharding.

For example:

Users A-H → Shard 1
Users I-P → Shard 2
Users Q-Z → Shard 3

Each shard stores only a portion of the total data.

Process

  1. Choose a sharding key.
  2. Divide data according to that key.
  3. Route requests to the correct shard.
  4. Each shard handles its own data.
  5. Add more shards as data grows.

Example

Suppose the university application has millions of students.

The team decides to shard by student ID:

  • IDs 1–1,000,000 → Shard 1
  • IDs 1,000,001–2,000,000 → Shard 2
  • IDs 2,000,001+ → Shard 3

Now the workload is distributed.

Press enter or click to view image in full size

9. Caching

Caching stores frequently accessed data in memory so applications don’t repeatedly retrieve it from the database.

A common approach is the Cache-Aside Pattern.

Process

  1. User requests data.
  2. Application checks the cache.
  3. Cache hit → return data immediately.
  4. Cache miss → query the database.
  5. Store the result in cache.
  6. Return the data.
  7. Future requests use the cached copy.

Example

JK opens the same popular mathematics note repeatedly.

The first request:

Application → Redis ❌
↓
Database
↓
Redis ✅

The next request:

Application → Redis ✅ → User

The database doesn’t need to process the same request repeatedly.

Press enter or click to view image in full size

10. Message Queues

A message queue allows services to communicate asynchronously.

Instead of one service waiting for another service to finish, it places a message in a queue and continues working.

The consumer processes the message when it is ready.

Process

  1. Producer creates a message.
  2. Message enters the queue.
  3. Queue temporarily stores it.
  4. Consumer retrieves the message.
  5. Consumer processes it.
  6. More consumers can be added when traffic increases.

Example

Suppose JK uploads a large video.

Instead of making him wait while the video is processed:

JK
↓
Upload Service
↓
Message Queue
↓
Video Processing Service

The upload service can immediately respond while the processing service handles the video in the background.

Press enter or click to view image in full size

11. Scaling a Real Application

Scalability usually happens step by step.

We don’t immediately build a massive distributed architecture. We identify the current bottleneck and introduce the simplest solution that solves it.

The source demonstrates a social media application growing from 0 to millions of users through multiple stages.

Process

Stage 1 — Single Server

Users → Application + MySQL

Good for small applications.

Stage 2 — Separate Database

Users → App Server → MySQL

Application and database can now scale independently.

Stage 3 — Add Cache

Users → App → Redis → MySQL

Frequently accessed data is served from memory.

Stage 4 — Multiple App Servers

Users
↓
Load Balancer
↙ ↓ ↘
App App App
↓
Redis
↓
MySQL

Application traffic is distributed.

Stage 5 — Read Replicas

             ┌→ Replica 1
App → Primary ┤
└→ Replica 2

Reads are distributed across replicas.

Stage 6 — Sharding

              Shard Router
/ | \
Shard 1 Shard 2 Shard 3

Data and workload are distributed across multiple databases.

Example

Imagine JK, Jyotirmoy, and Bishal build a social media platform for their university.

At first: 100 users → Single Server

Then the application grows: 10,000 users → Separate Database

Then: 100,000 users → Redis Cache

Then: 1 million users → Multiple App Servers + Load Balancer

Then: 10 million users → Read Replicas

Finally: Millions of users + huge data → Sharding

The important lesson is that they don’t scale everything at once.

They identify the bottleneck and solve that bottleneck.

Press enter or click to view image in full size

Final Takeaway

Scalability isn’t about blindly adding more servers.

It’s about understanding where the bottleneck is and choosing the right solution.

  • Vertical Scaling → Make one machine more powerful.
  • Horizontal Scaling → Add more machines.
  • Stateless Services → Allow requests to reach any server.
  • Read Replicas → Scale database reads.
  • Sharding → Distribute huge datasets and workloads.
  • Caching → Serve frequently accessed data from memory.
  • Message Queues → Process asynchronous workloads independently.
  • Load Balancing → Distribute traffic across servers.

The most important principle is:

Always identify the bottleneck first before deciding how to scale.

Adding more application servers won’t help if the real problem is your database.

Press enter or click to view image in full size

--

--