Usage billing
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 · 12 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 many usage events a second at the festive-sale peak?

      How many rows does a month-end invoice run read?

        What does prepaid enforcement cost at peak?

          How long does the month-end invoice run take?

            What if you round every event to the paisa?

              Build-up · 6 steps

              Build the high-level design

              One functional requirement at a time, ending with a design that works for one region at moderate scale.

              Step 1 of 6

              Report usage

              A metering SDK batches events and spools them to disk if ingest is down, so billing never blocks a message. Ingest validates, writes to Kafka and returns 202; an archiver keeps every event untouched.

              6 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 6

                Interviewer

                “Retrying fixes lost events and causes double counts. How do you record 10 billion usage events a day?”

                Your move. Pick an approach:

              2. Deep dive 2 of 6

                Interviewer

                “The dashboard needs an answer within a minute; the invoice needs the exact answer. How do you serve both?”

                Your move. Pick an approach:

              3. Deep dive 3 of 6

                Interviewer

                “Usage from 23:58 on 31 October arrives at 00:20, and some arrives days later. When do you finalize October?”

                Your move. Pick an approach:

              4. Deep dive 4 of 6

                Interviewer

                “Prices change mid-month, and disputes regenerate old invoices. How do you price usage so the answer never changes?”

                Your move. Pick an approach:

              5. Deep dive 5 of 6

                Interviewer

                “A prepaid customer with ₹10,000 sends messages at ₹0.20 each. How do you stop them at zero without slowing their sends?”

                Your move. Pick an approach:

              6. Deep dive 6 of 6

                Interviewer

                “200,000 invoices are due at month end, and last time the run crashed at customer 1,23,456. How do you run it?”

                Your move. Pick an approach:

              Build-up · 8 steps

              Follow one WhatsApp message through it

              The request path touches only the gateway and its in-memory leases. Everything that decides money runs on closed, reproducible data.

              Step 1 of 8

              Report

              The messaging API hands an event keyed by the WhatsApp message ID to its SDK, which batches it to ingest or spools it. Ingest validates it and writes it to usage-raw.