skip to Main Content

Beanstalk Job/Queue Daemon

Beanstalk is a simple, fast work queue.

Its interface is generic, but was originally designed for reducing the latency of page views in high-volume web applications by running time-consuming tasks asynchronously.


How I have used it:

I have used beanstalkd in several implementations. It shines as a job/queue manager, where you can add jobs with priorities.

Consider this use case: You have an email manager that is running out of Beanstalk. Imagine you are in the process of dispatching a newsletter to 40,000 users in a tailored manner (meaning – not all the emails being sent out are the same). If a user comes to your site and requests a password reset, you do not want them to wait an hour for the newsletter to finish dispatching.

What you can do, is set the priority of the newsletter to something low, like say – 50. The password reset is more of a hot item, as you want that user to execute their request quickly without aborting completely and going to another site, or calling your help desk for example. By assigning a priority of 1 or 5 to that job – as soon as Beanstalk has a free node (sent off a newsletter email, going to check for next task), it will grab the priority 1 item, and take care of it. Once that is done, it will go back to what it was working on (sending the newsletter). Easy!

Back To Top