News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lorna Mitchell:
Beanstalk, Pheanstalk and Priorities
May 08, 2014 @ 09:47:08

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.

0 comments voice your opinion now!
beanstalk pheanstalk priority tutorial example

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

blog comments powered by Disqus

Similar Posts

SitePoint PHP Blog: Using Google Translate API with PHP

PHP-Coding-Practices.com: Introduction To Security Vulnerabilities In PHP

PHPit.net: Taking a first look at the AutoCRUD for PHP library

Zend Developer Zone: Flex and PHP: Party in the Front, Business in the Back

Zend Developer Zone: Generating and Validating Web Forms With PEAR HTML_QuickForm


Community Events





Don't see your event here?
Let us know!


list api interview release opinion conference series community framework composer introduction unittest language symfony podcast configure threedevsandamaybe voicesoftheelephpant version laravel

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework