php-resque icon indicating copy to clipboard operation
php-resque copied to clipboard

Blocking configuration option

Open francislavoie opened this issue 8 years ago • 4 comments

What are the pros and cons of using the blocking option in the config.yml? It's not documented anywhere and I couldn't figure out what the main functionality differences are. I'm currently using it with blocking turned on, but I was wondering what the difference might be.

francislavoie avatar Feb 17 '17 01:02 francislavoie

If blocking is enabled it uses the redis BLPOP command https://redis.io/commands/blpop (instead of LPOP)

mjphaynes avatar Feb 17 '17 12:02 mjphaynes

Yeah I understand that much, but what are the behavior differences in using each?

francislavoie avatar Feb 17 '17 13:02 francislavoie

Alright - it did some more in depth reading, it looks like BLPOP is more efficient to immediately grab jobs as they come in because redis will return one as soon as its available, whereas LPOP will sleep and only get a job at the end of the interval when it loops again.

What I'm trying to get at with my question though, is why would someone choose to use non-blocking over blocking? To me there doesn't seem to be any benefits to that behaviour. Essentially I'm asking why it's even an option if blocking seems to just be straight-up better for a queue system?

francislavoie avatar Feb 19 '17 21:02 francislavoie

Last week I found some interesting articles regarding Redis performance tuning where blocking vs non-blocking mode is explained in detail... I'll post the references here on monday.

xelan avatar Jan 19 '18 12:01 xelan