Search code examples
phplaravelqueuebeanstalkd

Setup Remote beanstalkd Laravel 4.2


My stack set-up consists of the following:

  1. www.main.com - Main Server (Main Application code & supervisord)
  2. www.queue-server.com - Beanstalkd installed here (No code here only beanstalkd)

I'm using Laravel 4.2.

I have setup Supervisord on www.main.com and added the following queue listener:

php artisan queue:work--queue=test --env=test

My app/config/queue.php file settings are as below:

'beanstalkd' => array(
    'driver' => 'beanstalkd',
    'host'   => 'www.queue-server.com',
    'queue'  => 'test',
    'ttr'    => 60,
),

From my understanding, it should push & process jobs on www.queue-server.com server but it shows no cpu spikes there, but www.main.com server shows high cpu usage.

So my questions are:

  1. Is my setup correct? Or I have to change something?
  2. I want to process my job on www.queue-server.com server. How can I achieve that?

Solution

  • The beanstalkd server is just the storage of the queue data itself, it does no processing. Its the php artisan queue:work command that then processes the queue. This is why you are seeing the higher load on your www.main.com server as although your queue is stored on the other server, the main server is the one currently processing the queue.

    If you wish for the www.queue-server.com server to process the queue you need to install your application there as well and run the artisan command from there.