Laravel, Beanstalkd and an overview of queues

In my project I am using Beanstalkd for queue processing. Sometimes jobs get stuck, while I’d like to debug these queue jobs. Mark Needham wrote a great blog about how to get an overview of Beanstalkd jobs.

Connecting

Assuming that Beanstalkd is installed, connect to the console through telnet:

telnet localhost 11300

Getting an overview

Use the command:

stats

You will get output like:

current-jobs-urgent: 0
current-jobs-ready: 2
current-jobs-reserved: 0
current-jobs-delayed: 0
current-jobs-buried: 0
cmd-put: 66
...
current-connections: 6
current-producers: 1
current-workers: 1
current-waiting: 1
total-connections: 58
pid: 15622
version: 1.4.6
rusage-utime: 0.000000
rusage-stime: 0.040002
uptime: 22740
binlog-oldest-index: 0
binlog-current-index: 0
binlog-max-size: 10485760

Listing the first ready job

To see a concrete ready job, use the command:

peek-ready

In terms of Laravel you can get a job result back

{"job":"Illuminate\\Queue\\CallQueuedHandler@call","data":{"...........job\";N;}"}}

If the job got stock, you can clear jobs by pulling in an artisan queue:clear package. Then, you can run the command:

php artisan queue:clear

If your daemon got stock as well, call php artisan queue:restart

Leave a Comment

Your email address will not be published. Required fields are marked *

en_USEnglish
Scroll to Top