Sync vs async
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 · 9 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 long does a 10-service synchronous chain fail each month?

      How many requests pile up when one dependency hangs?

        How long does the sale’s invoice backlog take to drain?

          Build-up · 6 steps

          Place one food-delivery order

          For each step, ask one question. Does the user need this result before they see “Order placed”? Only three steps pass.

          Step 1 of 6

          Validate the cart

          The order service checks cart, price and coupon synchronously, in about 80 ms. The total must be right before anything else happens.

          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

            “A tatkal booking call times out, and the user is about to tap “Book” again. What should the app do?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “A teammate says “Let’s make everything async with Kafka”, payment included. How do you respond?”

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “The order service commits the order, then publishes OrderPlaced to Kafka inside the request. What’s wrong with that?”

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “Five services call each other in a chain, and each retries three times on error. The database at the bottom starts failing. What happens?”

            Your move. Pick an approach:

          Build-up · 5 steps

          Accept now, answer later, over HTTP

          A 12-month statement or a video transcode outlasts any open connection. Azure’s Asynchronous Request-Reply pattern is the standard shape.

          Step 1 of 5

          Validate, then accept

          The client POSTs the job with an idempotency key. The API validates first, so a bad request gets a 400 while the client is still listening.