Core Scale & Availability
Design services without server-side session state for easy scaling and resilience
Keep service instances free of user or request session state so they can be scaled, replaced, and rescheduled freely. Externalize all state to durable systems like databases, caches, and object storage.
When you need horizontal scaling, rolling deployments, autoscaling, or multi-zone/region resilience and want to avoid sticky sessions and node affinity.
Web/API services that need elastic scaling, rolling deploys, and resilience across zones.
# Stateless service (Kubernetes sketch)
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
replicas: 4
template:
spec:
containers:
- name: app
image: example/api:latest
env:
- name: SESSION_STORE_URL
value: redis://redis:6379
- name: DATABASE_URL
value: postgres://db:5432/app
# Readiness for safe draining
readinessProbe:
httpGet: { path: /healthz, port: 8080 }
Stateless microservices behind Zuul and Envoy enable massive scale
Millions of RPS across thousands of instancesStateless web pods autoscale per-merchant load
Peak flash-sale traffic globally12-factor apps encourage stateless dynos
Millions of containers across regionsHorizontal - Add instances freely
Low to Medium - Externalize state
Low - Simpler scaling and ops