Skip to content

Understanding Pub/Sub Clustering Architecture #1927

Open

Description

@jtruelove

Is there a place that explains how clustering works with pub/sub? I looked through the docs I could find but may have missed this info.

Q: Do all nodes subscribe to traffic on other nodes to get notified of publish events that their clients might have interest in? i.e. does each node act as a client to the other nodes in the cluster automatically? If this were the case it seems like at a certain scale this would break down so I'm assuming there's something else going on there.

I'm trying understand the performance implications and setup using something like Atmosphere to do channel messaging described here, http://async-io.org/tutorial.html. How do you scale an example like this once your traffic reaches a point where you need to use multiple redis nodes?.

Activity

  1. mattsta commented on Aug 11, 2014

    @mattsta
    Contributor

    You may get better answers by asking the official mailing list, but I'll give a few hints here.

    Do all nodes subscribe to traffic on other nodes to get notified of publish events that their clients might have interest in?

    PubSub in Redis Cluster is very simple. Every PUBLISH to any Redis Cluster node gets copied to every other Redis Cluster node on the Redis Cluster inter-node cluster bus.

    So, you can SUBSCRIBE to a channel on any Redis Cluster node then PUBLISH to the same channel on any other Redis Cluster node and the PUBLISH will reach every client attached to the cluster.

    There currently isn't any fancy logic to route message only to nodes with actual live subscribers, but it could be added eventually. Also see the tiny "Publish/Subscribe" section of http://redis.io/topics/cluster-spec

    If this were the case it seems like at a certain scale this would break down so I'm assuming there's something else going on there.

    The performance of large scale cluster PubSub has not been extensively tested yet, but computers are good at sending and receiving messages. You should be able to get pretty far before you reach any performance issues.

    How do you scale an example like this once your traffic reaches a point where you need to use multiple redis nodes?

    Adding more nodes to your Redis Cluster will help if your cluster nodes are currently too busy routing high throughput Pub/Sub messages. You can spread out your read load by adding more nodes, but it will also slightly increase your network noise as well over the cluster interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions