Interview's MateSystem Design
Interview's Mate

System Design

Architecture & trade-offs

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
All topics/Scalability
FUNDAMENTALS & NETWORKING · SUBTOPIC

Stateless Architecture

Keep user state out of server RAM so any server instance can handle any request.

BeginnerPart of Scalability
Practice in AI HLD
Subtopics in Scalability (4)
OverviewVertical ScalingHorizontal ScalingStateless TiersAuto-Scaling & R/W Split

In plain words

A stateless server has no memory of past visits. Every request brings its own ID card (like a token) or looks up shared memory in Redis, so any server can help you.

Think of it like…

Any bank teller can serve you because your balance lives in the bank’s central computer, not in one teller’s personal notebook.

Loading interactive diagram
Loading interactive exercise

Theory & how it works

Why sticky sessions are a trap

Some teams try to work around stateful servers by turning on "sticky sessions" (making the load balancer always send User X to Server A). That breaks as soon as Server A crashes, deploys new code, or gets overloaded by a few heavy users.

True statelessness means keeping zero user-specific data in local RAM or local disk between HTTP requests.

Where state goes instead

Authentication state goes either inside signed JWT tokens (verified locally with no DB call) or in a fast shared store like Redis. Uploaded files go to S3/GCS via pre-signed URLs. Scheduled work goes into a shared queue.

Key points & practical guide

Summary checklist

  • Store sessions in Redis or stateless signed tokens (JWT)
  • Store files/uploads in object storage (S3), never local server disk
  • Avoid sticky sessions for standard HTTP APIs (only WebSockets inherently hold a TCP socket)

When to use it

  • All REST/GraphQL/gRPC web and API servers
  • Auto-scaling fleets and serverless functions

Watch out for

  • Caching mutable user data in global variables inside a Node/Python worker
  • Writing temp user uploads to /tmp across multi-step wizards

Quick check

Loading quiz
Previous subtopic
Horizontal Scaling (Scale Out)
Next subtopic
Auto-Scaling & Read/Write Split