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.

    Layer 3 · Go deeper · 7 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    What does 2 KB of logs per request cost at 1,000 requests a second?

      At what steady load do two servers beat Lambda?

        Is a two-week project that saves $200 a month worth it?

          Build-up · 6 steps

          Cut the photo app’s bill by 41%

          Version 1 of a photo-sharing app with 1 million daily users. One region, two AZs, all on demand, nothing tuned. US East list prices.

          Step 1 of 6

          Price every line, then rank

          Price each meter, divide by volume, rank: $32,832 a month, 3.3 cents per daily user. Delivery and storage are 73% of it; compute, the usual first target, is 6%.

          4 interview moments

          You’re the candidate

          The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

          1. Deep dive 1 of 4

            Interviewer

            “Your photo app serves 225 TB of photos a month straight from S3: $15,650, 48% of the bill. What do you change first?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “Your delivery API averages about 20 instances, never drops below 10 and peaks at lunch and dinner. How do you buy capacity?”

            m7g.xlarge instances: $0.1632 an hour on demand, $0.1199 on a 1-year Compute Savings Plan.

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “360 TB of photos sit in S3 Standard, and originals are rarely opened after the first weeks. What lifecycle rule do you write?”

            Resized thumbnails are under 128 KB, and about 1% of old originals are read back each month.

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “Managed Multi-AZ Postgres costs $698 a month; two self-run instances cost $313. Do you switch to save $385?”

            Assume an engineer costs $10,000 a month.

            Your move. Pick an approach: