[erlang-questions] Process swarm vs Queues
Fri Jul 21 13:58:08 CEST 2017
> Your problem seems very under-defined. In particular, we don't know
> the overhead of processing an event, or what you're trying to optimize
> (latency? throughput? robustness?). The processes that want to monitor
> resources, is that the external API to your system or an implementation
> detail within your system?
It is not (yet) about optimizing but rather about how to chose a
design around state and concurrency.
My example is simple and anyone here can implement all the possible
but it is not obvious to me why a specific solution is the best.
> Anyway, since you mention reading and writing state to disk around each
> handled event, minimizing latency cannot be critical. Therefore I
> see the need for anything complicated here: just spawn a temporary
> for each event as it occurs. If you need serialization, add a
> If state is precious, have a supervisor own it.
> Don't overengineer unless you have proof that the simple solution
At the moment, I have event handlers processes register properties on
be notified about the resources they monitor. I can directly send the
via the pub/sub feature of gproc.
To use a queue or spawn a process, I would need an ETS table registering
handler ID with the ressource, to be able to spawn a handler with the
So I'll follow your advice and keep it simple, finish the work, and see
RAM is a problem.
Thank you :)
More information about the erlang-questions