Erlang: From Processes to Production
The actor model, let it crash, and OTP - the language built to keep running while things go wrong.
Erlang was written at Ericsson in the late 1980s to solve one problem: build a telephone exchange that does not stop. Not one that rarely fails - one that keeps answering calls while parts of it are failing, while the hardware is being replaced, and while the software is being upgraded underneath it. The AXD301 switch built on it was reported at nine nines of availability, which is about thirty milliseconds of downtime a year. That number is disputed in its details and the engineering behind it is not.
Overview
This course is four phases. The first is sequential Erlang: the BEAM virtual machine, the data types, pattern matching, and recursion in place of loops, because the functional foundation has to be solid before concurrency makes any sense. The second is the actor model - spawning processes, message passing, links and monitors, ETS, and the bit syntax that makes parsing a network packet a single pattern match. The third is **OTP**, the framework that turns those primitives into production systems: `gen_server`, supervision trees, `gen_statem`, applications and releases. The fourth is running it for real: distributed nodes, Mnesia, hot code upgrades, live tracing of a running cluster, and the BEAM internals that explain why it behaves as it does. Every lesson is free to read in full.
Introduction
You should have written programs in some language and be comfortable with the idea of a function. Prior functional programming is useful and not required; prior concurrency experience is useful and may actively mislead you, because Erlang's processes have almost nothing in common with operating system threads.
Install **Erlang/OTP 26 or newer** - `brew install erlang`, `apt install erlang`, or the official builds from Erlang Solutions - and **rebar3**, the build tool. An editor with **Erlang LS** attached is worth the setup; VS Code's Erlang extension installs it for you.
One thing to expect. Erlang's error messages are blunt and its documentation is terse and precise rather than welcoming. Both get much easier once you can read a stack trace and a `badmatch`, which the first phase covers deliberately.
What you will be able to do
- Work in the Erlang shell, and compile and load modules without leaving it
- Read and write pattern matches, and use them for assignment, destructuring and routing
- Replace loops with recursion, and say which of your functions are tail recursive and why it matters
- Use tuples, lists, maps, records and binaries, and pick the right one
- Spawn processes, pass messages, and carry state in a tail-recursive loop
- Link and monitor processes, and say precisely how the two differ
- Apply let-it-crash deliberately rather than writing defensive code
- Store and query millions of terms in ETS, and parse a binary protocol with the bit syntax
- Write a gen_server with the four callbacks, and know which of call, cast and info each message takes
- Design a supervision tree, and choose a restart strategy for a reason you can state
- Model a protocol as a gen_statem, and package the result as an OTP application
- Run a distributed cluster, and reason about what a network partition does to it
- Trace a live system without stopping it, and find a binary leak
- Explain BEAM schedulers, reductions and per-process garbage collection, and when a NIF is worth the risk
What each level covers
4 levels · 12 lessons
-
Phase 1 - Functional Foundations and Sequential Erlang
The BEAM, the data types, pattern matching and recursion - sequential Erlang, before a single process is spawned.
3 lessons 13 min of reading
Start with Erlang and the BEAM Virtual Machine → -
Phase 2 - Concurrency, Actors and Error Handling
Processes, message passing, links and monitors, let it crash, and the storage and binary parsing that production systems lean on.
3 lessons 14 min of reading
Start with Processes, Messages and the Actor Model → -
Phase 3 - OTP, the Open Telecom Platform
The framework that turns processes and links into production systems: generic servers, supervision trees, state machines, applications and releases.
3 lessons 15 min of reading
Start with OTP Behaviours and gen_server → -
Phase 4 - Distribution, Production and the BEAM
Clustering nodes, Mnesia, upgrading and tracing a system that is running, and the virtual machine internals that explain its behaviour.
3 lessons 16 min of reading
Start with Distributed Erlang and Mnesia →
Guides and articles
Longer reading about this subject, written alongside the course.
-
Let it crash is not "ignore errors". It is the opposite
The most misunderstood idea in Erlang sounds like an excuse for sloppiness. It is a claim about where error recovery belongs, and it comes with more infrastructure behind it than defensive programming ever had.
· 9 min read
Before you start
- Erlang/OTP 26 or newer
- rebar3
- A terminal
- A text editor, ideally with Erlang LS
- Experience programming in some language
Common questions
- What does the Erlang: From Processes to Production course cover?
- It is 4 levels and 12 lessons: Phase 1 - Functional Foundations and Sequential Erlang; Phase 2 - Concurrency, Actors and Error Handling; Phase 3 - OTP, the Open Telecom Platform; Phase 4 - Distribution, Production and the BEAM. Each level ends with a quiz, and the last one is an exam over the whole course.
- How long does it take?
- About 58 minutes of reading and exercises - roughly 1 hours. It is self-paced with no cohort and no start date, so you can leave and come back and the site remembers where you were.
- What do I need to know first?
- Erlang/OTP 26 or newer. rebar3. A terminal. A text editor, ideally with Erlang LS. Experience programming in some language.
- Is it free?
- Yes. Every lesson, example and quiz in this course is free to read, and you do not need an account to read them. Signing in only adds progress tracking and quiz results.
- What will I be able to do afterwards?
- Work in the Erlang shell, and compile and load modules without leaving it. Read and write pattern matches, and use them for assignment, destructuring and routing. Replace loops with recursion, and say which of your functions are tail recursive and why it matters. Use tuples, lists, maps, records and binaries, and pick the right one. Spawn processes, pass messages, and carry state in a tail-recursive loop. Link and monitor processes, and say precisely how the two differ. Apply let-it-crash deliberately rather than writing defensive code. Store and query millions of terms in ETS, and parse a binary protocol with the bit syntax. Write a gen_server with the four callbacks, and know which of call, cast and info each message takes. Design a supervision tree, and choose a restart strategy for a reason you can state. Model a protocol as a gen_statem, and package the result as an OTP application. Run a distributed cluster, and reason about what a network partition does to it. Trace a live system without stopping it, and find a binary leak. Explain BEAM schedulers, reductions and per-process garbage collection, and when a NIF is worth the risk.