Elixir by Example

Elixir by Example

A hands-on tour of Elixir, OTP and distributed systems through small, annotated programs, from your first IO.puts to supervised, concurrent services.

01

Core Elixir

The language itself: data, pattern matching, functions, modules and protocols.

  1. Hello World
  2. Values
  3. Atoms
  4. Strings and Binaries
  5. Lists and Tuples
  6. Maps
  7. Keyword Lists
  8. Pattern Matching
  9. case, cond and if
  10. Anonymous Functions
  11. Modules and Named Functions
  12. Guards
  13. Recursion
  14. The Pipe Operator
  15. Enum
  16. Comprehensions
  17. Streams
  18. Structs
  19. Protocols
  20. with
  21. Errors and Tagged Tuples
  22. Sigils
  23. From Source to BEAM
02

Processes and OTP

Concurrency the BEAM way: lightweight processes, messages, and supervision.

  1. Processes
  2. Sending and Receiving Messages
  3. Links and Monitors
  4. Task
  5. Agent
  6. GenServer
  7. :gen_statem
  8. Backpressure
  9. Supervisors
  10. Job Queue
  11. Registry
  12. ETS
  13. Caching
  14. Rate Limiting
  15. Circuit Breaker
  16. The Process Dictionary
  17. Ports and NIFs
03

Distributed Elixir

Many machines, one system: connected nodes, cluster-wide names and process groups.

  1. Nodes and Distribution
  2. Global Names with :global
  3. Process Groups with :pg
  4. Partitions and Split Brain
  5. Leases and Fencing Tokens
  6. Sharding
  7. Idempotency and Retries
  8. How Nodes Connect
04

Deployment

From your laptop to servers: releases, runtime configuration, containers and clusters.

  1. Releases
  2. Runtime Configuration
  3. Containers
  4. Rolling Deploys
05

Production

Running it: look inside a live node, find what is slow or leaking, read crash dumps, and change code without a restart.

  1. Hot Code Loading
  2. Tracing
  3. Memory: Copies and Binaries
  4. Mailboxes and Slow Consumers
  5. Load Shedding
  6. Schedulers and Reductions
  7. Profiling
  8. Crash Dumps
  9. Letting Agents Debug Production
06

Reliability

Keeping data right when steps fail: transactions, the outbox pattern and sagas, and a store that protects itself under load.

  1. Transactions and Constraints
  2. The Outbox Pattern
  3. Sagas