The Generic Server

One of the most important abstractions for both the Elixir and Erlang ecosystems is called OTP, and the heart of OTP is the generic server. It’s an abstraction that you’ll use to wrap up critical features as application services, represent state using processes, and use built-in supervision to make those features reliable. As you saw in Elixir vs. Mutable Objects, Elixir leans heavily on processes to make the notions of state, behavior, and time explicit. In this section, we’ll focus on OTP, a critical abstraction providing common services many processes need, such as supervision.

In the following sections, we want to shine a light on GenServer and discuss cases of use and misuse, relaying some stories from the field and ...

Get Adopting Elixir now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.