Erlang/Elixir OTP Patterns

Hey folks, I’ve been using Elixir for over a couple of years (phx, ecto, broadway, oban).

For this kind of work you do not tend, in my experience, to actually use OTP directly, i.e. write GenServer’s.

The libraries use them and you use the libraries.

You could program web apps in Elixir without needing to really know a great deal about processes/OTP.

Now I want to start learning OTP in depth, I’ve read a few Elixir books (Elixir in Action etc) in the past and just started reading an Erlang book. So I know the basics, what processes are, how to build something like a GenServer by hand, but not how to structure a topology for different use cases,

Are there any books or resources you would recommend which have common erlang/elixir patterns in terms of how to structure processes for different use cases?

It can be Elixir or Erlang, or indeed any BEAM language.

Cheers.

I’ve do not really have resources for like blueprints - even though there’s for sure ones like the manager and dynamic workers example of elixir in action.

However I think the usecases define the guarantees you need around isolation and startup/restart/shutdown ordering and usually those translate quite well to supervision trees.

This talk goes especially into the startup side of guarantees (mostly the second half), which often also neatly translate into the shutdown side.

I’d also study the supervision setup of e.g. cowboy(ranch) / bandit(thousand islands) / phoenix channels if you want some real world applications.

2 Likes

Elixir Patterns

The essential BEAM handbook for the busy developer is a good one!