rabbitmq / rabbitmq-common

Common library used by rabbitmq-server and rabbitmq-erlang-client
Other
66 stars 112 forks source link

Optimisation for 'delegate' #349

Closed tomyouyou closed 3 years ago

tomyouyou commented 4 years ago

If a message is sent to only one queue(in most application scenarios), passing through the 'delegate' is meaningless. Otherwise, it increases the delay of the message and the possibility of 'delegate' congestion.

Here are some test data: node1: Pentium(R) Dual-Core CPU E5300 @ 2.60GHz node2: Pentium(R) Dual-Core CPU E5300 @ 2.60GHz

Join node1 and node2 to a cluster. Create 100 queues on node2, and start 100 consumers to receive messages from these queues. Start 100 publishers on node1 to send messages to the queues of node2. Each publisher will send 10k messages at the rate of 100/s(10k/s theoretically in total), and all the messages for all publishers is 1 million.

Before optimisation: {1,[{msg_time,812312(=<1ms),177922(=<5ms),9507(=<50ms),221(=<500ms),38(=<1000ms),0,0,0,0,1061,1069,0,0}]}

After optimisation: {1,[{msg_time,902854(=< 1ms),93993(=<5ms),3038(=<50ms),96(=<500ms),19(=<1000ms),0,0,0,0,1049,1060,0,0}]}

Additional information:

  1. Time counted here is the stay time of a message in the cluster, that is, Time(leaving from node2 at) - Time(reaching node1 at).
  2. "812312(=<1ms)" is the number of messages with time consumption less than or equal to 1ms. Overall, the optimisation is effective.
michaelklishin commented 4 years ago

So about 11% gained in the "best latency" bucket. Thank you, we will QA this.

michaelklishin commented 4 years ago

This has slipped through the cracks in last year's holiday season but we will take another look, possibly after 3.8.4 ships. Thank you!

lukebakken commented 3 years ago

Closing due to the migration to the monorepo.