Redis is a powerful in-memory data store widely used for caching, queues, and real-time systems. When working with Redis in Node.js, you’ll commonly find two client libraries: redis (official) and ioredis (community-built). At first glance, they look similar — but there are key differences that matter depending on your project.
Redis vs ioredis Overview
Both clients let you connect, store, and retrieve data from Redis, but ioredis offers more advanced features such as cluster support, automatic reconnection, and better Pub/Sub handling — that’s why BullMQ and similar queue libraries use it internally.
| Feature | redis (official) | ioredis (community) |
|----------|------------------|---------------------|
| Maintained by | Redis team | Community (Tingjiang Zhang) |
| Cluster / Sentinel Support | ⚠️ Basic | ✅ Full |
| Automatic Reconnect | ❌ Manual | ✅ Built-in |
| Streams & Pub/Sub | ✅ | ✅ More stable |
| Bull / BullMQ Support | ❌ | ✅ Required |
| TypeScript Support | ✅ | ✅ Excellent |
| Performance | ⚡ Fast | ⚡ Fast |
Installation
# For official Redis client
npm install redis
# For ioredis (recommended for BullMQ and advanced apps)
npm install ioredis
Usage Examples
Using redis (Official)
import { createClient } from "redis";
const client = createClient();
await client.connect();
await client.set("name", "Shahroz");
console.log(await client.get("name")); // Shahroz
await client.quit();
Using ioredis (for BullMQ or advanced use)
import { Redis } from "ioredis";
const redis = new Redis(); // default: localhost:6379
await redis.set("language", "Node.js");
console.log(await redis.get("language")); // Node.js
await redis.quit();
Why BullMQ Requires ioredis
BullMQ internally relies on ioredis for its robust connection management and Pub/Sub system. If you try to use the official redis package with BullMQ, it will fail to connect because their internal interfaces are different.
// ❌ Wrong
import { createClient } from "redis";
import { Queue } from "bullmq";
const redis = createClient();
const queue = new Queue("emails", { connection: redis }); // Not compatible
// ✅ Correct
import { Redis } from "ioredis";
import { Queue } from "bullmq";
const connection = new Redis();
const queue = new Queue("emails", { connection });
⚠️ Note: Always use ioredis when working with Bull, BullMQ, or Redis clusters.
When to Use Which?
- Use redis → for simple caching, sessions, and key-value storage in a single-node environment.
- Use ioredis → for job queues, clusters, pub/sub apps, or when using BullMQ.
Conclusion
If your project is basic — redis works perfectly fine. But for advanced use cases like queues, distributed caching, and real-time systems, choose ioredis — it’s more reliable, reconnects automatically, and is fully compatible with BullMQ.