Production › Scaling

Scaling

Design for horizontal scale: stateless HTTP nodes + independently scaled workers.

#Scale units

UnitScales byNotes
appReplicas behind a load balancerSession/cache externalized (Redis)
workerReplica countQueues + Kafka consumers
postgresVertical / read replicasKeep write path simple
redisCluster / managed serviceLocks & cache
kafkaPartitions + consumer groupsThroughput & ordering trade-offs
docker compose up --scale worker=5

#Stateless app rules

  1. No local disk for critical state (use S3/compatible storage).
  2. Cache and sessions in Redis (or equivalent).
  3. Uploads and generated files on shared object storage.
  4. Configuration via environment variables.

#Worker scaling

#Performance practices

#Observability

Correlate requests and async work with correlation_id on domain events and structured logs (app/Observability).

Edit this page on GitHub