So far in our Elixir/OTP course we’ve been looking primarily at short-lived processes.
But it’s now time to turn our attention to long-running server processes that manage internal state and do asynchronous work.
So what kind of server process will we need? Well, we’re going to run a pledge drive in hopes of building a crocodile swamp on our wildlife refuge. 🐊 And we’ll need to cache recent pledges and run computations.
To do this, we’ll build up from a basic receive loop to a client API that sends synchronous and asynchronous requests to a registered server process.
Along the way, we’ll see how a server process preserves the integrity of its state while under load from multiple concurrent client processes.
By writing a server process from scratch, we’ll begin to demystify the “magic” of a GenServer.
If you already own the course, you’ll find this week’s new 4-part module in your account today: #24 Stateful Server Processes.
P.S. Many thanks to Scott Thompson, Clinton De Young, and Nathan Herald for taking the time to review early drafts of our OTP and GenServer sections. Your insights and suggestions based on hard-won experience with Elixir/OTP were instrumental in the design of this course. We sincerely appreciate your feedback!