layout | title |
---|---|
base |
About |
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.
{% for post in site.posts limit:1 %}
[{{ post.title }}]({{ post.url }})
{% endfor %}
First, run beanstalkd
on one or more machines. There is no configuration
file and only a handful of command-line options.
{% highlight bash %} $ ./beanstalkd -l 10.0.1.5 -p 11300 {% endhighlight %}
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.
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:
{% highlight ruby %} beanstalk = Beanstalk::Pool.new(['10.0.1.5:11300']) beanstalk.put('hello') {% endhighlight %}
Then start another process to take jobs out of the queue and run them:
{% highlight ruby %} beanstalk = Beanstalk::Pool.new(['10.0.1.5:11300']) loop do job = beanstalk.reserve puts job.body # prints "hello" job.delete end {% endhighlight %}
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.
Please report any bugs to the mailing list.
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!