Circuit breaker
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 · 8 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 fast does one slow dependency fill checkout’s thread pool?

      Can a breaker per shard still fill its window?

        How many probes hit a service the moment it recovers?

          Build-up · 5 steps

          Watch one breaker trip and recover

          One breaker over 100 seconds, with a 50% threshold, a 10-second window and a 30-second wait.

          Step 1 of 5

          Closed: count every call

          Calls flow through, and the breaker records each outcome in a sliding window, here the failure rate over the last 10 seconds. About 2% fail on a good day.

          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

            “Every call to recommendations has a retry and a circuit breaker. Which one wraps the other?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “Your orders store has four shards and shard B just died. How do you scope the breaker?”

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “The breaker in front of your cache opens. Someone suggests falling back to the database behind it. Do you?”

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “300 checkout instances open their breakers in the same second. How do you set the wait and the probes?”

            Your move. Pick an approach:

          Build-up · 5 steps

          Wrap one call in four layers

          The usual order from the network call outwards, the one Resilience4j’s Spring integration applies. Order matters.

          Step 1 of 5

          The raw network call

          Start with the call itself. On its own, a hung call holds a thread for as long as the dependency takes.