编程与软件工程ferd.ca
Erlang 之禅
The Zen of Erlang
2016 — 2020,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这篇文章讲解 Erlang 的整体设计哲学:先理解它作为一个系统在做什么,以及为什么采用“let it crash”、进程隔离与监督等机制来构建容错系统,而不是靠到处做防御式编程。作者试图把 Erlang 的“禅”讲清楚,包括错误如何被看待、系统如何组织与恢复。
为什么经久不衰:它把 Erlang/Elixir 生态的核心错误处理哲学讲透,多年后仍是理解容错与分布式系统设计的有力入口。
HN 评论精选
必须先理解 Erlang 的整体设计;理解之后,它在目标领域极其出色,本文讲清了整体与动机。
我认为关于 Erlang(作为整个系统)重要的一点是,你必须先真正理解它做什么。它不是那种你随便上手玩玩、然后也许事情就“差不多能用”的平台。不过一旦你理解了它做什么,它在那一方面就极其出色。这篇文章很好地解释了 Erlang 作为一个整体在做什么,以及为什么这样做。
jcizzle查看英文原文
I think the important thing about Erlang (the system as a whole) is that you really have to understand what it does first. It's not one of those platforms you just jump into and start toying around and then maybe things work 'good enough.' Once you do understand what it does, though, it is exceptionally good at that. This post does a great job of explaining what Erlang, as a whole, does and why it does it.
认可 let it crash,但指出还需要反馈控制、背压和监控工具,否则实际运维会很困难。
较轻量的“let it crash”就是一种断路器。这在 JVM 世界很常见,因为 JVM 启动时间真的很糟,甚至重启线程池也可能很昂贵。我理解整个 let-it-crash 理念,但我确实希望有更多关于反馈控制和背压处理的工具,比如应该分配多少线程、允许多少失败或超时等。连监控都很痛苦,告警太多。我不知道 Erlang 是否提供这类库,但这是个难题。
agentgt查看英文原文
The lighter let-it-crash is a circuit breaker. This is done quite frequently in the JVM world because .. well the JVM has a really shitty startup time.. even restarting threadpools can be expensive. I get the whole let-it-crash but I really would like more tools on feedback control and backpressure handling (ie whats the right amount threads to allocate and how many failures/timeouts should you allow etc...). Even monitoring is a pain (ie too many alarms). I don't know if erlang provides libraries for this but its a hard problem (see https://github.com/Netflix/Hystrix/issues/131).
质疑监督粒度:存储系统崩溃不应导致整个节点重启,Web 服务器应存活并向用户报告问题。
这里有一个细节中的魔鬼问题,你也许可以考虑加进这篇出色的文章:你的系统里有一个 Web 服务器,还有一个存储系统。当错误向上传播、存储系统挂掉时会发生什么?这会迫使整个节点重启吗?Web 服务器难道不应该保持运行,以便告知用户存在严重问题,而不是直接消失吗?实现这一点的最佳方式是什么?
davidw查看英文原文
Here's a devil-in-the-details question that you might consider adding to your excellent article: You have a web server in there, and also a storage system. What happens when the errors propagate up and the storage system dies? Does it force the entire node to reboot? Shouldn't the web server stay up to keep users informed that there is a serious problem, rather than simply going away? What's the best way to accomplish that?
询问 Erlang 是否适合科学计算与数据管道,认为 let it crash 可能有用,但数值计算生态尚不成熟。
有人知道 Erlang 被用于科学计算吗?文章中概述的理念和“let it crash”方案很酷,让我想到它对在科学场景中构建稳健的数据管道会很有用。例如在天文学中,望远镜输出原始数据,管道处理数据生成更易检查的中间产品。通常这些是脆弱的 C/C++ 程序,有大量状态和分支逻辑,而且因为功能对设施运行至关重要,极难重构。Erlang 似乎对这样需要保持运行不崩溃的控制和管道系统很有用,但对我来说很难判断它是否适合数值/科学计算任务。有人知道有用的库或资源吗?我确实找到一个不错的 lsci 包,旨在调用类似 numpy/matplotlib 的 Python 模块,但可惜还处于初期阶段。
autocorr查看英文原文
Does anyone know of erlang being used for scientfic computing? The ideas and "let it crash" scheme outlined in the article are really cool, and it made me think how it would actually be very useful for making robust data pipelines in scientific contexts. For example, in astronomy you would have a telescope spitting out raw data, and a pipeline processing the data to create more inspectable intermediate products. Typically these are brittle C/C++ programs, with lots of state and branching logic, and further they become extremely hard to refactor because their function is so integral to running the facility. Erlang seems like it would be very useful for a control and pipeline system like this that needs to stay alive and not crash, but it's hard to tell (for me) if it's well suited to numeric/scientific computing tasks. Do people know of libraries or resources that would be useful for that? I did find this neat lsci[1] package that aims to call python modules like numpy/matplotlib (which would be perfect) but is sadly in a nascent state. [1] https://github.com/lfex/lsci
历次讨论
同类还值得读
开源应用架构
The Architecture of Open Source Applications
《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。
编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选编程语言简史:简短、不完整且多半错误
A Brief, Incomplete, and Mostly Wrong History of Programming Languages
一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。
编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.comSQLite 是如何测试的
How SQLite is tested
SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…
编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选高级编程语言(2009)
Advanced programming languages (2009)
Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…
编程与软件工程上首页 8 次 · 2009–2022matt.might.net我的 Forth 与栈机器经历
Yosefk - My history with Forth & stack machines
作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。
编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选