Skip to content
tezvyn:
Menu

Client-side chaos for an uncontrollable third party?

Source: interviewHardHow cards are made

Summary

Testing resilience you cannot reach directly.

Key points

Inject faults at your client boundary via a proxy or fault-injecting wrapper, simulate timeouts, errors, and latency, then verify timeouts, retries, breakers, and fallbacks.

What's really being asked

Whether you realize resilience to a black-box dependency is tested at your own boundary, not theirs, and can design that client-side experiment concretely.

The full answer

The key reframe: you cannot break the third party, but you can simulate their failures at the point where your code calls them. Insert fault injection at the client boundary, a wrapper around the client library, a sidecar or service-mesh rule, or an interception proxy that sits between you and the provider. Reproduce the provider's realistic failure modes: connection errors and 5xx, request timeouts and elevated latency, rate-limit and throttling responses, partial or malformed payloads, and intermittent failures. The steady-state hypothesis asserts graceful degradation, that when the provider misbehaves your service still meets its SLIs via timeouts, bounded retries with backoff and jitter, a circuit breaker that fails fast, idempotent operations, and a fallback such as a cached value, queued retry, or degraded experience. Monitor your own error rate, latency, thread and connection pool saturation, retry counts, and breaker state, and confirm retries do not stampede the provider or breach its rate limits. Use a small blast radius, a traffic slice or canary, and an automated abort. For safety, target the provider's sandbox or test endpoints where possible.

The mistakes people make

Concluding the dependency is untestable because you do not own it. Only testing a hard down and ignoring latency, throttling, and malformed responses. Forgetting that aggressive retries can violate the provider's rate limits. Lacking any fallback, so the breaker just converts slowness to errors with no graceful path.

What usually comes next

How do you simulate throttling versus timeout. Where exactly do you inject, library, sidecar, or proxy. How do you avoid hitting the provider's real rate limits during the test. What fallback fits a payment gateway.

A concrete example

For a payment gateway you put a fault-injecting proxy in front of the client and, for 2 percent of checkout sessions, return 503s and 5 second latencies. The hypothesis is that these sessions degrade to a queued-authorization fallback while staying above the checkout SLO. Monitoring shows your connection pool nearing saturation and retries climbing, revealing that the timeout is too long and retries are unbounded, concrete fixes that harden you against a real gateway outage you could never trigger directly.

Interview question

You depend on a third-party payment gateway whose infrastructure you cannot touch. How can you still chaos-test your resilience to its failures?

  • a.You cannot; resilience to external services is untestable
  • b.Inject faults at your client boundary via a proxy or wrapper, simulating the provider's errors, timeouts, and throttlingCorrect
  • c.Wait for a real outage and observe what happens
  • d.Send extreme load directly at the provider's production API to see if it breaks
Why?

You simulate the dependency's failure modes at your own boundary using a proxy, sidecar, or client wrapper, then verify your timeouts, retries, breakers, and fallbacks. Attacking their production API is abusive, and waiting for a real outage is not a controlled experiment.

Just read this? Test yourself on what you have been reading.

Read the original → docs.aws.amazon.com

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles