cloudpatterns.appClassroomKatasWhiteboardBlog
Kata

Same SLO, half the bill

Pixel’s new video spin-off, Clip, was launched by a contractor — two services, both sized “to be safe” and never looked at again.

20 minMedium

Members kata

Membership isn’t open yet. One kata or case is open to you now, 1 more with a free account.

The canvas opens for members

The brief

Pixel’s new video spin-off, Clip, was launched by a contractor — two services, both sized “to be safe” and never looked at again. Now the finance lead has a question: why does Clip’s bill say about $672 a month? The web tier serves page loads through a compressed day of 80 seconds: 150 a second most of the day, building from second 20 to an evening peak of 600 a second (seconds 26 to 39), then back down by second 42. It runs on xlarge servers under an autoscale policy set to min 4 and max 4. The thumbnail service takes a steady 110 video uploads a second on one xlarge; it holds each upload in memory while it cuts its thumbnail (1 CPU unit and 40 MB per upload). (At a steady 110 a second, the thumbnails are well past a function’s break-even, so they stay on servers.) Everything passes today. Keep the same SLO — every page and upload served, P99 under 40 ms, both services up — for under $300 a month, well under half. A web request takes 2 CPU units (plus 5 idle per server). Each size down halves the price: an xlarge is about $134 a month (800 CPU units, 16 GB), a large $67 (400, 8 GB), a medium $34 (200, 4 GB). You pay for every server while it runs, including one still booting. In this sim, a server kept above 95% busy (CPU or memory) for 5 seconds goes down and stays down; above 80% it slows. A new server takes 2 seconds to boot.

What it checks

  1. 1Predict a server's utilization and monthly price one and two sizes down, and whether the smaller size still carries the peak with headroom.
  2. 2Explain why a resize decision needs the peak (a high percentile over days), memory as well as CPU, and a target utilization below 100%.
  3. 3Predict a day's instance-hours and bill for a fleet sized for the peak and for an autoscaled one, from a traffic curve and one server's capacity.
  4. 4Explain how the minimum, headroom, scale-in delay and maximum each trade money against the risk of being slow or turning users away.