Posts Tagged #queues
Every article on the Techalyst blog tagged with #queues.
Switching Queue Drivers in Laravel Without Downtime
Each queue driver has its strengths, and one day you may want to move from one to another, say from the database driver to redis as you grow....
Removing Jobs of a Specific Type From a Laravel Queue
Here is a real incident. A pull request was merged by mistake and pushed one particular job to the queue more than a hundred thousand times. T...
Modern Laravel Queue Features Worth Knowing
The Laravel queue system grew a set of features that, taken together, make it genuinely production grade. Here is a tour of the ones worth hav...
Avoiding Lock Timeouts When Dispatching Large Job Batches
Batches are great until you dispatch a really big one. Push thousands of jobs into a single batch and you can deadlock your own queue, with wo...
Handling API Rate Limits in Queued Jobs
If your jobs call a third party API, sooner or later you will hit its rate limit and start getting 429 Too Many Requests. Hammering the API ha...
Laravel Queue Configuration Keys Explained
A few queue settings trip up nearly everyone, mostly because two of them look like they do the same thing and actually do not. Here is each on...
Job Has Been Attempted Too Many Times or Run Too Long
You open your logs or failed_jobs table and find a job marked failed with MaxAttemptsExceededException and the message "Job has been atte...
The Database Queue Driver Is Production Ready
For years the advice was clear: never run the database queue driver in production, use Redis. That advice is out of date. Modern databases fix...
Ensuring Horizon Terminates Gracefully
One of Horizon's nicest features is graceful shutdown: when told to stop, it waits for any in-flight jobs to finish before terminating its wor...
How Laravel Prepares a Job for the Queue
When you dispatch a job, it does not run there and then. It gets turned into a small record and stored, in MySQL, Redis, or SQS, until a worke...
Dispatching Unique Jobs to Laravel Queues
Here is a common need. Every time a product is updated you dispatch a job to rebuild the search index. If ten products are edited in a minute,...
Database Transactions in Laravel, and the afterCommit Trap
A database transaction groups several queries into one all or nothing unit. Either every query succeeds and the changes stick, or one of them...
Prevent Your Queued Jobs From Running Twice
You notice the same job ran twice. The email went out twice, the charge happened twice, and you are sure you dispatched it once. Before suspec...
Rationing Your Laravel Queue Workers' Memory and CPU
If your workers share a server with your web app, or run on a small box, they can quietly eat the resources your site needs. The goal is to le...
Avoiding Memory Leaks in Laravel Queue Workers
People love to argue about whether PHP is suited to long running processes. In practice, Laravel workers crunch enormous numbers of jobs relia...
How Laravel Horizon Works
Laravel Horizon is a queue manager for Redis queues. It gives you a single config file to describe how your jobs should be processed, a dashbo...
Fixing 'Duplicate entry for key failed_jobs_uuid_unique'
You spot this in your logs and it looks alarming. It reads like a database problem, but it is really a symptom of a queue misconfiguration. On...
Fair Queues: Balancing Job Processing Across Tenants in Laravel
Picture a multi tenant app with one shared queue. Most of the time it hums along. Then one tenant kicks off a bulk import and dispatches forty...
Laravel Queue Workers: How They Work
A queue worker sounds mysterious until you see what it actually is: a plain PHP process running in the background, pulling jobs out of storage...
Laravel Queues and Deployments
A queue worker is a long lived process that booted your application once and keeps it in memory. That is what makes it fast, and it is also wh...