Beanstalkd

      Beanstalk
      Original author(s) Philotic, Inc
      Stable release 1.8 / November 3, 2012; 7 months ago (2012-11-03)
      Written in C
      Operating system Linux, Windows, Mac OSX
      Available in English
      License MIT License
      Website kr.github.com/beanstalkd

      Beanstalk is a simple, fast work queue. Many web applications have some slow tasks that could be done in the background like sending emails, processing statistics, creating files, etc.[citation needed] One rule of thumb is that if a request takes more than a few seconds to process, it would be advisable for the developer to turn it into a background process, so that a response can be returned to the web browser without waiting for the longer process to finish. That's where beanstalkd comes in.

      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.

      There are a number of open source alternatives, including JBoss Messaging, JORAM, Apache ActiveMQ, Sun Open Message Queue, Apache Qpid, RabbitMQ, Redis, and ZeroMQ.

      History

      Philotic, Inc. developed beanstalk to improve the response time for one of their projects, a Facebook app called Causes, which had over 9.5 million users. Using beanstalk helped them decrease the average response time for the most common pages to a tiny fraction of the original, thus significantly improving the user experience.[citation needed]

      ↑Jump back a section

      Basics

      Beanstalk'd is a simple text-based protocol. One application (a producer) adds messages or jobs to a queue, that can then be run with worker processes (or consumers). The producers and consumers can be on the same machine, or on different machines. The queue can be persistent by saving to a file, and most of its clients support connections to multiple beanstalkd servers. Central to beanstalk is the concept of tubes. Tubes are independent job queues, somewhat like database tables. A queue can have several tubes at one time. Once a job is processed by worker it can be deleted permanently or "buried" (accessible only by a "kick"). Typically a job would be buried when it fails to complete; a "kick" is a manual retry of the job, hopefully after resolving whatever problem caused it to fail the first time. It is simple enough for most web apps.[1]

      ↑Jump back a section

      Options

      beanstalkd [OPTIONS]
      
      Options:
       -d       detach
       -b DIR   binlog directory
       -f MS    fsync at most once every MS milliseconds (use -f 0 for "always fsync")
       -F       never fsync (default)
       -l ADDR  listen on address (default is 0.0.0.0)
       -p PORT  listen on port (default is 11300)
       -u USER  become user and group
       -z BYTES set the maximum job size in bytes (default is 65535)
       -s BYTES set the size of each binlog file (default is 10485760)
       -v       show version information
       -h       show this help
      
      ↑Jump back a section

      Advantages

      Beanstalk has a lot of advantages. Few of them are below. [2][3]

      1. Eliminating long-running Cron jobs
      2. Parallel and/or asynchronous work
      3. Efficiency
      4. Scales easily - run more workers
      5. Flexibility
      ↑Jump back a section
      Last modified on 2 June 2013, at 05:07