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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.