ML in Practice — Lightweight MLOps
Back to Serving and Deployment

Scaling — Autoscaling, Latency Budgets, Caching

How to keep predictions fast and the bill manageable as traffic grows. FIND_VIDEO: search 'ML service latency caching autoscaling' — recommended channel: Made with ML / Chip Huyen. Aim for 10 min or under.

13 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.
Loading progress...

Key moments

  1. Static Replica Limitations — Reviewing declarative deployment manifests and identifying why static replica counts cause over-provisioning or traffic starvation.
  2. Cluster Provisioning — Bootstrapping a 6-core local kind Kubernetes cluster and deploying a sample Go web server with 500m CPU requests.
  3. Traffic Generation with wrk — Deploying an Alpine traffic generation pod and running multi-threaded HTTP benchmarking tests using wrk.
  4. Metrics Server Deployment — Installing metrics-server, patching Kubelet TLS arguments for kind, and verifying live node and pod telemetry.
  5. Manual Scale Optimization — Calculating node millicore capacity, identifying a 300% CPU bottleneck, and scaling replicas to 4 to balance traffic.
  6. Autoscaling API Verification — Querying cluster API versions to verify autoscaling group availability in preparation for HPA configuration.
PDF notes

Frequently asked questions

Why does metrics-server fail to scrape metrics out of the box in kind?

Kind clusters use self-signed Kubelet certificates by default, which causes Metrics Server TLS certificate verification to fail unless patched with `--kubelet-insecure-tls`.

What does 500m CPU mean in a deployment manifest?

500m represents 500 millicores, which is exactly equivalent to 0.5 physical or virtual CPU cores reserved for container scheduling.

Why did CPU drop below 500m when scaling from 1 to 4 replicas under constant wrk load?

Kubernetes services distribute incoming connections across all ready pod endpoints, cutting the traffic and compute load processed by each individual pod by approximately four.

How does Kubernetes decide when a pod is at 100% CPU utilization?

Autoscaling metrics calculate utilization percentage relative to the declared CPU request value, meaning a 500m request consuming 500m is evaluated at 100% capacity.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.