OTP

OTP is the part of Erlang that a production system is built from: a server that keeps state, a supervisor that restarts it, and an application that starts the tree at boot. Elixir writes all three with modules of its own.

The chapter also covers the places a process is looked up (a registry), the children started at run time, and the table that lives outside a process. It ends with the cost of putting all the work in one server.

10.1 GenServer init, handle_call and handle_cast, and the state the server keeps Open 10.2 Supervisors the child spec, the restart strategy, and the tree that survives a crash Open 10.3 OTP applications application/0 in mix.exs, the tree started at boot, and the application that really starts Open 10.4 Registry a name for a process, the unique and duplicate kinds, and dispatch Open 10.5 DynamicSupervisor a child started at run time, and the count that stays bounded Open 10.6 ETS a table outside the process, insert and lookup, and the owner that must stay alive Open 10.7 Restart strategies in practice one_for_one, one_for_all and rest_for_one, and permanent, transient and temporary Open 10.8 A GenServer is one process the call that serialises the work, and the place to put the work instead Open

Lessons