poolboy icon indicating copy to clipboard operation
poolboy copied to clipboard

Remote Workers and Worker-Supervisor

Open matyasmarkovics opened this issue 4 years ago • 0 comments

Remote Workers

I needed to create a pool of processes similar to the rpc module implementation in Erlang/OTP. - rpc (or rex) is a single process, I needed a pool of them. - This led me to extend poolboy, so that (local) workers could be started by a supervisor on a remote node.

For this to work these are the necessary steps:

  1. Find the Pid of the Worker-Supervisor, even if remote, see find_pid/1
  2. Start the workers via their Supervisor, even if Supervisor is remote, see new_worker/2
  3. Monitor Worker-Supervisors, that were passed in and stop if they go DOWN
  4. Monitor Remote node if Worker-Supervisor is remote and stop on nodedown
  5. Stop Worker-Supervisor using gen_server:stop/1, so that it works remotely too. See: stop_supervisor/2

matyasmarkovics avatar Aug 18 '20 07:08 matyasmarkovics