如何为故障而设计
ByteByteGo 文章主张软件无法做到零故障,应预先设计故障行为,并概述故障范围、影响与恢复度量等策略。
中文处理结果
构建一个不会出故障的软件系统是不可能的。当然,一个系统可以在整个生命周期中不出现任何故障。但你无法保证它永远不会失败。
你可能会想,如果我们写出完美的代码,就能消除故障。但编写正确的应用代码只是问题的一部分。即使是完美编写的软件,也依赖于物理计算机、电力供应、正常工作的存储等等。如果机器断电,无论软件多好,它都会失败。
因此,你必须为故障而设计。这意味着提前决定当系统的某些部分无法正常工作时,系统应当如何表现。在本文中,我们将探讨各种能帮助开发者应对系统故障的策略。以下是我们要涵盖的内容:
- 为什么要采用“假设一切都会坏掉”的心态
- 避免故障 vs 容忍故障
- 如何确定故障的范围
- 如何降低故障的影响
- 如何在系统正确运行时处理故障
- 如何衡量故障恢复
为什么要假设一切都会坏掉
阅读更多
原始正文摘录
How to Design for Failures
It is impossible to build a failure-proof software system. Sure, a system can go through its lifecycle without any failures. But you can’t provide a guarantee that it will never fail.
You might think that if we write perfect code, we can get rid of failures. But writing correct application code is just one part of the problem. Even perfectly written software depends on a physical computer, power availability, working storage, and so on. If the machine loses power, the software will fail no matter how good it is.
Therefore, you have to design for failure. This means deciding in advance how a system should behave when some of its parts are not working correctly. In this article, we’ll look at the various strategies that can help developers deal with failures in their systems. Here’s what we will cover:
- Why adopt an “assume everything breaks” mindset
- Avoiding faults vs tolerating faults
- How to figure out the scope of a failure
- How to reduce the impact of a failure
- How to handle failures while running the system correctly
- How to measure recovery from failures
Why Assume That Everything Can Break
Read more