Every big system you admire — an online store, a ride-hailing app, a video platform — started as one server and one database. Nobody designs for ten million users on day one. They grow the system step by step, fixing whichever part breaks first. That is what system design basics really are: knowing which step comes next, and why.
In this guide we follow one imaginary app — an online course platform — from 100 users to 1 million. At each stage you will see what breaks, the fix, and the trade-off it brings. No jargon without an explanation.
The building blocks in one minute
| Term | Plain-language meaning |
|---|---|
| Latency | How long one request takes (e.g. 200 ms). |
| Throughput | How many requests per second the system can handle. |
| Scaling up (vertical) | Giving one server more CPU and RAM. |
| Scaling out (horizontal) | Adding more servers that share the work. |
| Bottleneck | The single slowest part that limits everything else. |
| Single point of failure | One component that takes the whole system down if it fails. |
Stage 1: One server (0–1,000 users)
Everything lives on one machine: web server (Nginx), application (Laravel, Django, Node), and database (MySQL or PostgreSQL). A $10–20/month VPS handles this comfortably.
Users --> [ VPS: Nginx + App + MySQL ]
This is the right choice at the start. It is cheap, simple to debug and fast to deploy. Our Laravel VPS deployment guide sets up exactly this.
What breaks first: the database and the app fight over the same CPU and RAM. A heavy report query makes every page slow.
Stage 2: Fix the database before buying servers (1,000–10,000 users)
Most "we need to scale" moments are actually "we need an index". Before spending money, do three things:
- Find slow queries. Log queries slower than a few hundred milliseconds (see our slow query snippet).
- Add indexes on columns used in
WHERE,JOINandORDER BY. - Kill N+1 queries — loading 50 courses and then running 50 extra queries for their teachers. Eager loading turns 51 queries into 2.
-- Before: full table scan on 2 million rows
SELECT * FROM enrollments WHERE user_id = 4821 ORDER BY created_at DESC;
-- Fix: one composite index
CREATE INDEX idx_enrollments_user_created ON enrollments (user_id, created_at);
A query that took 1.8 seconds commonly drops to a few milliseconds after the right index. Then move the database to its own server (or a managed database), so the app and database stop competing.
Users --> [ App server ] --> [ Database server ]
Stage 3: Caching (10,000–100,000 users)
The fastest query is the one you never run. Most pages show the same data to many people — the course catalogue, a popular article, settings. Store the result in memory with Redis and reuse it.
// Laravel: cache the course list for 10 minutes
$courses = Cache::remember('courses.published', now()->addMinutes(10), function () {
return Course::where('status', 'published')->with('teacher')->get();
});
Caching happens at several layers:
- Browser cache — images, CSS and JS with long cache headers.
- CDN (Cloudflare, Bunny, CloudFront) — serves static files from a location near the user, so a visitor in Karachi or London does not wait for a server in Germany.
- Application cache — Redis for query results and computed data.
The trade-off: cached data can be stale. The classic hard problem is cache invalidation — when a course is updated, you must clear courses.published or users see old data. Clear the cache in the same place you save the data.
Stage 4: Background jobs and queues
Some work does not need to happen while the user waits: sending emails, generating certificates as PDFs, resizing uploaded videos, calling a payment webhook. Put it on a queue; a separate worker process handles it.
// The user gets an instant response; the email is sent by a worker
SendEnrollmentEmail::dispatch($enrollment);
Response time drops from seconds to milliseconds, and a slow email provider can no longer slow down your checkout. Redis or the database works as the queue driver; Laravel Horizon gives you a dashboard to watch it.
Stage 5: Many app servers behind a load balancer (100,000+ users)
When one app server's CPU stays high even after caching, add more app servers and put a load balancer in front. It spreads requests across them and stops sending traffic to a server that fails its health check.
+--> [ App 1 ] --+
Users --> [ LB ] +--> [ App 2 ] --+--> [ Redis ] [ Primary DB ]
+--> [ App 3 ] --+
For this to work, app servers must be stateless:
- Sessions go to Redis or the database, not local files — otherwise users get logged out when they hit a different server.
- Uploaded files go to object storage (S3, Cloudflare R2, DigitalOcean Spaces), not the local disk.
- Scheduled tasks run on only one server, or use a lock, so a cron job does not run three times.
Stage 6: Scaling the database (1,000,000 users)
Now the database is the bottleneck again. Options, from simplest to hardest:
- Bigger database server — still the cheapest fix surprisingly often.
- Read replicas — copies of the database that handle read queries. Most apps read far more than they write, so this removes a lot of load. Trade-off: replicas lag behind by milliseconds to seconds (replication lag), so read your own writes from the primary.
- Partitioning and archiving — move old rows (logs, old orders) out of hot tables.
- Sharding — splitting data across several databases, for example by user ID. Powerful but complex; most companies never need it.
Reliability: what happens when something fails?
At scale, something is always failing. Good system design assumes it:
- Remove single points of failure — two app servers instead of one, a database with automatic failover.
- Back up and test restores — a backup you have never restored is a hope, not a backup.
- Monitor — uptime checks, error tracking (Sentry, Flare) and server metrics, so you hear about problems before users do.
- Rate-limit public APIs so one bad client cannot take everyone down (see our Laravel throttle snippet).
The scaling checklist
| Symptom | Try first |
|---|---|
| A few pages are slow | Slow query log, indexes, fix N+1 |
| Same data loaded repeatedly | Redis cache, CDN for static files |
| Requests wait on emails or files | Queues and workers |
| App CPU high all day | More app servers + load balancer |
| Database CPU high from reads | Read replicas |
| Site down when one server fails | Redundancy, health checks, failover |
FAQ
Do I need microservices to scale?
No. A well-built monolith with caching, queues and a load balancer serves a very large number of users. Microservices solve team-size and deployment problems more than performance problems, and they add network calls, distributed debugging and operational cost.
When should I start thinking about system design?
From day one, but only lightly: keep app servers stateless, store files in object storage, put slow work in queues and log slow queries. Those habits make every later stage easy.
Is system design only for interviews?
Interviews test it, but the real value is practical: knowing why your app is slow and what to fix first saves money and prevents outages.
Keep learning
Understanding how a single request travels is the foundation of all of this — start with How Does a Website Work? if DNS and HTTP are still fuzzy. Then secure what you build with our OWASP Top 10 guide.