bobbypriambodo

bobbypriambodo

I’m trying to understand more about Elixir OTP concepts, particularly the ones mentioned in the title. The tutorials gave examples with KV buckets, but I think I need more realistic examples.

Can anyone give examples on how you use them in your apps/libraries? (I’m particularly interested in their usage on a Phoenix app, but if you do use it on Elixir app it’s okay too.)

Showing Posts 1 to 2

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

First, a nit pick. There are only Elixir apps. Some Elixir apps use phoenix, some do not, but there are only Elixir apps.

Let’s start with the simplest case, tasks. We have an async job worker system, and every job is run inside a task. This makes it easy for the worker process to monitor what happens to the job. It also makes for less work for the garbage collector because any memory the job uses can be all easily reclaimed when the process quits.

GenServers: These get used for a variety of things. I have a slack bot process that aggregates some info and periodically shoves it in slack. I have processes that represent sensors out in warehouses monitoring temperature, and these genservers give us notifications if they haven’t heard from a sensor in X amount of time (amongst other things).

Agent: Basically just a simplified genserver. Never used one.

GenEvent: Used it a long time ago, but there were pain points. Technically I still use it cause I have a customer Logger backend and IIRC it uses GenEvent.

Not mentioned: :gen_statem I used recently in some sensor management software. Each connected sensor gets its own state machine process that ensures it walks through the right states / transitions as it gets configured / upgraded / etc.

bobbypriambodo

bobbypriambodo OP

True! I wonder why I wrote that, especially when I just reread this “Phoenix is not your application” thread. Sorry about that :sweat_smile: I meant when you are mainly using Phoenix for your app.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews