Video in progress
What is a cascading failure, and how does it start?
It's when a problem in one service spreads to the services that call it, and from them to the next ones, until the whole system stops. It often starts with missing timeouts, unlimited retries and shared resources.
📖 Answer
A typical scenario:
the DB slowed down
-> inventory-service responses stretched to 10 s
-> order-service threads got stuck waiting for inventory
-> the gateway ran out of connections waiting for order
-> the whole site returns 502
The root problem was small: a single slow query. But every service along the way "passed it on".
What stops it from spreading:
- short timeouts: the wait is bounded;
- circuit breaker: stops sending load to the problem service;
- bulkhead: one dependency can't take all the threads;
- careful retries: 3 attempts at each of 3 layers means 27 times the load;
- asynchronous communication: non-critical work goes through a broker, without waiting.
If you tie this to the question "why do you need timeouts?" in an interview, it leaves a good impression.
Sign up to mark studied questions and save your progress.