Erlang 的容错能力如何,或者在这方面有何帮助?

发布于 2024-09-24 04:22:11 字数 33 浏览 6 评论 0原文

Erlang 的容错能力如何,或者在这方面有何帮助?

How is Erlang fault tolerant, or help in that regard?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

别再吹冷风 2024-10-01 04:22:12

Erlang 具有容错能力,考虑到以下几点:

  • Erlang 知道错误会发生,事情也会崩溃,因此 Erlang 不是防范错误,而是让您拥有强大的工具来最大程度地减少错误的影响并在错误发生时从中恢复。 。

  • Erlang 鼓励您针对成功案例进行编程,如果出现问题则崩溃,而不尝试恢复部分损坏的数据。这背后的想法是,部分不正确的数据可能会在您的系统中进一步传播,并可能被写入数据库,从而给您的系统带来风险。最好尽早摆脱它,只保留完全正确的数据。

  • Erlang 中的进程隔离有助于最大限度地减少部分错误数据出现并导致进程崩溃时的影响。系统会清理崩溃的代码及其内存,但整体上仍能正常工作。

  • 通过重新启动系统的重要部分并将其重新投入使用,监督和重新启动策略有助于在系统部分崩溃时保持系统正常运行。如果出现严重错误,导致重新启动次数过多,则系统将被视为无法修复,因此将被关闭。

Erlang is fault tolerant with the following things in mind:

  • Erlang knows that errors WILL happen, and things will break, so instead of guarding against errors, Erlang lets you have strong tools to minimize impact of errors and recover from them as they happen.

  • Erlang encourages you to program for success case, and crash if anything goes wrong without trying to recover partially broken data. The idea behind this is that partially incorrect data may propagate further in your system and may get written to database, and thus presents risk to your system. Better to get rid of it early and only keep fully correct data.

  • Process isolation in Erlang helps with minimizing impact of partially wrong data when it appears and then leads to process crash. System cleans up the crashed code and its memory but keeps working as a whole.

  • Supervision and restart strategies help keep your system fully functional if parts of it crashed by restarting vital parts of your system and bringing them back into service. If something goes very wrong such that restarts happen too much, the system is considered broken beyond repair and thus is shut down.

浅暮の光 2024-10-01 04:22:12

警告:我是一个 Erlang 菜鸟。

@Daniel 的回答基本上是正确的。我强烈建议您花时间阅读 Erlang 创建者 Joe Armstrong 的 论文(让可靠的存在软件错误的分布式系统)。本文很好地解释了开发健壮的分布式系统的必要性和解决方案。我相信这篇论文会令人满意地回答你的问题。

Caveat: I am an Erlang noob.

@Daniel's answer is essentially correct. I strongly suggest that you take the time to read Erlang creator Joe Armstrong's thesis (Making reliable distributed systems in the presence of software errors). The thesis provides a good explanation of the need for, and the solution to, developing robust distributed systems. I believe the paper will answer your question satisfactorily.

柠檬心 2024-10-01 04:22:12

Erlang 可以轻松创建许多小型进程并监控这些进程。当其中一个进程崩溃时,可以重新启动系统的该部分,而无需关闭整个系统。

您可能在现代版本的 Windows 中看到过类似的情况:系统可以在崩溃时重新启动显卡驱动程序;它不会杀死整个系统。

为了更容易地编写容错应用程序,Erlang 提供了管理进程的概念。这些进程监视许多子进程,并且知道如果子进程死亡如何响应。您可以创建一个完整的监督树,以便您可以很好地控制应用程序不同部分的行为。您可以Erlang 文档阅读更多内容。

Erlang makes it easy to create many, small processes, and to monitor those processes. When one of those processes crashes, it may be possible to restart that part of the system without needing to bring the whole thing down.

You may have seen something like this in modern versions of Windows: the system can restart the graphics driver if it crashes; it doesn't kill the whole system.

To make it easier to write fault-tolerant applications, Erlang provides the concept of supervisor processes. These processes monitor a number of child processes, and know how to respond if a child dies. You might create a whole supervision tree, so that you have fine control about how different parts of the application behave. You can read more in the Erlang documentation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文