Why Migrate?
BullMQ offers several advantages over Bull:- Active Development - BullMQ is actively maintained with regular updates
- Better Performance - Improved Redis operations and optimizations
- New Features - Flow producers, job groups, rate limiting improvements
- TypeScript Support - Better type definitions and TypeScript integration
- Improved Architecture - Cleaner codebase and better patterns
Recommended Migration Strategy
The safest approach is to use new queues for BullMQ and deprecate the old Bull queues.Create new queues with different names or prefix
Use different queue names or a custom prefix to separate Bull and BullMQ queues:Option 1: Different Queue NamesOption 2: Different Prefix
Run Bull and BullMQ workers in parallel
During the migration period, run both Bull workers (for old queues) and BullMQ workers (for new queues) simultaneously:
Direct all new jobs to BullMQ queues
Update your producers to add jobs to the new BullMQ queues:
Note that BullMQ requires a job name as the first parameter to
add().Monitoring the Migration
Use a dashboard tool to monitor both Bull and BullMQ queues during migration:Taskforce.sh
Professional queue monitoring and management tool that supports both Bull and BullMQ
- Old queues are draining properly
- New queues are processing jobs correctly
- No jobs are stuck or lost during migration
API Differences
Key differences between Bull and BullMQ:- Adding Jobs
- Processing Jobs
- Events
- Connection
Bull:BullMQ:
BullMQ requires a job name as the first parameter.
Migration Checklist
Planning Phase
Planning Phase
- Identify all Bull queues in your application
- Decide on naming strategy (new names vs. prefix)
- Plan monitoring approach
- Schedule migration window
- Prepare rollback plan
Implementation Phase
Implementation Phase
- Install BullMQ:
npm install bullmq - Create new BullMQ queues with different names/prefix
- Implement BullMQ workers
- Update producers to use BullMQ queues
- Test BullMQ implementation in staging
Deployment Phase
Deployment Phase
- Deploy BullMQ workers alongside Bull workers
- Switch producers to add jobs to BullMQ queues
- Monitor both Bull and BullMQ queues
- Verify new jobs are processing correctly
Completion Phase
Completion Phase
- Monitor old Bull queues until empty
- Verify no jobs remain in Bull queues
- Shut down Bull workers
- Remove Bull dependency
- Clean up old queue data from Redis (optional)
Example: Complete Migration
Before (Bull)
bull-example.ts
After (BullMQ)
bullmq-example.ts
Troubleshooting
Jobs not being processed
Jobs not being processed
- Verify Worker is running and connected
- Check queue name matches between Queue and Worker
- Ensure connection settings are correct
- Check for errors in worker event handlers
Old jobs still in Bull queues
Old jobs still in Bull queues
- Verify Bull workers are still running
- Check for failed jobs that need to be retried
- Look for delayed jobs that haven’t reached their time
- Monitor stalled jobs
Performance issues
Performance issues
- Adjust worker concurrency settings
- Monitor Redis memory usage
- Check network latency between workers and Redis
- Review job processing code for bottlenecks
Related Resources
Newer Versions
Upgrading between BullMQ versions
Going to Production
Production deployment best practices
Worker Prefix Option
API reference for Worker prefix option
Queue Prefix Option
API reference for Queue prefix option
