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....

3 mins read

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...

3 mins read

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...

3 mins read

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...

3 mins read

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...

3 mins read

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...

4 mins read

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...

3 mins read

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...

3 mins read

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...

3 mins read

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...

4 mins read

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,...

3 mins read

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...

5 mins read

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...

3 mins read

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...

3 mins read

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...

3 mins read

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...

4 mins read

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...

3 mins read

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...

4 mins read

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...

3 mins read