Chapter 17OTP: Supervisors
I’ve said it a few times now: the Elixir way says not to worry much about code that crashes; instead, make sure the overall application keeps running.
This might sound contradictory, but really it is not.
Think of a typical application. If an unhandled error causes an exception to be raised, the application stops. Nothing else gets done until it is restarted. If it’s a server handling multiple requests, they all might be lost.
The issue here is that one error takes the whole application down.
But imagine that instead your application consists of hundreds or thousands of processes, each handling just a small part of a request. If one of those crashes, everything else carries on. You might lose the work it’s doing, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access