
上QQ阅读APP看书,第一时间看更新
Build for failure
It doesn't matter how many tests we do in our microservice, how many controls are in place, how many alerts could be triggered; if our microservice is going to fail, we need to design for that failure, to handle it as gracefully as possible, and define how we could recover from it.
"Anything that can go wrong will go wrong."
– Murphy
When we approach the initial design of a microservice, we need to start working on the more basic errors that we need to handle. As the design grows, we should think of all the edge scenarios, and finally what could go really wrong. Then, we need to assess how we are going to notify, monitor, and control those situations, how we could recover, and if we have the right information and tools for solving them.
Think of these areas when you design a microservice:
- Upstream
- Downstream
- Logging
- Monitoring
- Alerting
- Recovery
- Fallbacks