In BullMQ, scaling depends on how you design your queues and workers. You can have multiple instances with one or more named queues, each with their own separate set of workers. Here are some strategies for scaling BullMQ:
// On machine 1 const worker = new Worker('my-queue', processor); // On machine 2 const worker2 = new Worker('my-queue', processor);
const worker = new Worker('my-queue', processor, { concurrency: 50 });
// High priority queue with more workers const highPriorityWorker = new Worker('high-priority-queue', processor, { concurrency: 100 }); // Low priority queue with fewer workers const lowPriorityWorker = new Worker('low-priority-queue', processor, { concurrency: 10 });
Keep in mind that scaling should be done based on the bottleneck of your system, whether it's CPU, I/O, network, or another resource. Monitor your system to identify bottlenecks and scale appropriately.
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.