Skip to content

The TCP SO_SNDBUF/SO_RCVBUF is fixed and too small, decrease throughput greatly #3825

@areyouok

Description

@areyouok

The SO_SNDBUF/SO_RCVBUF should not be set , the kernel will control it smartly, and have better performance than fixed value in most case.

the specified buffer can not greater than net.core.wmem_max/net.core.rmem_max, but kernal automantic control can increase to a larger value.

This problem decrease throughput especially in below case:

  1. this latency between broker and producer(or consumer) is large, especially for consumer
  2. the message body size is big

We implements a ping command using rocketmq remoting.
The new version we remove the below code in NettyRemotingClient/NettyRemotingServer

.option(ChannelOption.SO_SNDBUF, nettyClientConfig.getClientSocketSndBufSize())
.option(ChannelOption.SO_RCVBUF, nettyClientConfig.getClientSocketRcvBufSize())

The old version is 4.9.2, the test result is:
image

The tps of new version is upper to 20x faster than old version.

The kernel config is

net.core.wmem_max = 212992
net.core.rmem_max = 212992
net.ipv4.tcp_rmem = 4096	87380	6291456
net.ipv4.tcp_wmem = 4096	16384	4194304
net.core.wmem_default = 212992
net.core.rmem_default = 212992

in one broker (M/S sync master async flush), one producer send test.

  1. 250 byte body: 0.93x old version (the new version is slower slightly)
  2. 4000 byte body: 3.85x of old version
  3. 16000 byte body: 6.07x of old version
  4. 100000 byte body: 7.93x of old version

The old version is 4.9.3-SNAPSHOT in this test. In this test the network latency from producer to broker is 1.61ms.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions