Keep Channels Asynchronous
Elixir is a parallel execution machine. Each Channel can leverage the principles of OTP design to execute work in parallel with other Channels since the BEAM executes multiple processes at once. Every message processed by a Channel, whether incoming or outgoing, must go through the Channel process to execute. This can stop working well if we’re not careful about how our Channel is designed. This is easiest to see when we have an example of the problem in front of us.
We’ll leverage our existing
StatsChannel to see the effect of process slowness. Let’s add a new message handler that responds very slowly.