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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access