MrDoops

MrDoops

Looking for some feedback on a Text-Processing feature with LiveView and OTP

I’ve been tinkering on a LiveView project to get a feel for these OTP tools like Dynamic Supervisors, Registry, ETS, Et Al., and I’ve ran into a few spots where I could use some feedback. I have a good idea of what could or needs to happen, but I’m having trouble taking the concept into implementation with regards to some areas of OTP.

The feature I have in mind is a text input where a LiveView with a 1:1 Session Process sends TextChanged events to a variety of Text Analysis strategies for different sorts of metrics. (Sentiment, Editing, Difficulty, etc.) Some of these metrics are stateless (current word count), some of them are stateful (word counts over time).

The plan was we Dynamically Supervise an AnalyzerSubscriber that, depending on the kind of metric, collects various results from background jobs (handling AnalysisResultProduced events), puts the result in ETS under our Session ID, and publishes an AnalysisResultPrepared event so our LiveView knows to fetch from a handy read-model.

So there’s likely some sliding window type metric aggregation, maybe some rate-limiting, and different kinds of ETS tables.

You can find the WIP repo/branch here: https://github.com/zblanco/libu/tree/live_chat

A few questions:

  • I want to Dynamically Supervise these Subscriber / Collection processes under the also dynamically supervised Session Process - should I be using a spawn_link, Process.monitor or some different method altogether?
    • The subscriber supervisor and child processes should die with the session, but the session shouldn’t die with the supervisor or its children. I’m thinking monitors since a spawn link will kill the session if the subscriber supervisor dies? Are there some consideration I’m missing here?
  • I’m a little bit in the “don’t know what I don’t know” category with regards to many of these OTP tools. I can tell libraries like Flow, GenStage, and Broadway might fit in here, but I’m not quite sure how. Some of these Text Processing jobs have dependent aspects (e.g. different jobs might depend on a Tokenized Result).
    • The plan was to consume an event like %AnalysisResultProduced{analyzer: :tokenizer, result: ....} to then do some dependent work - is there a way to do this kind of dynamic/dependent processing with Flow? My spidey-sense says I might be re-inventing the wheel.

Any input would be appreciated!

Where Next?

Popular in Chat/Questions Top

xgilarb
Hi there, I’m interested in using Elixir because of the rumors about the reliability of the Phoenix framework, and surprisingly, Elixir’...
New
Lincxx
Hello, I’m sure this has been asked a bunch, but where to start. I do prefer vodeos over books, but recently I have found books to be mor...
New
gouvermxt
I just finished the “Learn Functional Programming with Elixir (Pragprog)” book. I have 5+ years of experience with Ruby/Rails, my goal is...
New
Fl4m3Ph03n1x
Background Hello all! So after my controversial introduction with Learning Elixir, frst impressions ( plz don’t kill me ! ) - I saw a ton...
New
ggwc82
Looking to get started with FP and Elixir coming mainly from an OOP Rails and PHP background. My first question is, whats the best cours...
New
Nvim
Anybody know of a Pragmatic Studio 40% off coupon code for video course like Phoenix?
New
Santheepkumar
Hi all, I am a Fullstack JS developer for last 2 years. I need a good guide to learn elixer. Any suggestions please
New
New
QueenSvetlana
My bookstore has Introducing Elixir: Getting Started In Functional Programming and the front cover says the book uses Elixir 1.4. The cur...
New
Twfo326
As a novice dev I’m trying to keep the curriculum as lean as possible. My requirements are modest: build simple CRUD apps with Phoenix...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3268 119930 1237
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New

We're in Beta

About us Mission Statement