All articles
Article

Scaling your app from 100 to 10,000 users without breaking a sweat

Measure first, take the pressure off the database, spread the load, and split into services only when it pays off: a practical path from 100 to 10,000 users.

ScalabilitySystem designDatabasesBackend

Your app runs fine with 100 users. Then a launch, a mention, or a good month brings ten thousand, and the cracks show: pages slow down, the database pins its CPU, and errors appear in places that never failed before.

Getting through that doesn’t take one heroic rewrite. It takes a few deliberate moves, made in the right order: measure first, take the pressure off the database, spread the load across machines, and only then consider splitting the app into services.

I first shared this as a thread on X. This is the longer version, with a few examples.

Step 1: Find out what’s slowing you down

Don’t guess. Before you change anything, see how your app actually behaves when it’s busy.

Check the vitals

Use monitoring tools to watch what’s happening inside the app. An APM service such as New Relic shows where each request spends its time, and free profilers are often built into your language, such as Python’s cProfile. Track how much CPU the app uses, how much memory it holds, and how long it waits on the database.

Simulate real traffic

Pretend you have 100 users hammering the app with a load-testing tool like JMeter, and record the basics: how fast pages load, how many requests per second the app handles, and when errors start to appear. That’s your baseline.

Spot the weak spots

Often it’s the database getting hammered by inefficient queries, or a loop in your code doing far more work than it needs to. If every request funnels through one place, that’s your choke point.

Stress test it

In a test environment, raise the simulated load from 100 users toward 1,000 and watch where things start to wobble. Maybe at 400 users, those unoptimized searches grind to a halt. Now you know what to fix first.

This isn’t busywork. It points you to the real bottleneck, so you don’t spend a week optimizing code that was never the problem.

Step 2: Take the pressure off your database

Databases are usually the first to cry uncle when users pile on. Whether you run a traditional database like MySQL or something more flexible like MongoDB, the fixes are similar.

Speed up searches

Add indexes to the columns you query most; it’s like adding a fast lane. Then use your database’s own tools to explain where slow queries spend their time, and rewrite them. Batch related work into one query instead of hitting the database over and over.

sql
-- Ask the database why a query is slow
EXPLAIN ANALYZE
SELECT id, total FROM orders
WHERE user_id = 42
ORDER BY created_at DESC
LIMIT 20;

-- Give the most common lookup a fast lane
CREATE INDEX idx_orders_user_created ON orders (user_id, created_at);

Split reads and writes

Set up read replicas: copies of your database that only serve reads. Most traffic is reading, such as profiles and feeds, so sending those reads to replicas keeps the main database free for the writes that change data. Replicas can lag slightly behind, so read data a user has just saved from the main database.

Break the data into pieces

When the data itself gets huge, split it across several databases, for example by user group or region. This is sharding: each database holds only part of the data, so each one does less work. It adds real complexity, so save it for when indexes, replicas and caching are no longer enough.

Add a cache

Put something like Redis in front of the database to remember data you request often. Instead of asking the database for the same user profile on every request, serve it from memory:

javascript
async function getUserProfile(userId) {
  const key = `user:${userId}`;
  const cached = await redis.get(key);
  if (cached) return JSON.parse(cached);

  const profile = await db.users.findById(userId);
  await redis.set(key, JSON.stringify(profile), { EX: 300 }); // keep for 5 minutes
  return profile;
}

Database calls drop sharply, and suddenly 10,000 users feel like 100.

The idea is to make your data layer grow sideways, adding pieces as you need them, rather than making one database ever bigger.

Step 3: Spread the load across more machines

Upgrading a single server only gets you so far. It gets expensive, and eventually it hits a wall. It’s better to add more servers and share the work.

Put a traffic cop in front

A load balancer, such as NGINX or the one your cloud provider offers (AWS has good ones), routes each request to one of several servers, so no single machine gets slammed.

nginx
upstream app_servers {
  least_conn;               # send each request to the least busy server
  server 10.0.1.10:3000;
  server 10.0.1.11:3000;
}

server {
  listen 80;

  location / {
    proxy_pass http://app_servers;
  }
}

Keep your servers stateless

Design the app so that no server keeps anything important in its own memory. Store user sessions in a shared place, such as Redis. Then any server can handle any request, and adding a new one is easy.

Let it grow automatically

In the cloud, set up autoscaling to add servers when things get busy, for example when average CPU passes 70%, and to remove them when traffic drops. With 1,000 users, you might go from a couple of servers to half a dozen during rush hour.

This turns your setup from a solo act into a team that handles more traffic without drama.

Step 4: Break the app into smaller pieces, if it makes sense

Not every app needs this right away. But splitting one large codebase into smaller, independent parts can help a lot once some parts of the system grow much faster than others.

Split it into services

Turn the app into services, such as one for logins and another for payments, that talk to each other through APIs or a message queue like Kafka. Each service can grow on its own: if sign-ups explode, you scale the sign-up service, not everything.

Add a front door for your APIs

An API gateway receives incoming calls, routes them to the right service, limits how fast clients can send requests, and keeps things secure. Think of it as a bouncer for your services.

Move slow work to the background

Anything that doesn’t need to happen right away, such as sending emails, can go into a queue for background workers. Tools like Celery for Python or BullMQ for Node.js process those jobs separately, so your main app stays snappy.

If your code is already modular, focus on how the parts talk to each other, so that communication doesn’t become the new bottleneck.

The short version

  1. Measure before you change anything, and fix the real bottleneck.
  2. Take the pressure off the database with indexes, read replicas and caching.
  3. Make servers stateless, put a load balancer in front, and scale automatically.
  4. Split into services and move slow work to queues once the app needs it.

Each step buys headroom for the next. Work through them in order, and the jump from 100 to 10,000 users becomes a series of small, planned changes instead of an emergency.

Have a similar challenge?

Let's talk about the product you're building.

Get in touch