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.
News
Run It
First, run beanstalkd on one or more machines. There is no configuration
file and only a handful of command-line options.
$ ./beanstalkd -l 10.0.1.5 -p 11300
This starts up beanstalkd listening on address 10.0.1.5, port 11300.
For more information on how to run beanstalkd as a background service,
in production, see the adm directory.
Use It
Here’s an example in Ruby – see the client libraries to find your
favorite language.
First, have one process put a job into the queue:
Then start another process to take jobs out of the queue and run them:
beanstalk=Beanstalk::Pool.new([‘10.0.1.5:11300’])loopdojob=beanstalk.reserveputsjob.body# prints “hello”job.deleteend
History
Philotic, Inc. developed beanstalk to improve the response time for the
Causes on Facebook application (with over 9.5 million users). Beanstalk
decreased the average response time for the most common pages to a tiny
fraction of the original, significantly improving the user experience.
Many thanks to memcached for providing inspiration for simple
protocol design and for the structure of the documentation. Not to mention a
fantastic piece of software!
Comments
Post a Comment