We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
In Laravel, dispatching a Job to the Queue is simple. But what about 5,000 jobs at once? Will it crash the server? How can we optimize it? We tried this experiment, and this article will tell you the results.
The task is to send THIS invoice PDF to the customer.
That is, to 5,000 customers. You know, that day of the month when you need to send monthly invoices to everyone? So yeah, we tried to mimic exactly that.
Here's the plan for this tutorial:
- No Queue: will generating PDFs crash the server?
- Moving to Queue and measuring the time
- Optimization 1: Increase Queue Workers
- Optimization 2: Bump up Server Specification
- Optimization 3: Decrease Queue Workers (wait, what?)
- Conclusion (for now)
At each step, we will take measurements and draw our conclusions.
Notice: In this tutorial, we measure the queues on the same server as the web application itself. We may potentially write a follow-up article on how to separate/scale queues on different servers.
continue reading on laraveldaily.com
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.