CodePark/ questions / BullMQ & Node job queues
START PRACTICINGPRACTICE
Backend question · Message queues & streaming › BullMQ & Node job queues

Why does BullMQ require Redis to run with maxmemory-policy noeviction?

Because with an eviction policy Redis may delete BullMQ's keys under memory pressure, silently losing jobs and corrupting queue state

With an eviction policy, Redis may delete BullMQ's keys when memory runs low, and jobs are lost without any error. Eviction policies free memory by deleting keys. BullMQ stores its job hashes, lists and sets as ordinary keys. So a job, or part of the queue's records, can disappear and leave the queue state broken.

With
noeviction, Redis rejects new writes when memory is full. This fails loudly, with an error, instead of losing data quietly. This is why BullMQ should not share a Redis that is also used as a cache with eviction.

The option "It is only a recommendation for speed; any policy works the same" is wrong. The setting protects data, not speed.