Skip to main content
Cloud / DevOpsTraffic & ScalingDiagramIntermediate

Auto Scaling

KO: 오토 스케일링·EN: Auto Scaling·JA: オートスケーリング

A cloud elasticity mechanism that automatically scales compute instances or containers out during traffic spikes and in during lulls to balance reliability and cost

Table of Contents

Structure Diagram

Auto Scaling Capacity Tracking Against Traffic Spikes
Scale OutScale InTime →Load /
(34, 78)Incoming Traffic #3
Quick Answer

What is Auto Scaling?

A cloud elasticity mechanism that automatically scales compute instances or containers out during traffic spikes and in during lulls to balance reliability and cost. It is a core concept in Traffic & Scaling within Cloud / DevOps.

Core Principles

Auto Scaling solves a classic infrastructure dilemma: provisioning permanently for peak traffic wastes money during quiet hours, while provisioning for average traffic causes outages during spikes. It automatically adds compute units (Scale-out) as load rises and terminates idle units (Scale-in) once demand subsides.

Teams combine two main modes:

  • Reactive scaling: Adjusts replicas dynamically based on live telemetry such as CPU, requests per second (RPS), or queue depth (e.g., Kubernetes HPA, AWS Target Tracking).
  • Scheduled & predictive scaling: Pre-warms capacity ahead of known traffic surges—like morning commute hours or flash sales—so users never feel cold-start lag.

Practical Takeaways

  • Scale on business-relevant signals, not just CPU: I/O-bound APIs and LLM gateways can saturate network sockets or response latency while CPU sits at 30%. Scale web tiers on requests per instance or p95 latency, and background workers on queue depth (SQS/Kafka lag).
  • Scale out fast, scale in slow: Configure generous stabilization windows and cooldowns (5–10 minutes) before removing replicas so fluctuating load doesn't trigger wasteful flapping (repeatedly spinning pods up and down).
  • Protect downstream bottlenecks and set hard caps: Scaling stateless app servers 10× can instantly exhaust database connection pools or blow up cloud bills during a DDoS attack. Always pair auto scaling with connection pooling (PgBouncer/RDS Proxy), read replicas, and explicit maxReplicas ceilings.

Notable Examples

  • Kubernetes HPA & KEDA: Dynamically scaling container pods from zero to hundreds based on HTTP concurrency, Kafka lag, or Prometheus metrics.
  • AWS Auto Scaling Groups & ECS Target Tracking: Maintaining steady per-instance load behind an Application Load Balancer.
  • E-commerce flash sales & ticketing: Pre-scaling via scheduled policies minutes before launch and scaling back down automatically overnight to cut compute spend.

Practical Code Snippet

Copy and drop straight into your project
hpa.yamlYAML
apiVersion: autoscaling/v2kind: HorizontalPodAutoscalermetadata:  name: api-hpaspec:  scaleTargetRef:    apiVersion: apps/v1    kind: Deployment    name: api-server  minReplicas: 2  maxReplicas: 12  metrics:    - type: Resource      resource:        name: cpu        target:          type: Utilization          averageUtilization: 70