DEV Community

Cover image for Gen servers - Abstracting state management and task run together

Gen servers - Abstracting state management and task run together

Cherry Ramatis on October 15, 2023

In Elixir, every function runs inside a separate process, and we can deal with processes in a very natural way offered by the language. It's possib...
Collapse
 
danielhe4rt profile image
Daniel Reis •

Never heard about Genservers before... I'll take a better look soon, but thanks for the posting anyways!

Collapse
 
phenriquesousa profile image
Pedro Henrique •

Thanks for sharing, cousin <3

Collapse
 
layeddie profile image
Eddie Lay •

Really good explanation on how Genservers work

Collapse
 
cherryramatis profile image
Cherry Ramatis •

Thanks a lot ❤️

Collapse
 
marcelomagal profile image
oChefDev •

In your article, you've talked about GenServer making it easier to manage state and run tasks in Elixir. Can you provide an example where using GenServer made a task simpler or solved a problem more efficiently compared to using just Agent or Task?

Collapse
 
cherryramatis profile image
Cherry Ramatis •

Gen server is the glued version of Agent (managing state) and Task (handling async) with the possibility of managing messages through processes. The phoenix framework is a great example of using gen server abstraction for the whole http layer

Collapse
 
marcelomagal profile image
oChefDev •

Obrigado Cherry

Collapse
 
robertheory profile image
Roberto Costa •

Nice post!!!

Collapse
 
orionth1 profile image
Matheus Emanoel •

Awesome

Collapse
 
nikolai1312 profile image
Nicolas Evangelista •

Great content, thanks for sharing!

Collapse
 
canhassi profile image
Canhassi •

Nice article!