📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

Tell me about a time a third-party dependency, such as a payment provider or an external API, went down or got very slow. How did it affect your system, what did you do during the outage, and what did you change so the next outage hurt less?

A STAR story for a third-party outage: cascading failure through timeouts and retries, mitigation with circuit breakers, fallbacks and queuing, communication, and resilience changes afterwards.

Senior RealWorldScenario Advanced circuit-breaker polly real-world resilience star-story third-party-outage

🎯 Key points

  • Impact explained with Little's law: concurrency = throughput x latency, so a 100x slower dependency means 100x in-flight requests
  • Confirmed it was the dependency: Application Insights dependency failures and duration by target, provider status page
  • Mitigation: flag or circuit breaker to fail fast, degrade gracefully, queue work for later
  • Retries cut during the incident; afterwards bounded, jittered, idempotent-only
  • Customer experience: clear 'pending' state and confirmation email instead of a spinner or a 500
  • Communicated: incident channel, support message template, provider ticket, business impact estimate
  • Lasting changes: explicit timeouts (HttpClient still defaults to 100 s in .NET 10), circuit breaker, queue hand-off, capacity headroom for retries
  • Result in numbers: error rate and customer impact versus the next outage

⏱ 30-second answer

My story is [the payment provider] slowing from [300 ms] to [30 s] for [40 minutes]. Our HttpClient had the default 100-second timeout and three retries, so requests piled up, held threads and connections, and our whole API started failing, not just payments. I confirmed it from the Application Insights dependency view and the provider's status page, then switched payments to an 'accept order, charge later' path behind a feature flag so customers could still check out. Afterwards I added Microsoft.Extensions.Http.Resilience with a [3 s] attempt timeout, a circuit breaker and jittered retries only on idempotent calls, and moved charging behind a queue. The next provider outage cost [zero] failed checkouts. The trade-off: deferring the charge means some orders later fail payment, so it needs a business decision.

🗣 Full answer (senior)

How I would answer this in an interview

"At [company], our [checkout API] called [a payment provider] synchronously. One [Friday evening] the provider didn't go down, it got slow: calls went from [300 ms] to [30 seconds]. That was worse than an outage. Our HttpClient used the default 100-second timeout plus three retries, so each checkout held a thread and a connection for minutes. Within [ten] minutes the whole API was timing out, including pages that had nothing to do with payments.

I was [on call]. The Application Insights application map showed the provider's dependency duration had exploded while everything else looked normal, and their status page confirmed 'degraded performance'. I made two calls. First, I turned on an existing feature flag that took the payment call out of the request: we accepted the order, put a 'charge pending' message on a Service Bus queue, and told the customer they'd get a confirmation email. Second, I cut the retry count to zero through configuration so we stopped adding load. The rest of the API recovered in about [five] minutes, and checkout kept working. I posted updates in the incident channel and the support team got a customer message template.

Afterwards I replaced our hand-rolled retry with Microsoft.Extensions.Http.Resilience: a [3-second] per-attempt timeout, a circuit breaker that opens at a [20%] failure ratio, and jittered retries only for idempotent calls with an idempotency key. Charging moved permanently to the queue-based worker. When the provider had another outage [three months] later, we had no failed checkouts and the queue drained in [12] minutes after recovery. The lesson: every dependency will fail, so the question is whether it takes you down with it."


How a slow dependency becomes your outage

Stage Mechanism
Dependency slows Each call holds a thread (or async state) and an outbound connection
Long timeout Requests stay in flight for 100 s (HttpClient default)
Retries Multiply load on an already struggling provider
Resource exhaustion Connection limits, ThreadPool starvation if any code blocks, memory
Cascade Unrelated endpoints share the same pool and fail too

Mitigation toolbox

Tool Effect Trade-off
Short attempt timeout Fail fast Slow but healthy calls fail
Circuit breaker Stops calling a failing dependency Need a fallback for when it's open
Fallback / degrade Cached data, "pending" state, hide feature Business has to accept the degraded behaviour
Queue and process later Decouples customer from dependency Eventual consistency; failure handling later
Bulkhead (concurrency limit) One dependency can't use all resources Excess calls rejected

Production example

Template: [payment provider] p95 [300 ms] → [30 s] for [40 min]; our API error rate [0.2%] → [35%]; feature flag to deferred charging restored service in [5] min; next outage [3] months later: [0] failed checkouts, queue drained in [12] min.

