Supervised pool of remote processes and process state keeping
Wed Sep 9 19:40:18 CEST 2009
How a supervised pool of remote processes should be designed with OTP ?
I was thinking about having a simple-one-for-one supervisor starting local
processes. These processes would then spawn_link a remote one.
Is there a better way ?
Another thing I don't have clear, is who is responsible to keep state
to be able to restart jobs lost when the supervisor restart a process ?
For example, I have a job scheduler, a worker pool and workers. With OTP
principles, I would have a main supervisor that starts the scheduler
and the pool (simple-one-for-one supervisor) the pool then starts the workers
(gen_server). The scheduler send job requests to the pool, and then the pool
distribute the requests amongst its workers.
The problems comes when one of the worker need to be restarted.
What append of the pending jobs of this worker ?
Is it the supervisor (worker pool) task to keep track of each job
requests given to each worker and redistribute them if a worker is restarted ?
What the OTP way of handling this kind of state information ?
Is it OK for the worker pool to be a supervisor ?
It doesn't feel quite good that a gen_server is sending job request to
More information about the erlang-questions