Chapter 12
OTP

You’ve now had your first Phoenix Channels experience and should be developing a good intuition for the strength of Phoenix for highly interactive applications. You’ve also lightly sampled OTP concepts including applications and supervision trees. You have everything you need to create beautiful code and then run it reliably at breakneck speeds.

Phoenix isn’t just about user interfaces, though. You also have the experience and elegance of Erlang’s OTP framework. In general, OTP is a way to think about fault-tolerance, concurrency, and distribution. It uses a few patterns that allow you to use concurrency to build state without language features that rely on mutability. OTP also has rich abstractions for supervision and monitoring. In this chapter, we’ll use OTP to build an information system.

Rather than read a wave of dry prose that tells you what OTP does, you’ll start with the basics by building a simple service. We’ll build a counter that runs in a separate process. Then, we’ll supervise it, restarting on failure. You’ll see how you can hold state in an immutable world.

On its own, that knowledge will help you understand Phoenix, which is itself an OTP application. We’ll use these principles to build an information service under our umbrella project, which we will develop, manage, and test in isolation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.152.136