Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

blixary's avatar

How do queue workers work in Forge?

I don't understand the basic structure of the separate worker servers in Laravel Forge. I am using them for the first time.

My questions:

  1. Do I need to install the whole Laravel app here?
  2. If a database is used as a connection, is it a separate database or the database of the corresponding Laravel app?
  3. How can multiple worker servers be used for the same job/queue of the Laravel app? As I understand it, each queue can only correspond to one worker at a time... But then I would have to decide in advance which job/queue is taken over by which worker server?

I would be delighted if someone could shed some light on this.

0 likes
1 reply
aleahy's avatar
  1. I don't see how you would install only part of the app....? Not sure I understand this question.
  2. If you're using the database queue driver, it would typically be a table in your app database that the workers are reading from. The docs tell you how to create the table required to hold the queue. So when you dispatch a job, it makes an entry into this table with the details of how to complete the job.
  3. Multiple queue workers are all accessing that database table holding your queued jobs. They just read the next job on the queue. When it reads the job, it puts a "hold" on the job in the database so no other queue worker tries to take it. The next worker available then reads the next available job in the table and begins that job. If it fails or there is a reason to "release" the job back to the queue, it makes it available for another worker to take it. There are other attributes to a job you can set like how long to delay before attempting the job or how many times you can retry a job before it permanently fails. So in answer to your question, a single queue can have as many workers as you wish (depending on server limits). But you might want to send slow jobs to one queue and fast ones to another so that the fast jobs are not inhibited when all the workers are taken up working on slow jobs.

You can set up queues really easily locally. Just set up the database queue driver, as per the docs, and run several versions of php artisan queue:work in several different terminal windows. Make some really simple jobs (php artisan make:job) and dispatch a whole bunch of them from a route. You'll see all the queue workers running your jobs as they get added to the queue in the terminal windows.

On forge, when you create your workers, you just go to your site and select queue, then new worker. Leave the defaults if you don't know what you're doing, but "Number of Processes" is the number of workers you will be running simultaneously.

1 like

Please or to participate in this conversation.