Queues are where Laravel applications do their quiet, important work: sending emails, importing files, generating reports and keeping search indexes fresh. They are also where problems hide, because a failed job does not show an error page to anyone. These are the lessons we keep relearning, written down so we stop relearning them.
Separate connections for separate jobs
Not all jobs are equal. A password reset email must go out within seconds, while a nightly report can wait. We give long-running work its own queue connection and its own workers, so a slow import never delays a login email.
Match retry settings to timeouts
The connection's retry setting must be longer than the longest job timeout. If it is shorter, the queue assumes a slow job has died and hands it to another worker, and the job runs twice. This single setting has caused more duplicate emails than any bug we have written.
Name queues by purpose
Queues named after what they do, such as mail, search or reports, make dashboards readable and scaling decisions obvious.
Make jobs idempotent
Any job can run more than once: after a timeout, a deploy or a worker crash. Design every job so that running it twice has the same effect as running it once.
- Check whether the work is already done before doing it again.
- Use unique identifiers when calling external services that support them.
- Prefer updating a record to a known state over adding to a running total.
Keep payloads small
Pass identifiers, not whole models or large arrays. The job loads fresh data when it runs, which avoids acting on stale information and keeps the queue storage lean.
Monitor what matters
A queue can look healthy while silently failing. We watch three numbers: how many jobs are waiting, how long the oldest one has waited and how many failed in the last hour. Alerts fire on the age of the oldest job, because a growing wait is the earliest sign that workers are stuck or overloaded.
Failed jobs deserve a process
Failed jobs are stored with their error. Someone reviews them, fixes the cause and retries them deliberately. Retrying everything blindly hides bugs and can repeat side effects such as charging a card twice.
Deploy calmly
Workers keep old code in memory, so every deploy must restart them gracefully. Laravel's restart command lets current jobs finish before workers exit. Database migrations that remove columns should happen in two steps, so jobs queued before the deploy still find the data they expect.
Scale with intent
Add workers when the oldest job keeps waiting too long, not because the server has spare memory. More workers can make things worse if they compete for the same database rows or hit rate limits on external services.
Final thoughts
Good queue setups are boring: separate connections, timeouts that agree with each other, idempotent jobs, honest monitoring and graceful deploys. Get those right and the queue becomes the most reliable part of the application instead of the most mysterious.
Putting it into practice
If you want to try these ideas, start small. Pick one screen, one job or one page in a project you already know well, apply a single change from this post and measure the result for a couple of weeks. Small, measured changes are easier to explain to a team and much easier to undo if they do not work.
We write these notes from real client work, so every recommendation here has been tested on a production system. If you have a question about engineering, a different experience to share, or a project where these ideas could help, the contact page is the quickest way to reach us, and we read every message.
