Interview Prep/Real-World Interview/Scaling and performance

How do you decide between vertical and horizontal scaling for a service?

BeginnerScenarioScaling and performance
Answer

Situation read → It depends on whether the workload can be split across instances.

What I'd do →

  1. Stateless web and API tiers: horizontal. More pods behind a load balancer, autoscaled by HPA.
  2. Single-writer stateful systems (a primary DB): vertical first, then read replicas, then sharding as a last resort.
  3. Workloads that need lots of memory per unit (big in-memory models, caches): vertical, or shard by key.
  4. Use VPA in recommendation mode to right-size requests, and HPA to handle load changes. Don't let both act on CPU for the same deployment.

Why → Horizontal scaling also gives redundancy; vertical scaling has a ceiling and often needs a restart.

Interview tip → Mention the VPA and HPA conflict on the same metric.

All Real-World Interview questions Roadmap: Interview readiness

More on Scaling and performance