Hey folks, beginning to post today’s round of ElixirConf videos!
ElixirConf US 2018 – Elixir at a Walking Pace – Lance Halvorsen (@lance)
Many of us are initially attracted to Elixir because of its performance and fault tolerance. Make no mistake, these are stellar, but there are times when they are not the most critical requirements for our applications.
We’re going to take a look at a warehouse management system, originally written as part of a Rails monolith, for which data consistency and message ordering matter more.
That original system was deployed with Puma, forking multiple OS level processes on multiple nodes to gain parallel execution. That greatly increased the potential for multiple representations of an item in the system at any given moment. The result was an increase in stale data errors and inconsistent state.
As we rebuilt the system in Elixir, we turned these problems inside out. Stateful BEAM processes and their mailboxes allowed us to ensure that there would only be a single representation of each item in the system as well as order the messages each process receives. Throughout this talk, we’ll see how we accomplished this. We’ll also see how we handled some issues associated with this approach, like the cold start problem and keeping memory usage in check.