Quantcast
Channel: PHPDeveloper.org
Viewing all articles
Browse latest Browse all 9

Lorna Mitchell: Beanstalk, Pheanstalk and Priorities

$
0
0

Lorna Mitchell has a quick post showing you how to use the "priority" option that the Pheanstalk library provides when working with a Beanstalk queue.

I've got an application that uses Beanstalkd to queue up messages, and some PHP worker scripts that grab messages from the queue and process them. Messages get added by the web application, but can also be added by cron - and when I add a bunch of messages via cron, I don't want to swamp what the web application is doing! Those cron-added jobs are mostly pretty low priority, generating reports, sending weekly update emails, that kind of thing. Beanstalkd has a concept of priority, so I can create lower priority jobs.

She includes a three line example showing the use of the "LOW_PRIORITY" constant to tell Beanstalk how and when it should handle this particular job. In her situation, where there are multiple smaller jobs rather than larger ones it makes more sense to shift some of the smaller, less important tasks to be executed later.

Link: http://www.lornajane.net/posts/2014/beanstalk-pheanstalk-and-priorities

Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images