🎓 A1Learner
🔍
0 of 46 lessons completed

Home / Elixir

Elixir

Expert Elixir: Registry and dynamic supervisors, strategies and shutdown, distribution, advanced macros, behaviours and protocols, BEAM internals, resilience, state at scale, testing, and four projects. Every example is verified with the real interpreter.

Intermediate Elixir teaches you to supervise workers and share tables. Advanced Elixir teaches you to run systems: registries that name thousands of processes, supervisors that shut down in the right order, nodes that call each other, macros that check your code before it runs, and resilience patterns that keep a service answering when parts of it fail.

Start learning ❯❯46 lessons · 10 topics · 0/46 completed

Course contents

Work top to bottom — the sidebar is the course. Topics later in the list assume the ones before them.

Elixir Advanced Introduction

Advanced · ⏱ 2 min · standalone lesson

Advanced OTP

Start: Elixir Registry ❯

Distributed Elixir

Start: Elixir Node Basics ❯

Advanced Metaprogramming

Start: Elixir Advanced Macros ❯

Behaviours & Protocols in Depth

Start: Elixir Behaviours in Depth ❯

BEAM Internals

Start: Elixir Process Info ❯

Resilience Patterns

Start: Elixir Circuit Breakers ❯

State at Scale

Start: Elixir Persistent Term ❯

Testing at Scale

Start: Elixir Property-Style Tests ❯

Projects

Start: Elixir Project: Distributed KV ❯

From supervised workers to whole systems

A single supervisor restarting a crashed worker is only the start. Real Elixir systems name their processes through a registry, grow and shrink pools with a dynamic supervisor, choose a restart strategy that matches how their workers depend on each other, and shut down in reverse order so nothing is left half-finished. This course opens with exactly that machinery: Registry lookups, dynamic children, the three strategies compared side by side, child specs written by hand, application environment for configuration, and shutdown semantics including trap_exit, brutal_kill and the stopped-but-listed transient child.

Distribution comes next, taught honestly. On one machine there is no cluster, so the course proves what a single node can prove: what Node.self returns when nothing is distributed, why a connect attempt is ignored, how a remote call runs against your own node, how a global name is claimed and released, and how supervised tasks fan work out. The prose says plainly where a real cluster takes over, and never pretends a script proved something it did not.

Then the course turns inward. Advanced macros walk abstract syntax trees, hook into compilation, print readable expansions for debugging, reject bad configuration at compile time, and build hygienic domain languages. Behaviour chapters add optional callbacks and a hand-built event behaviour, while protocol chapters cover consolidation — why a protocol answers false to the consolidated question inside a script — and deriving implementations for your own types.

What you will learn

The nine groups below are the course in miniature: each line names a skill the lessons prove with runnable scripts, from naming processes to shipping a scheduler.

Forty-six lessons across nine groups, each example run twice against the real interpreter:

  • Registry naming, dynamic supervisors, supervision strategies, child specs, application environment and shutdown order
  • Nodes, connections, remote calls, global names and supervised distributed tasks
  • Advanced macros, AST walking, before-compile hooks, macro debugging, compile-time validation and hygienic DSLs
  • Deep behaviours, optional callbacks, protocol consolidation, deriving protocols and a custom event behaviour
  • BEAM internals: process info, binary memory, message queue costs, counter-based profiling and garbage collection
  • Resilience: half-open circuit breakers, token bucket rate limiting, bulkheads, retry backoff and timeout patterns
  • State at scale: persistent terms, ETS continuations, table ownership, atomics and gen_statem machines
  • Testing at scale: hand-rolled property-style checks, supervised tests, shared helpers and tag filtering
  • Four projects: a sharded distributed key-value store, a presence tracker, a rate-limited API and a job scheduler

Measured, not timed

BEAM performance lessons in this course never ask you to trust a stopwatch. Timings change between runs and machines, so every measurement here is a count: queue lengths after a known number of sends, counter increments after a known number of events, binary sizes after a known transformation. That discipline is the point. A profiling method that gives a different answer every run is not a method, and the counters chapter shows the alternative working on real code.

The same honesty runs through the resilience chapters. A circuit breaker is a state machine with a half-open probe, not a slogan. A rate limiter is a bucket with a countable number of tokens, not a wall-clock window. A retry policy is a list of computed delays you can read, not a sleep you hope is long enough. Each lesson states its numbers, and each stated number was produced by running the code.

The course closes with four projects that combine the earlier groups: a distributed key-value store sharded by hash with named shards, a presence system tracking joins and leaves, an API guarded by a count-based limiter, and a scheduler with supervised jobs. None of them need anything beyond the standard library, and every one of them runs as plain scripts.

Frequently asked questions

Do I need the intermediate Elixir course before this one?

This course expects the intermediate material as background: GenServer callbacks, supervisor basics, ETS, macros, protocols and ExUnit are used from lesson one without re-explanation. If those are unfamiliar, work through the beginner and intermediate courses first, then return.

What is a Registry in Elixir?

A Registry is a process that maps names to process identifiers, so other parts of a system can find a worker by name instead of holding its pid. This course covers Registry lookups, duplicate versus unique keys, and using a registry to name the shards of a distributed store.

Can I run distributed Elixir examples on one machine?

Partly. A single node can prove local mechanics: its own name, remote calls against itself, global name claims and supervised tasks. True multi-node behaviour needs started nodes, and the distribution chapters say exactly where that boundary lies instead of claiming a script proved more than it did.

What is a circuit breaker with a half-open state?

A circuit breaker stops calling a failing dependency after enough failures, instead of piling on. In the half-open state it lets one probe call through: success closes the breaker again, failure reopens it. The resilience chapters build this as a state machine with countable transitions.

Can I follow along without installing Elixir?

Yes for reading: each snippet prints its real result beneath it. To execute the scripts yourself you need Elixir 1.19 on Erlang/OTP 27; save a snippet as a .exs file and run it with the elixir command.

How long does the Elixir advanced course take?

About 166 minutes across 46 lessons, from advanced OTP and distribution through metaprogramming, BEAM internals and resilience patterns to four projects.

Does the advanced course cost anything?

No. Every lesson in this course, projects included, is free to read on A1Learner.

Next steps

  • Scala ❯ — Take advanced functional ideas to the JVM with 45 advanced lessons on the type system, concurrency and real projects.
  • Haskell ❯ — Go deeper into pure functional programming with 47 advanced lessons on monads, performance and large programs.