In plain words
Scaling out means adding more identical instances of a service behind a load balancer, which only works when no instance keeps anything in its own memory or disk that the others need.
Where you see it
Harbor's autoscaler grows the API from 4 containers at night to 20 on a Monday morning. It worked well until someone added an in-memory rate limiter, and every new container handed each user a fresh allowance.
What goes wrong
- State kept on one instance
Sessions in memory, uploads on local disk and in-process rate limits break as soon as there are two copies. Move them to shared places: Redis, object storage, the database.
- Scaling the app into the database
Twenty instances with a pool of 20 connections each want 400 connections from a database that allows 100. Count connections before raising the maximum, and put a pooler in between.
- Scaling on the wrong signal
Workers waiting on slow API calls use little CPU, so a CPU-based autoscaler never adds more while the queue grows. Scale workers on queue depth or job age instead.
What to tell your agent
Quick check
Sign in to earn +10 XP for itHarbor scales from 4 to 12 API instances during a traffic spike, and users start being signed out at random. What's the likely cause?