Is it possible to have the worker run in a separate process or is this a non-goal? #97
-
River works great but if I try enqueue a job that has a worker running in a separate process (and thus using a different River client) I get a:
I dug into the code a little and indeed it checks for workers that were registered on that same client:
I would like to run some workers in a separate process because some of the jobs require a lot of memory and these processes are more likely to get OOM killed (or potentially have CPU starvation). I don't want these jobs to disrupt the response time or reliability of the main process which serves HTTP requests. Is this something that will be supported in the future or a non-goal for the project at the moment? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @LasseJacobs, the workers can indeed run in a different process and in general they should. However you do need to have the same workers defined on both the enqueueing side and the worker side if you want to be able to enqueue and work jobs. The I hope that makes sense! We’ll think about what we can do to improve the docs in this regard. |
Beta Was this translation helpful? Give feedback.
Hi @LasseJacobs, the workers can indeed run in a different process and in general they should. However you do need to have the same workers defined on both the enqueueing side and the worker side if you want to be able to enqueue and work jobs. The
Workers
config is used to map yourWorker
definition to itsKind()
based on the correspondingJobArgs
definition. When enqueueing, this value is encoded into the database and used on the downstreamClient
to know whatWorker
code to run for that particular job.I hope that makes sense! We’ll think about what we can do to improve the docs in this regard.