arq icon indicating copy to clipboard operation
arq copied to clipboard

Use pubsub and blocking for improved response times

Open m-kuhn opened this issue 1 year ago • 6 comments

arq currently uses a polling mode (default 0.5 seconds) to fetch jobs on worker side and also to fetch results. I think it should be possible to use blocking requests (on worker side) and pubsub (possibly with keyspace notifications, but not necessarily) for fetching the result.

This should be quite reliable in most scenarios, however it can occur that a job gets lost (there is no guarantee for pubsub delivery after all), so one could still poll from time to time to be on the safe side.

Are there any opinions on development in this direction?

From https://github.com/samuelcolvin/arq/pull/374#issuecomment-1570580555

m-kuhn avatar May 31 '23 17:05 m-kuhn

CC @arturzx

m-kuhn avatar Jun 17 '23 10:06 m-kuhn

See also how rq recently implemented this: https://github.com/rq/rq/pull/1939

gg718 avatar Jun 27 '23 22:06 gg718

A draft PR welcome.😊

JonasKs avatar Jun 29 '23 05:06 JonasKs

My plan is to move to redis streams which are by far the best solution for tasks like those performed by arq. Stay tuned for a big update.

samuelcolvin avatar Mar 13 '24 12:03 samuelcolvin

See #437.

samuelcolvin avatar Mar 17 '24 19:03 samuelcolvin

I agree that redis stream is the best option right now. Can't wait for the arq update, I developed a redis stream based library, aka brq. If you're in a hurry, you may try it now.

Wh1isper avatar May 19 '24 14:05 Wh1isper