Redis Advanced Architecture
Redis Streams vs Pub/Sub (Advanced Architecture) When designing scalable systems using Redis , one of the most common architectural decisions is: Should I use Pub/Sub or Streams ? 1️⃣ Redis Pub/Sub – Fire & Forget Messaging How It Works Publisher sends message to channel Redis pushes message instantly to subscribers No storage No acknowledgment SUBSCRIBE notifications PUBLISH notifications "New Order Created" Characteristics Real-time delivery No persistence No retry No message history No consumer tracking Best For ✔ Live chat ✔ Real-time dashboards ✔ WebSocket notifications ✔ Lightweight microservice communication 2️⃣ Redis Streams – Persistent Event Log Redis Streams (introduced in Redis 5) behave like a lightweight event streaming platform. XADD orders * user_id 101 product "Laptop" XREAD STREAMS orders 0 Key Features Persistent message log Consumer groups Acknowledgment support Message replay Mes...