在redis消息总线中为每个用户创建一个通道是一种好的做法吗

在redis消息总线中为每个用户创建一个通道是一种好的做法吗,redis,message-queue,stackexchange.redis,azure-redis-cache,message-bus,Redis,Message Queue,Stackexchange.redis,Azure Redis Cache,Message Bus,我们正在使用redis消息总线并使用通道处理消息。但是,如果我们的应用程序部署在多个实例中,那么请求和响应将传递给所有实例。为了避免这种情况,下面哪种方法更好 为应用程序的每个实例创建一个通道 为每个用户创建一个频道 任何建议都将受到高度赞赏这里的限制因素是同一频道的订户数量。通道的数量可以很大。因此,您可以相应地选择粒度。请在此处阅读更多信息: 以前提出过类似的问题: All the complexity on the end is on the PUBLISH command, that

我们正在使用redis消息总线并使用通道处理消息。但是,如果我们的应用程序部署在多个实例中,那么请求和响应将传递给所有实例。为了避免这种情况,下面哪种方法更好

  • 为应用程序的每个实例创建一个通道
  • 为每个用户创建一个频道

  • 任何建议都将受到高度赞赏

    这里的限制因素是同一频道的订户数量。通道的数量可以很大。因此,您可以相应地选择粒度。请在此处阅读更多信息:

    以前提出过类似的问题:

    All the complexity on the end is on the PUBLISH command, that performs
    an amount of work that is proportional to:
    
    a) The number of clients receiving the message.
    b) The number of clients subscribed to a pattern, even if they'll not
    match the message.
    
    This means that if you have N clients subscribed to 100000 different
    channels, everything will be super fast.
    
    If you have instead 10000 clients subscribed to the same channel,
    PUBLISH commands against this channel will be slow, and take maybe a
    few milliseconds (not sure about the actual time taken). Since we have
    to send the same message to everybody.