🔍 What the interviewer is checking

Checks whether you understand how dependency failures cascade, can contain the damage during an outage you don't control, and design so the next one hurts less.

Green flags

  • Explains the cascade through timeouts, retries and shared resources
  • Fails fast and degrades gracefully, agreed with the business
  • Uses timeouts, circuit breakers, idempotent retries and queues afterwards
  • Communicates well and proves the change in a later outage

Red flags

  • "We waited for the vendor"
  • More retries as the response
  • Retries on non-idempotent calls
  • Blames the vendor; no measurable outcome

📚 Learn in depth

1. What the interviewer is really assessing

This story tests resilience thinking: do you understand how a dependency failure cascades, do you mitigate with fail-fast and degradation rather than heroics, and do you involve the business in the trade-off (for example, deferring payments). It also checks communication during an incident you don't control.

2. The cascade

Client -> Checkout API --(HttpClient, 100 s timeout, 3 retries)--> Provider (30 s responses)
              |
   in-flight requests grow: arrival rate x time in system (Little's law)
              |
   400 req/s x 30 s = 12,000 concurrent requests -> connection limits, memory, threads
              |
   every endpoint on the instance slows -> health probes fail -> restarts

Little's law makes the point with a number: concurrency = throughput × latency. When latency goes up 100×, concurrency does too, unless you cap it.

3. The .NET building blocks

  • IHttpClientFactory with Microsoft.Extensions.Http.Resilience (built on Polly v8): AddStandardResilienceHandler() gives rate limiter, total timeout, retry, circuit breaker and attempt timeout; AddResilienceHandler("name", ...) builds a custom pipeline.
  • Circuit breaker options: FailureRatio, MinimumThroughput, SamplingDuration, BreakDuration.
  • Idempotency keys on payment calls so a retry can't double-charge.
  • Azure Service Bus for deferred work, with dead-lettering for charges that keep failing.

4. Frameworks for telling it

STAR, with two clear decisions in the Action (degrade, stop retries). The SOAR variant fits well because the obstacle is that you don't control the dependency.

5. How it is scored

Weak: "we waited for them to fix it." Good: added a circuit breaker afterwards. Strong: explains the cascade and the mitigation during the incident. Excellent: involved the business in the degradation decision, communicated well, and proved the change in the next outage.

6. Adapting the story

This story also answers "a time you made a decision without full information", "a time you worked with an external party" and "a time you designed for failure". For a non-technical interviewer: "The payment company got very slow and dragged our whole site down. I switched us to take orders and charge later, then changed the design so their problems can't take us down again."

Try it yourself

  1. Point an HttpClient at an endpoint that delays 30 seconds and load it; watch in-flight requests and memory.
  2. Add AddResilienceHandler with a 2-second attempt timeout and a circuit breaker; repeat.
  3. Log circuit breaker state changes (OnOpened, OnClosed) and watch them under a simulated outage.
  4. Calculate concurrency with Little's law for your own service at 10× latency.
  5. Write and time your STAR version.

💻 Code

The resilience pipeline added after the incident (Microsoft.Extensions.Http.Resilience, Polly v8 options).

using Microsoft.Extensions.Http.Resilience;
using Polly;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddHttpClient<PaymentClient>(c => c.BaseAddress = new Uri("https://payments.example.com"))
    .AddResilienceHandler("payments", pipeline =>
    {
        // Outer budget for the whole call including retries.
        pipeline.AddTimeout(TimeSpan.FromSeconds(8));

        // Retries only make sense because every charge carries an idempotency key.
        pipeline.AddRetry(new HttpRetryStrategyOptions
        {
            MaxRetryAttempts = 2,
            BackoffType = DelayBackoffType.Exponential,
            UseJitter = true
        });

        // Stop calling a failing provider; fail fast so the rest of the API stays healthy.
        pipeline.AddCircuitBreaker(new HttpCircuitBreakerStrategyOptions
        {
            FailureRatio = 0.2,
            MinimumThroughput = 20,
            SamplingDuration = TimeSpan.FromSeconds(30),
            BreakDuration = TimeSpan.FromSeconds(30)
        });

        // Per-attempt timeout instead of HttpClient's 100 s default.
        pipeline.AddTimeout(TimeSpan.FromSeconds(3));
    });

var app = builder.Build();
app.Run();

public sealed class PaymentClient(HttpClient http)
{
    public async Task<HttpResponseMessage> ChargeAsync(Guid orderId, decimal amount, CancellationToken ct)
    {
        using var request = new HttpRequestMessage(HttpMethod.Post, "/charges")
        {
            Content = JsonContent.Create(new { orderId, amount })
        };
        request.Headers.Add("Idempotency-Key", orderId.ToString()); // safe to retry
        return await http.SendAsync(request, ct);
    }
}
STAR template
S: [Service] called [provider] synchronously; [traffic].
T: [Provider] slowed to [X s]; our [whole API] was failing; I was [on call].
A: Confirmed via [App Insights / status page]; [flag to degrade / queue]; [cut retries]; communicated [how];
   afterwards [timeouts, circuit breaker, idempotent retries, queue].
R: Recovered in [N min]; next outage: [0 failed checkouts], queue drained in [N min].

Illustrative only: payment provider 300 ms -> 30 s; deferred charging behind a flag; 0 failed checkouts next time.

⚠ Common mistakes

  • Mistake: "There was nothing we could do, it was their outage." Why it is wrong: Your design decided how much it hurt. Instead: Talk about what you controlled: timeouts, fallbacks, queues.
  • Mistake: Adding more retries during the incident. Why it is wrong: Every retry is another call to a provider that is already overloaded, and each one keeps your request (and its connection) alive longer, so retries multiply both their load and your in-flight count. Instead: Turn retries down or off and fail fast until the provider recovers.
  • Mistake: Retrying non-idempotent calls. Why it is wrong: Double charges. Instead: Idempotency keys or no retry.
  • Mistake: Leaving HttpClient.Timeout at its default. Why it is wrong: It is still 100 seconds in .NET 10, so a slow provider keeps requests in flight for minutes once retries are counted. Instead: Set per-attempt and total timeouts from your SLO with the resilience handler, and set HttpClient.Timeout above the pipeline's total so they don't fight.
  • Mistake: Leaving users staring at a spinner or a 500. Why it is wrong: They retry, abandon or phone support, which adds load and cost. Instead: Show a clear degraded state ("order received, payment confirmation by email") and a status banner.
  • Mistake: Choosing a degraded mode alone. Why it is wrong: Deferring payment is a business risk. Instead: Agree it with the product owner, ideally before the incident.
  • Mistake: Going quiet. Why it is wrong: Support and customers are blind. Instead: Regular updates with impact estimate and next update time.
  • Mistake: Blaming the vendor in the interview. Why it is wrong: Sounds like deflection. Instead: Neutral facts, then your actions.
  • Mistake: No result. Why it is wrong: No proof the changes worked. Instead: Compare impact in the next outage.

🏛 Senior insight: trade-offs

The senior answer owns the blast radius even when the root cause is someone else's. It shows you understand the cascade, mitigate by failing fast and degrading, and turned the incident into design changes the business agreed to. Proving the change in a later outage is the strongest result you can give.

Use Little's law in production terms. At [400] req/s and [300 ms], about [120] checkout requests are in flight per cluster. At [30 s] that becomes [12,000]: outbound connections, memory per request and any blocking code all scale with it, which is why unrelated endpoints failed. The same arithmetic tells you how to size things in advance: set timeouts so in-flight work stays within what an instance can hold, leave headroom for retries before peak events, and alert on dependency latency, not just errors, so you see the slope before the cliff.

Pattern When it fits Cost When not to
Timeouts + circuit breaker Every remote call Tuning; some false trips Never skip
Async hand-off via queue Work that can complete later (charging, emails) Eventual consistency, compensations Customer needs an answer now (e.g. card auth for fraud checks)
Cached fallback Read data that tolerates staleness (rates, catalogue) Stale answers Money movement, permissions
Second provider Critical dependency, high revenue Integration and contract cost Low-value dependency
Bulkhead Shared instance with many dependencies Rejected calls Single-purpose service

🔗 Follow-ups the interviewer may ask

  1. When: Candidate says they had to work out whether the problem was theirs or the dependency's. Why: Checks how they split latency between own code and dependencies with traces and metrics.
    How to answer

    I split the request into time in my code and time in dependencies. In Application Insights, the end-to-end transaction view and a KQL query comparing request duration with the sum of its dependency durations tell me quickly: if one dependency's p95 jumped at 10 am, it's them; if dependencies are normal but requests are slow, the time is in my process. A gap before a dependency call starts means queueing inside my service: ThreadPool starvation, an exhausted connection pool or a rate limiter. dotnet-counters confirms CPU, GC and queue lengths. For a slow dependency I contain it with per-attempt timeouts, a circuit breaker, a bulkhead and a fallback; for my own code I roll back or scale while I fix it. The trade-off: aggressive timeouts protect you but turn slowness into errors, so they need fallbacks.

  2. When: Candidate says the root cause was the provider's outage. Why: Checks whether they treat a vendor outage as a root cause or look at their own design's contributing factors.
    How to answer

    It is a valid trigger, but not a useful root cause, because nothing in it is ours to change. The next question is why our system failed along with the provider: a single region or zone, no timeout or circuit breaker, no bulkhead isolating the dependency, a hard dependency on the critical path, no degraded mode. Those become the actions: zone redundancy or a paired region where the business case justifies it, timeouts, circuit breakers and fallbacks, caching, an explicit SLO we design to given the provider's published SLA, and alerts on the dependency's health plus Azure Service Health notifications. The postmortem then tracks whether those resilience changes actually reduce impact next time, for example in a game day that simulates the outage.

  3. When: Candidate mentions retries on payment calls or idempotency keys. Why: Checks they understand how retries can double-charge and how to present that kind of incident.
    How to answer

    I structure it so leadership gets the answer in the first minute: a three-sentence summary (what happened, impact, current state), then impact in numbers, a UTC timeline of trigger, impact, detection, mitigation and recovery, the root cause as a system condition, contributing factors, what went well, lessons learned and three to five owned actions, including customer remediation and communication. In the payments example: a release added retries to fix real provider timeouts, but POST /charges creates a new charge on every call unless it carries an idempotency key, which the provider uses to return the first result for a repeat. Ours sent none, so a timeout after the provider had charged the card produced a second charge. Detection took hours because alerts watched errors, not duplicates. Every claim links to evidence. The trade-off: brevity for leadership versus detail for engineers, so I keep the detail in an appendix.

🛠 Real-world problems: how you handle them

Slow payment provider takes down the whole checkout API
Situation
[Checkout API] on [Azure App Service, 6 instances], [~400] req/s at peak; payment calls made synchronously in the request to [the payment provider]. [Friday evening] peak trading. I was [on call].
Signals
API-wide error rate from [0.2%] to [35%]; p95 for all endpoints rising, not just checkout; Application Insights application map showing the provider dependency at [~30 s] average; outbound connection count high; customer complaints on [social media]; the provider's status page showing 'degraded performance'.
Investigation
Ruled out our own release (no deploy that day) and the database (normal). Dependency view showed only the provider's calls slowed; other endpoints failed because instances were saturated with in-flight checkout requests (default 100 s HttpClient timeout plus three retries per call). Confirmed with the provider's status page and a support ticket.
Resolution
Mitigation: turned on a feature flag that accepted the order, published a 'charge pending' message to Service Bus, and sent customers a confirmation email; set the retry count to zero through Azure App Configuration. The API recovered in [~5] minutes; checkout kept taking orders. Once the provider recovered, the worker charged the pending orders; [N] failed payment and went to a customer follow-up flow. Real fix: Microsoft.Extensions.Http.Resilience pipeline (3 s attempt timeout, 8 s total, circuit breaker at 20% failure ratio, two jittered retries with idempotency keys) and charging moved permanently to the queue-based worker.
Prevention
Dependency SLOs and alerts on provider latency and circuit state; a runbook for provider outages with pre-approved degraded modes agreed with [the product owner and finance]; chaos test injecting provider latency in staging every [quarter]; idempotency keys on all payment calls.

How to tell it (STAR)

**S:** At [company] our [checkout API] called [the payment provider] synchronously, and one [Friday evening] their responses slowed from [300 milliseconds] to [30 seconds]. **T:** I was [on call], and because of long timeouts and retries, our whole API was failing, not just payments. **A:** I confirmed from Application Insights and their status page that the provider was the cause, turned on a flag to take orders and charge later through a queue, and cut retries to zero so we stopped piling on. The API recovered in [five] minutes and I kept support updated. Afterwards I added proper timeouts, a circuit breaker and idempotent retries, and moved charging to the queue permanently, which [the product owner] signed off. **R:** When the provider failed again [three months] later, we had [zero] failed checkouts and the backlog cleared in [12] minutes.

More in Production Incidents

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me