Architecture

7 min read

November 22, 2026

How to build a scalable web application

Scalability starts with a sound data model and boundaries, not with microservices: caching, background work, database growth, statelessness and observability, in the order they matter.

By Parth Patel

Scalability is often treated as an infrastructure problem: more servers, Kubernetes, microservices. In practice, most web applications that struggle under load are limited by their data model, their queries and work done in the wrong place. Here's the order in which scalability work actually pays off.

1. Get the data model right

A clean, normalized schema with the right constraints and indexes carries an application a very long way. Most "we need to scale" moments are really slow queries:

  • Missing indexes on the columns you filter and join by.
  • N+1 query patterns in list pages and APIs.
  • Unbounded queries that load whole tables.

Profile with real data volumes before changing anything else.

2. Keep the application stateless

Store sessions and uploads outside the application server, in a database, cache or object storage. Stateless servers can be added or replaced freely, which makes horizontal scaling and zero-downtime deployments straightforward.

3. Move slow work off the request path

Emails, reports, image processing, third-party calls and AI requests belong in background jobs. The request returns quickly; a queue and workers do the rest, with retries and dead-letter handling for failures.

4. Cache deliberately

  • HTTP and CDN caching for public pages and assets.
  • Application caching (for example Redis) for expensive, frequently read data.
  • A clear invalidation strategy, decided up front.

Caching hides problems as well as solving them, so add it after you've measured.

5. Plan for database growth

Read replicas for read-heavy workloads, connection pooling, archiving old data and, much later, partitioning. Most applications never need sharding.

6. Draw boundaries before splitting services

A modular monolith, one deployable with strict module boundaries, scales further than most teams expect. Split a module into its own service when it genuinely needs to scale, deploy or be owned separately.

7. Observe everything

Structured logs, metrics and traces tell you where the time goes. Without them, scaling work is guesswork.

A checklist

  1. Indexes and query plans checked with realistic data.
  2. Stateless application servers.
  3. Background jobs for slow work.
  4. Caching with clear invalidation.
  5. Monitoring, alerts and tracing.
  6. A load test you can rerun.

Do these well, and most applications scale smoothly long before they need anything more exotic.

Next step

Working on something like this? Let’s talk it through.

Send a short brief. You’ll get a written reply from me within two business days — either a few clarifying questions, a suggested first step, or an honest “I’m not the right fit” with a pointer elsewhere.

Parth Patel

Senior full-stack engineer