How to install and use Beanstalk on Ubuntu 18 04

Getting Started

Beanstalkd is a fast and simple work queue. What does this mean? Well, Beanstalkd is used to run the tasks asynchronously by putting the job into the queue. A queue is something you store a job in it. And, Job is almost anything.

For Instance, you created a registration form where user can register themselves. The process will be like:

  1. Storing user information into the table.
  2. Sending welcome mail at the same time to the user.
  3. Sending SMS etc. 

The whole process will slow down your application. So, Instead of going with the above process store all the time taken job into the queue for the better performance of your application.

Step 1. Install Beanstalk

To install beanstalkd, update your package lists with the following command

sudo apt-get update

Next, Enter the following command to install beanstalkd

sudo apt-get install beanstalkd

Step 2. Configure beanstalk

Edit the beanstalk configuration file which can be located at /etc/default/beanstalkd and set the below configuration 



BEANSTALKD_EXTRA="-z 35000000"

Save it and restart the beanstalk with the following command.

sudo service beanstalkd restart

Step 3. Install Beanstalk admin console

Note: Make sure the composer is installed in your system.

we will use ptrofimov/beanstalk_console the package for beanstalk admin console. written in PHP

To install admin console for the beanstalk queue server. Enter the following command in your terminal to install

composer create-project ptrofimov/beanstalk_console -s dev /var/www/html/beanstalkd

My installation directory is /var/www/html/binstalkd. Once this is done. Enter the beanstalkd directory and start the beanstalk console server with the following command

php -S localhost:8000 -t public/

To test the server open localhost:8000 in your browser

Beanstalk admin console