Skip to content

Cost engineering: cost per request as a design input

Cost per request and cost per 1,000: the bill split into a fixed part and a part for each request, comparing two designs, the three levers, alerts on unit cost, and when saving is not worth the effort.

  • Lesson 161 of 169
  • 12 min read
  • Depth
  • Free to read · No account needed
On this page
  1. Why interviewers ask this
  2. The idea in plain words
  3. Pause and predict
  4. Worked example
  5. Trade-offs
  6. Common misconceptions
  7. How to say it in the interview
  8. Check your understanding
  9. Answers
  10. Summary card: cost per request
  11. Sources

01Why interviewers ask this

The interviewer says: "Your design handles 10,000 requests per second. What does one request cost? Which design is cheaper?" A weak answer says "servers are cheap". A strong answer gives a number and names the part to cut.

02The idea in plain words

A tea stall pays rent and a helper every day, even with no customers. It also pays for milk and sugar for each cup. One cup costs the daily bill divided by the cups sold.

Cost per request is the bill for a period divided by the requests in that period. The same works for one user, one GB or one prediction. Cost per 1,000 requests is the bill divided by the thousands of requests.

The bill has two parts (lessons 31 and 130):

  • Fixed part: paid with no traffic, such as servers that run all month.
  • Part for each request: compute time and memory, calls to a managed service, storage by kind, data moved out of the cloud or between zones, and logs.

So cost per request = fixed part / requests + per-request part. More traffic spreads the fixed part, so a busy service pays less for each request, until it must add servers. Use the whole bill, including idle servers. Capacity paid only while a job runs counts only those hours.

Three levers lower it: do less work for each request (lesson 53), use cheaper capacity (reserved for steady load, spot for work that can restart), or move work to a cheaper time or place, such as a night batch on idle servers. Alert on cost per request, not only on the total (it rises with traffic).

Want to check your understanding? Try explaining this idea in your own words. You can continue reading first, or ask the AI tutor a question. Sign up free to ask the tutor

03Pause and predict

Pause. Guess first.

A service pays Rs 43,200 a month for servers and Rs 68,400 for the parts that grow with requests, for 900,000,000 requests. Traffic doubles, and the same servers cope. Does cost per 1,000 requests go up, down or stay?

Write your guess before you read on. The answer is in the worked example.

04Worked example

An order-status API. Assumptions (made up, not quotes): 30,000,000 requests a day, so 900,000,000 in 30 days. Six servers at Rs 10 an hour: 6 x 10 x 720 = Rs 43,200. A managed database charges Rs 0.02 per 1,000 reads, and each request reads twice. Logs are 1 KB per request at Rs 20 per GB. The answer is 2 KB at Rs 8 per GB sent out.

Design A.

  • Reads: 1,800,000,000 / 1,000 x 0.02 = Rs 36,000.
  • Logs: 900 GB x 20 = Rs 18,000. Data out: 1,800 GB x 8 = Rs 14,400.
  • Total: 43,200 + 36,000 + 18,000 + 14,400 = Rs 111,600. Per 1,000 requests: 111,600 / 900,000 = Rs 0.124. Fixed Rs 0.048, per-request Rs 0.076.

Doubling (predict box). The per-request part doubles to Rs 136,800. The total is 43,200 + 136,800 = Rs 180,000 for 1,800,000,000 requests: Rs 0.100 per 1,000, so it goes down.

Design B. Add one cache server (Rs 7,200). Assumption: 80% of reads hit the cache, so reads cost Rs 7,200. Keep 1 in 10 log lines (all routine): Rs 1,800. Total: 43,200 + 7,200 + 7,200 + 1,800 + 14,400 = Rs 73,800, or Rs 0.082 per 1,000. This saves 37,800 a month. Assumption: the work takes 2 engineer-weeks at Rs 62,500 = Rs 125,000, so it pays back in 125,000 / 37,800 = 3.3 months.

Alert. Divide each day's bill by its requests. Alert at 25% above that weekday's usual value (our choice).

Not worth it. A job costs Rs 3,000 a month. Halving it saves Rs 1,500. One engineer-week is Rs 62,500, which is 41.7 months of savings, unless the job will grow.

Hotstar wrote on 19 Oct 2026 that its 7.5 KB playback signal has six consumers at 2.1 million messages per second. Most need about 1.1 KB, so it trimmed the message before fan-out. Its title says 350,000 dollars a year saved, a projection (company figures). Cost grows with bytes x consumers x rate. Link: https://blog.hotstar.com/the-kafka-optimization-that-saved-us-350k-a-year-48a0e05c3c08 (opens in a new tab)

05Trade-offs

Unit cost solves comparison: it shows which design is cheaper and when the bill outgrows traffic. It costs effort to count requests and split shared bills. I would use it for any large bill, not a small one.

06Common misconceptions

"A lower bill means a lower cost per request." Traffic may have fallen.

"Servers are the cost." In design A they are 39%.

07How to say it in the interview

Say it like this

I compute cost per 1,000 requests as the bill divided by requests, split into a fixed part and a part for each request. I compare designs on it, cut the biggest part, and alert on the unit cost.

08Check your understanding

  1. Define cost per request. Name the three levers.
  2. A service has a fixed bill of Rs 20,000 and pays Rs 0.05 per 1,000 requests. It serves 500,000,000. Cost per 1,000?
  3. A fix saves Rs 2,000 a month and takes 3 weeks at Rs 62,500 a week. Do it?

09Answers

Show the answers
  1. The bill for a period divided by its requests. Do less work, use cheaper capacity, move work to a cheaper time.
  2. 20,000 / 500,000 = 0.04. Add 0.05: Rs 0.09 per 1,000.
  3. 3 x 62,500 = 187,500, which is 187,500 / 2,000 = about 94 months of savings. No, unless the bill will grow.

10Summary card: cost per request

One-page summary

  • Cost per request = bill for a period / requests in it.
  • Fixed part + part for each request. Busier means cheaper, until you add servers.
  • Example: Rs 0.124 per 1,000 (design A), Rs 0.082 with a cache; payback 3.3 months.
  • Levers: do less, cheaper capacity, cheaper time. Alert on unit cost.
  • Trap: tuning a small bill.

11Sources

Try what you just learned

Put this idea into practice with a short exercise or a relevant tool. Free to try. No sign-up needed.

More practice. This needs a free account.

Continue learning with the lessons that build on this one.

Practise this idea

Have a question about this lesson?

Ask the AI tutor to explain a difficult idea, walk through an example or check your understanding. It uses the lesson to help you work through the topic.

A free account includes 10 AI tutor questions a day. The lesson remains free to read without an account.

All lessons in Module 23: Big systems in depth

Prefer another topic? Browse all 169 lessons.