AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Programming architectural diagram4/12/2024 ![]() This is why Streams Supervisor is “dynamic” - we start its children as we discover that we need them.Įach Stream Supervisor is in charge of making sure one stream of data is processed. Stream Info Fetcher tells Streams Supervisor to start one Stream Supervisor for each stream we need to process. StreamsRootSupervisor starts one Stream Info Fetcher, which makes a network request and gets back a list of the streams. We don’t know exactly what those streams are when the application boots. There are multiple incoming streams of data that need to be processed. │ Stream Fetcher │ │ Stream Processor │ │ Stream Fetcher │ │ Stream Processor │ ![]() ▼ GenStage Pipeline ▼ ▼ GenStage Pipeline ▼ │Stream Supervisor │ │Stream Supervisor │ │ Stream Info Fetcher │ │ Streams Supervisor │ Here’s part of a supervision tree from an application I’ve been looking at, built by ┌────────────────────────┐ I think this kind of high-level discussion would be very educational, without getting into all the details of the code.Ĭrickets, eh? Alright, I’ll post one. Why did you choose the restart strategies you did?.Why did you choose to put A and B under different supervisors?.Why did you choose multiple processes of type X but only one of type Y?.Which processes talk to each other and how do they find each other?.Maybe start with :observer.start(), then make an ASCII graph (eg with Monodraw or ASCIIFlow) and edit for clarity and/or discretion. My request to you all: If you have a production OTP app and don’t mind, please share a diagram like this one of your application (or some interesting part of it) and explain the architecture choices in general terms. (I would explain here if doesn’t mind, but don’t think it would be polite otherwise. tells why we spawn a fixed number of Todo.DatabaseWorker but a dynamic number of Todo.Server, why we use one_for_one on Todo.SystemSupervisor but rest_for_one on Todo.Supervisor, etc. This diagram and the description of the app were very illuminating for me. │Todo.DatabaseWorker ├─┐ │ Todo.Server ├┐ │ (one_for_one) │ │ (DynamicSupervisor) │ │ │ │ Todo.PoolSupervisor │ │ Todo.ServerSupervisor │ │ Todo.Cache │ │Todo.ProcessRegistry │ │ Todo.SystemSupervisor │ ![]() Part of the book works through building up an OTP app, and shows a diagram, which I’ve recreated here in ASCII using Monodraw: ┌────────────────────┐ I’ve been reading Elixir in Action to get a better grasp of OTP.
0 Comments
Read More
Leave a Reply. |