Demand-Driven Processing

We have already seen how Elixir is especially suited to spawning million of processes. This capability lets the developer easily run simultaneous execution flows, only capped by the number of available processors on the machine.

Nevertheless, all this power may not be sufficient if a huge amount of data continuously flows to your application. If you don't process it fast enough, the message boxes of your processes will start to pile up and eventually use all your memory, bringing your application to a halt.

In this chapter we'll analyze how Elixir tackles this problem by controlling the rate at which data is processed with the recently introduced GenStage behaviour. Later on, we'll apply this behaviour to the ElixirDrip ...

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