Design and Reasons of Publish/Subscribe Model of Message Queue

The model started like this:
Insert picture description here

Later, in order to be able to deal with the problem of the mismatch between the consumption capacity of consumers and the production capacity of producers.
Problem 1: The production capacity of producers is lower than the consumption capacity of consumers.

         最简单的想法增大生产者生产能力或者减小消费者消费能力。前者不可取,因为消息能生产出来的多少取决于系
         统,取决于业务。而对于上面的模型,P:C=1:1,消费者减无可减,所以也不可取。所以这个问题无解。仔细想
         下,其实一个消费者而已也没有浪费太多性能。

Problem 2: Consumers cannot keep up with the production capacity of producers

       这就引起了下面的设计,一个主题下分成多个队列,原来的一个消费者膨胀成一个消费者组,旗下有多个消费者,
       每个消费者对应一个队列。当需要增大消费能力时,新增队列与消费者组下的消费者即可。

Insert picture description here

Reprinted by Ao Bing

Guess you like

Origin blog.csdn.net/qq_41634872/article/details/111059570