jlouis
jlouisramblings.blogspot.com · Personal blog · on HN since 2009
Jesper Louis Andersen writes about Erlang internals, including scheduling, concurrency versus parallelism, crash handling, and comparisons with Haskell.
What HN saysHN commenters call it a very nice blog and cite it to explain Erlang's concurrency model, process crashes, and error handling in servers.
54HN people shared it
29linked it in comments
29stories submitted
957story points
12 months agolast shared
2009people per year2026
Most-shared posts
- 1How Erlang does scheduling (2013)10 people · 128 points · first shared 2013 · 22 comments on HN
- 2On Erlang, State and Crashes6 people · 11 points · first shared 2010 · 1 comments on HN
- 3A response to "Erlang - overhyped or underestimated"3 people · 138 points · first shared 2010 · 63 comments on HN
- 4How Erlang does scheduling3 people · 130 points · first shared 2013 · 22 comments on HN
- 5Erlang programmer’s view on Curiosity Rover software2 people · 197 points · first shared 2012 · 78 comments on HN
- 6Haskell vs. Erlang for bittorent clients2 people · 74 points · first shared 2010 · 4 comments on HN
- 7Erlang's parallelism is not parallelism2 people · 39 points · first shared 2011 · 13 comments on HN
- 8Problematic traits in Erlang2 people · 7 points · first shared 2013 · 2 comments on HN
- 9Differences between Node.js and Erlang2 people · 2 points · first shared 2010 · discussion on HN
- 10One major difference - ZeroMQ and Erlang.2 people · 2 points · first shared 2011 · discussion on HN
- 11Embrace copying2 people · first shared 2014
- 12How erlang does scheduling2 people · first shared 2013
- 13Haskell vs. Erlang for bittorent clients1 people · 142 points · first shared 2014 · 26 comments on HN
- 14One major difference - ZeroMQ and Erlang.1 people · 54 points · first shared 2012 · 19 comments on HN
- 15Musings on Dart1 people · 6 points · first shared 2011 · discussion on HN
What HN people wrote when they linked it
rdtsc · 2014-01-04
Jesper has a very nice blog, well worth a read:
http://jlouisramblings.blogspot.ca/
dragosmocrii · 2019-01-05
To best of my knowledge, Erlang was not built for parallelism, but concurrency. When the language was created, multicore CPU where not yet available. The following article can explain better the point.
http://jlouisramblings.blogspot.com/2011/07/erlangs-parallelism-is-not…
oinksoft · 2015-06-01
You can certainly port slow Erlang code to C, but it's not as straightforward as doing so in, say, Python or Ruby. For one, if your C code crashes, it's not the calling Erlang process that crashes, but the entire VM [1]. Second, NIF implementations are supposed to cooperate with the BEAM scheduler and only run for 1ms at a time. jlouis points out that most NIFs fail at this [2]. Third (and maybe the expectation here is too great), binary data (structs, etc.) used/provided by NIFs are "magic binaries" which cannot be pattern matched and are represented in crashes, the REPL, etc. as "<<>>" which can be confusing [3].
[1] http://www.erlang.org/doc/man/erl_nif.html (see "Warning")
[2] http://jlouisramblings.blogspot.com/2013/07/problematic-traits-in-erla…
[3] http://erlang.org/pipermail/erlang-patches/2011-April/002046.html
davidw · 2014-05-21
Ok, right, but that means that something is catching that crash and returning a 500, and not just crashing the entire web server. I'd like to see more people delve into that aspect of Erlang architecture.
It's covered some here:
http://jlouisramblings.blogspot.it/2010/11/on-erlang-state-and-crashes… (by the same author, jlouis!) and here:
http://learnyousomeerlang.com/building-applications-with-otp
with the term "error kernel", but not a lot of space is dedicated to practical examples, compared to the amount of writing dedicated to how great it is to let things crash.
ericmoritz · 2013-01-04
"OTP in Action" is an excellent book for learning OTP.
The following reading will take you a long way with Erlang:
Learn you some Erlang
http://learnyousomeerlang.com/
OTP In Action
http://www.amazon.com/Erlang-OTP-Action-Martin-Logan/dp/1933988789
On Erlang, State and Crashes http://jlouisramblings.blogspot.com/2010/11/on-erlang-state-and-crashe…
"Making reliable distributed systems in the presence of software errors" http://www.erlang.org/download/armstrong_thesis_2003.pdf
The last two links are "Erlang propaganda" describing the hows and whys of Erlang.
seiji · 2015-08-04
Never say "shared state" and "threading" in the same sentence.
If anything, all languages need to move to an Erlang shared-nothing model. But, Erlang was doing all this back in the 80s, so people have to re-invent it worse in the 2010s to feel special. You can't just go around using things other people made (OPC—other people's code) that just work, you have to make it your own and start your own conferences and books and webinars and vine instaslacks.
Erlang is also preemptive (bumping reductions) so your "long running computation spinning on a thread" problem goes away too. Though, we can't say "goes away"—sounds too much like Go—how about it "erlangs away" the problem?
Decent write up on erlang scheduling at http://jlouisramblings.blogspot.com/2013/01/how-erlang-does-scheduling…
Also see decent writeup about shared-nothing at http://jlouisramblings.blogspot.com/2013/10/embrace-copying.html?view=…
Erlang also has per-process (green thread) heap/GC (i.e. no 'stop the world' required), full load balancing over your CPUs, unbelievably useful pattern matching, atoms/symbols, full serialization of all native data types, built with network distribution in mind from the ground up, plus a syntax that doesn't look like somebody woke up from the 70s in 2010 and decided to write a new language just like their old favorite language. Any knocks against Erlang syntax is because it stands on the shoulders of giants, not because somebody made it in 2010 and…
aeden · 2013-07-02
There was a really good post earlier this year about how Erlang does scheduling (http://jlouisramblings.blogspot.fr/2013/01/how-erlang-does-scheduling.… I think one of the important takeaways is this: "[Erlang] values low latency over raw throughput, which is not common in programming language runtimes". It's worth a quick read.
Ultimately I find that Erlang's strength is not one thing or another, it's a combination of all of its traits: from the functional nature, to OTP for providing a consistent application structure, to its VM; all of these things put together make it interesting and useful.
I've yet to get into Haskell (I will eventually) but I really do find that constructing applications in a functional manner, with state being stored in independent processes within the running application, is a superior way to build systems.
One final note: I really like Go as well, for very specific reasons. Go's resource usage (both in terms of CPU consumption and RAM) is soooo nice, especially coming from Ruby. I was never a C programmer but I can wrap my head around Go and use it to build low resource usage apps with specific purposes, and sometimes this is exactly what is required.
skydhash · 2025-11-21
I’m still waiting for an article like this one:
https://jlouisramblings.blogspot.com/2013/04/acme-as-editor_20.html
It’s clear, informative, and even without reproducing it, you can still form an opinion about the tool.
All the AI pushers’s comments are either very vague or experiments whose sole quality is that it has been done with LLMs (often badly).
ramchip · 2025-04-12
> For example, if a process has taken an item off a queue and then crashes before having fully processed it, how is that accounted for?
I'm not sure I understand the question - all queue systems I've used separate delivery and acknowledgement, so if a process crashes during processing the messages will be redelivered once it restarts.
Do you have a concrete example of a flow you're curious about?
Maybe these could help:
- https://ferd.ca/the-zen-of-erlang.html
- https://jlouisramblings.blogspot.com/2010/11/on-erlang-state-and-crash…
qohen · 2019-06-13
Unfortunately I don't know enough to know what's special about the Erlang scheduler (if anything)
Bon appetit: :-)
Appetizer (blog post):
http://jlouisramblings.blogspot.com/2013/01/how-erlang-does-scheduling…
Entree (book chapter):
https://blog.stenmans.org/theBeamBook/#CH-Scheduling
losvedir · 2018-10-14
I really like this description[0]. It's broadly about designing programs, and handling robustness and state, so I imagine it would apply to other languages, although it does mention some erlang specific things.
[0] http://jlouisramblings.blogspot.com/2010/11/on-erlang-state-and-crashe…
dnautics · 2018-06-19
http://jlouisramblings.blogspot.com/2013/01/how-erlang-does-scheduling…
sorry, i should have said "reductions" not "instructions", and proc, not function. I'm an Erlang noob.
digitalzombie · 2017-07-12
> Java is basically a superset of Erlang at this point
Both VM are completely different beast.
Erlang is one of the few language that does Preemptive scheduling.
https://jlouisramblings.blogspot.com/2013/01/how-erlang-does-schedulin…
It was built from the ground up to do concurrency in an arguably superior way than Java. Java can't do this.
edit:
Wow Erlang have a really active community from the notable people that are commenting here.
bjfish · 2016-04-26
Another interesting read is how BEAM (the Elixir/Erlang VM) does scheduling: http://jlouisramblings.blogspot.co.uk/2013/01/how-erlang-does-scheduli…
wcummings · 2015-04-20
The Elixir runtime (BEAM) is mature (20+ years old) and soft-realtime [1]
[1] http://jlouisramblings.blogspot.com/2013/01/how-erlang-does-scheduling…
felixgallo · 2014-09-03
Not quite. BEAM implements a cooperative multitasking environment using reductions that are checked at function calls. In practice you will rarely write code that runs forever without calling a function or returning, but it's possible, especially if you use NIFs.
This will generally cause scheduler collapse and result in all sorts of weird problems, so in the most recent version of the BEAM, there's 'dirty scheduler' support so that you can work around that problem if you have native code that runs for a long time (> 1 ms).
A good primer on all of this is http://jlouisramblings.blogspot.com/2013/01/how-erlang-does-scheduling…
saraid216 · 2014-06-25
So, while that was... odd, there were some links buried in there that I found to be interesting reading:
http://carlos-trigoso.com/2014/03/07/out-of-the-labyrinth-of-metaphysi… (Or the Abstractitude of the Hewitt Actor Model.)
http://jlouisramblings.blogspot.se/2012/10/ramblings-on-thesis-of-bjar… (Or a summary of the original problems Erlang was trying to address.)
waffle_ss · 2014-06-22
> But as far as I'm aware the memory for a message in Erlang is shared between threads - it's only local variables that use private memory
No, the messages are truly copied: http://jlouisramblings.blogspot.dk/2013/10/embrace-copying.html
edit: the exception being large binaries apparently
janl · 2013-04-09
tl;dr: keeping sockets open only uses very little memory and no CPU when idle.
dr: http://jlouisramblings.blogspot.co.uk/2013/01/how-erlang-does-scheduli… ff.
puzza007 · 2013-03-28
Here's a good description of how Erlang does scheduling
http://jlouisramblings.blogspot.com/2013/01/how-erlang-does-scheduling…
seanmcdirmid · 2013-03-28
Not at all. Erlang isn't useful for modern parallel computing as we know it, which is usually done as some kind of SIMD program; say MapReduce or GPGPU using something like CUDA. The benefit doesn't just come from operating on data all at once, but these systems (or the programmer) also do a lot of work to optimize the I/O and cache characteristics of the computation.
Actor architectures are only useful for task parallelism which no one really knows how to get much out of; definitely not the close-to-linear performance benefits we can get from data parallelism. Task parallelism is much better for when you have to do multiple things at once (more efficient concurrency), not for when you want to make a sequential task faster.
Maybe this will help
http://jlouisramblings.blogspot.com/2011/07/erlangs-parallelism-is-not…
and
https://news.ycombinator.com/item?id=2726661
deno · 2012-08-12
> STM is nice for its "magic", but message creates very well defined, documented interfaces between code.
The author’s previous post has a good overview of how message passing contributes to that as well.
http://jlouisramblings.blogspot.com/2012/06/protocols-in-kingdom-of-di…
jlouis · 2012-04-23
Yep, see my Combinatorrent and eTorrent projects, respectively. The long story short is here:
http://jlouisramblings.blogspot.com/2010/04/haskell-vs-erlang-for-bitt…
willvarfar · 2011-10-03
But Ted, do you not understand that people use node.js because its a familiar language and a (relatively) fast runtime?
Nobody has been using for computing fib though. Nobody has been putting in things that burn non-trivial amounts of CPU though.
Its all about this: http://jlouisramblings.blogspot.com/2011/10/one-major-difference-zerom…
signa11 · 2010-12-25
a rebuttal already: http://jlouisramblings.blogspot.com/2010/12/response-to-erlang-overhyp…
rabbitmq · 2010-11-15
Rabbit.js implements the ZeroMQ patterns in node.js.
Some other things that might help understanding here:
http://www.rabbitmq.com/blog/2010/09/22/broker-vs-brokerless/
http://www.rabbitmq.com/blog/2010/10/18/rabbitmq0mq-bridge/
The second article is written by one of the main authors of ZeroMQ, and includes info that may indicate that, as he says: "RabbitMQ and 0MQ are focusing on different aspects of messaging".
On being "faster", do note that almost all modern messaging software is more fast enough for web apps which rarely require more than a few 1,000 messages per second.
I'm sorry you don't like things that are written in Erlang. But there are some quite good reasons for using it, e.g. http://jlouisramblings.blogspot.com/2010/11/on-erlang-state-and-crashe…
noss · 2009-06-03
This made me think about this post:
http://jlouisramblings.blogspot.com/2009/04/premise-as-soon-as-movieep…
But there are probably other applications where there is an obvious customer demand, but no one seemingly interested in collecting money or operate the business the way customer demand is.
ad_hominem · 2015-01-15
Erlang processes are nothing at all like Unix processes. They are much, much smaller memory-wise as well as in terms of spawning/killing speed as they do not rely on system calls but rather the Erlang VM (which is highly tuned for these purposes).
Yes, there is a small overhead incurred when copying data between processes because the VM is truly copying the data[1], but the benefit gained is that you get per-process heap isolation (references can't cross process heap boundaries). This is important because in languages like Java or Go, one misbehaving bit of code that is causing a lot of GC to happen can "stop-the-world", and make your entire system pause (and it does happen[2]). This is not acceptable when writing soft real-time code, like say an auction system.
I'm not sure why you think an Erlang program is more heavyweight than Go. Is it due to Go programs being compiled to binary? Erlang can do that as well,[3] although it's not often done as Erlang requires a runtime, and it's often simpler to use a separate runtime. But you should know that Go also requires its own runtime to run Go programs[4], it's just that it is statically linked into your compiled code (which is what makes the resulting binaries so huge). But Erlang could do the same thing, it's just not really an industry practice.
[1]: http://jlouisramblings.blogspot.dk/2013/10/embrace-copying.html
[2]: https://groups.google.com/d/topic/golang-nuts/S9goEGuoMRM/discussion
[3]:…
hannesw · 2011-06-14
I think the opinions expressed in this article are valid.
However, I don't think the inability of current JavaScript to do async I/O without callbacks is Node's biggest problem. As others have said, it works for smaller projects (and even has some geek appeal). And as Havoc Pennington and Dave Herman have explained, generators (which are coming with ECMAScript Harmony) and promises will eventually provide a very nice solution. So Node has a path to grow out of the callback model without giving up its single threaded paradigm.
http://blog.ometer.com/2010/11/28/a-sequential-actor-like-api-for-serv…
http://blog.mozilla.com/dherman/2011/03/11/who-says-javascript-io-has-…
The bigger problem (which I don't see getting solved anywhere down the road) is the lack of preemptive scheduling, which is available in Erlang or on the JVM. What you see under high load with Node is that latency is spread almost linearly over a very wide spectrum, from very fast to very slow, whereas response times on a preemptively scheduled platform are much more uniform.
http://jlouisramblings.blogspot.com/2010/12/differences-between-nodejs…
And no, this is something that can't be solved by distributing load over multiple CPU cores. This is problem really manifests itself within each core, and it is a direct consequence of Node's single threaded execution model. If anybody knows how to solve this without resorting to some kind of preemptive threading I'd…