Redis › Pub/Sub
How does Redis Pub/Sub behave differently in a Redis Cluster environment compared to a single instance setup?
AdvancedAnswer
In a standard Redis Cluster, published messages are automatically forwarded to all nodes in the cluster so that a subscriber connected to any node receives messages published from any other node, though this cluster wide message propagation adds some additional overhead, and Redis also offers sharded Pub/Sub as an alternative that restricts message propagation to reduce this overhead for cluster deployments with heavy Pub/Sub usage.
-- Sharded Pub/Sub commands, introduced for cluster efficiency
SSUBSCRIBE mychannel
SPUBLISH mychannel 'message'Real-world example A large scale application running Redis Cluster switches from regular Pub/Sub to sharded Pub/Sub commands, reducing the cluster wide message propagation overhead that had been affecting performance under their heavy notification traffic.