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.
How much dedupe state do 7 days of event IDs need?
What does tenant t_7f3a cost to serve each month?
Build-up · 6 steps
Follow one usage event to the invoice
One event, 1,840 output tokens for tenant t_7f3a, from the service that did the work to a line on its invoice.
Step 1 of 6
Emit without blocking
The request path only appends the event, its ID minted when the work completed, to a local spool, memory first, then disk. Billing can never slow down or fail the request.
4 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 4
Interviewer
“Shippers resend batches when acks get lost, and consumers reprocess events after a crash. How do you stop usage being billed twice?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“October just ended. Spools are still draining after an outage and a mobile SDK syncs tomorrow morning. When do you finalise October’s invoices?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“Your API meter has three tiers, ₹0.50 a call to 100,000, ₹0.30 to 1,000,000, ₹0.20 beyond. How do you apply them?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“A tenant has a hard quota of 1,000,000 calls, and the gateway gets about a millisecond per request. What does it check?”
Your move. Pick an approach: