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
  5. Binaries and Bitstrings
  6. Lists and Tuples
  7. Maps
  8. Keyword Lists
  9. Pattern Matching
  10. case, cond and if
  11. Anonymous Functions
  12. Modules and Named Functions
  13. Guards
  14. Recursion
  15. The Pipe Operator
  16. Enum
  17. Comprehensions
  18. Streams
  19. Erlang Data Structures
  20. Structs
  21. Typespecs and Types
  22. Protocols and Behaviours
  23. with
  24. Errors and Exceptions
  25. Sigils
  26. From Source to BEAM
  27. Mix Projects
  28. Testing with ExUnit
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. Backpressure
  8. Supervisors
  9. :gen_statem
  10. Job Queue
  11. Registry
  12. ETS
  13. Atomics, Counters and persistent_term
  14. Caching
  15. Rate Limiting
  16. Circuit Breaker
  17. The Process Dictionary
  18. Ports and NIFs
  19. Applications and Configuration
  20. Testing Processes
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. Ecto Basics
  2. Transactions and Constraints
  3. The Outbox Pattern
  4. Sagas