Hot Code-Swapping

You may have heard that OTP applications can update their code while they are running. It’s true. In fact, any Elixir program can do it. It’s just that OTP provides a release-management framework that handles it.

However, OTP release management is complex. Something with the potential to deal with dependencies between thousands of processes on hundreds of machines with tens of thousands of modules will, by its nature, be bigger than a breadbox.

However, I can show you the basics.

First, the real deal is not swapping code, but rather swapping state. In an application where everything runs as separate processes, swapping code simply means starting a process with the new code and then sending messages to it.

However, server ...

Get Programming 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.