Skip to content

Beanstalkd in a nutshell

nesquena edited this page Apr 23, 2013 · 2 revisions

Adapted from Why you should consider beanstalkd by af83:

Beanstalkd is an asynchronous job queue that supports distributing jobs across a closed network, to prioritize them, and consume them.

Beanstalkd gives the possibility to organize jobs in tubes, each tube corresponding to a job type. Tubes are lazily created. A client can listen to any number Beanstalkd's tubes.

A producer can put jobs in a tube, let's say a json representation, for example. put accepts various options like ttr, pri or delay. And pri allows you to define a numerical priority on a job (0 is highest).

A consumer can reserve a job: if no job is available, Beanstalkd will wait until a job becomes available. The client has a limited amount of time to process this job. When the ttr (time to run) times out, Beanstalkd will push back the job in queue. A consumer can touch to push back a TTR.

When a job is successfully processed, a consumer can delete the job from the tube. In the case of failure, the consumer can bury the job. This job will not be pushed back to the tube, but will be available for further inspection.

A consumer can release a job, Beanstalkd will push this job back in the tube, and make it available for another client. release is commonly used with the delay option. This option tells Beanstalkd to push back this job in the tube, but with a delay.

Clone this wiki locally