Cost-aware design
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Cost-aware design: the 60-second story

    Cost-aware design

    Your cloud kitchen checks the gas price daily. Gas is 6% of the bill.

    The biggest line is delivery, charged per kilometre. Then a freezer of old sauces and CCTV that keeps everything.

    A Flipkart-style sale makes the bill jump fivefold. Bad news?

    Not if cost per order stays flat. If it rises, something scales worse than linearly, such as a chatty service or an over-eager log level.

    6%

    of the photo app’s bill is compute

    Take a photo app with 1M daily users: about $33k a month. Delivery is 48% and storage 25%. Bytes, not CPU.

    Same bytes to S3. Why does one route cost $4,500?

    Bytes are priced by where they go: $0.045 per GB through a NAT gateway, $0 through a gateway endpoint for S3.

    Delivery is half the bill. What first?

    Bad: A CDN in front

    Still 225 TB a month: saves barely $1,070.

    Good: Shrink bytes, then a CDN

    WebP or AVIF at, say, 100 KB, not 150: saves $4,070.

    Prime Video’s serverless stream monitor passed frames via S3. Why so costly?

    The bill

    Per-transition charges for every second of every stream, plus S3 calls for frames. One process on ECS cut cost over 90%.

    Daily peaks, quiet nights. How much do you commit?

    A committed hour is paid, used or not. Commit to the floor of 10: about $2,049 a month. Commit to the average of 20: $2,144, worse.

    Every saving has a price

    1. Smaller images: transcode CPU, purges on delete
    2. Cold originals: retrieval fees if access changes
    3. Spot resizers: work re-queued on a two-minute warning
    4. Sampled logs: one successful request may be missing

    The interview line

    Cost is a requirement with a number. Divide the bill by business volume, cut the biggest line, and name the price.