Build Your Optional Server
One of the trickiest parts of learning a concurrency-based language like Elixir is understanding when to use processes at all. Here’s a little guidance. Consider processes when these use cases show up:
-
Sharing state across processes
-
Presenting a uniform API for external services such as databases or communications
-
Managing side effects such as logging or file I/O
-
Monitoring system-wide resources or performance metrics
-
Isolating critical services from failure
This short list is not exhaustive, but it should give you a sense for the types of things that should prompt you to think about a boundary. In short, our boundary is an optional layer of impure integration code that make the core fast, robust, and reliable.
For ...
Get Designing Elixir Systems With OTP 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.