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

kekekiw123's avatar

Laravel how much or how many things should a queue process

When a certain action is complete in my app I need to do a few things before I return a success to the user.

  1. Send out an email to the user
  2. Send a Notification to the user through Onesignal
  3. Insert a new item in Model1
  4. Delete an item in Model2
  5. Update an item in Model3

And I would like to queue these things and I could ofc make one queue that does all those things but what is the best practise?

I was thinking of making 3 queues.

Queue1 > Send email

Queue2 > Send notification

Queue3 > Do the insert/update/deletes on the 3 tables (total of 3 queries/operations on 3 different tables)

So is there any best practise regarding queues on how much a queue should process?

0 likes
4 replies
lostdreamer_nl's avatar

It will depend on race conditions.

In the chain, is step 3 dependent on what happened in 2? Is step 4 dependent on 3? etc.

If they need to run in order, then you should use only 1 queue or even from within the same Job.

If it really doesn't matter, then you could use multiple queues, but it's not needed, having 1 queue and 4 workers it would behave in the same way.

kekekiw123's avatar

@lostdreamer_nl no they are not dependent on each other. I mostly wonder if it has any performance impact or any other pros cons beside that I can more easily check witch job failed if I keep them in seperated queues

lostdreamer_nl's avatar

"is there any best practise regarding queues on how much a queue should process"

No, a queue is build to not really care about 'how much is in the queue'

The only thing you have to care about is how much heavy jobs are being processed at the same time (so having multiple queues doing heavy things would need more coding on your end to make sure the server has enough resources)

For now: simply go with 1 queue and put everything in there.

Dalma's avatar

Sending the emails and notifications are likely to be the slowest processes. If you need the Model 1, 2 and 3 updates to be nearly instantaneous I would either code them inline or place them in a separate queue. It's relatively easy to determine timing and workloads when a single user is accessing your site but if you had many concurrent users your queues could have a significant number of lined up requests.

Please or to participate in this conversation.