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.
Using Ubuntu Server on VM
sudo apt-get install beanstalkd
We need to enable public access in order to access the beanstalkd queue from host PC.
This is only for development, because we will be using beanstalk console on the host PC to watch the queue of Beanstalkd running in a virtual machine.
Don’t do this on production server.
sudo nano /etc/default/beanstalkd
Change BEANSTALKD_LISTEN_ADDR=127.0.0.1 to BEANSTALKD_LISTEN_ADDR=0.0.0.0 for public
Now restart the beanstalkd service
sudo service beanstalkd restart
If you want to see the queue while developing the application this console is very handy. You can see the number of jobs and inspect every job or delete it.
composer create-project ptrofimov/beanstalk_console -s dev
It will create a folder for beanstalk console. Navigate to that folder and start php server with this command:
php -S localhost:7654 -t public
Now if you check http://localhost:7654 in your browser.
Add remote server to check beanstalkd queues. Leave the port to default and change the server name. You can use the IP address or the server name where you have install beanstalkd.
Pheanstalk is a pure PHP 5.3+ client for the beanstalkd workqueue. It has been actively developed, and used in production by many, since late 2008. Created by Paul Annesley
composer require pda/pheanstalk
Now you can write job and run queue worker use connection beanstalkd