DEV Community

Amjad Iqbal
Amjad Iqbal

Posted on Originally published at amjad.com.pk

Your Laravel queue can lose jobs without an error: Redis eviction explained

Some Laravel problems leave no trace. This is one of them.

The setup that bites

Many apps run the cache, the queue and the sessions on one Redis server. If that server uses maxmemory-policy allkeys-lru, Redis is allowed to delete any key under memory pressure, including the list that holds your queued jobs. There is no exception, no failed job and no log line. Your memory graph looks healthy because it does not know which keys belong to the queue.
There is a second trap. php artisan cache:clear runs FLUSHDB, so if the cache and the queue share a Redis database, clearing the cache also empties the queue.

What I built

Laravel Redis Advisor reads your cache, queue, session and Horizon configuration to learn which Redis connection holds what. Then it reads INFO, a SCAN sample of keys and a few queue lengths, and reports each problem with its severity, the numbers behind it and the fix, written as a redis.conf line or as Laravel config.

  • Queue checks: jobs open to an eviction policy, backlog and the oldest job's wait, expired reservations, Horizon trim settings.- Key checks: queues or sessions that cache:clear would delete.- Strictly read-only: every command passes one guard that only allows reads.## Install composer require amjadiqbal/laravel-redis-advisor Free and MIT licensed, for Laravel 12 and 13. Docs and source: https://amjad.com.pk/laravel/packages/laravel-redis-advisor

Top comments (0)