Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,26 @@ The delayed message index time step(in seconds) in per bucket snapshot segment,
+ "it can be enabled to reduce the memory consumption caused by pendingAcks.")
private boolean autoShrinkForConsumerPendingAcksMap = false;

@FieldContext(
category = CATEGORY_SERVER,
dynamic = true,
doc = "The minimum receive buffer size for AdaptiveRecvByteBufAllocator"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add more doc to guiding user to tune the value of this config?

)
private int minReceiveByteBuf = 1024;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the config name more descriptive. Maybe like minReceiveSizeForNettyByteBufAllocator ?


@FieldContext(
category = CATEGORY_SERVER,
dynamic = true,
doc = "The init receive buffer size for AdaptiveRecvByteBufAllocator"
)
private int initReceiveByteBuf = 16 * 1024;

@FieldContext(
category = CATEGORY_SERVER,
dynamic = true,
doc = "The max receive buffer size for AdaptiveRecvByteBufAllocator"
)
private int maxReceiveByteBuf = 1 * 1024 * 1024;
@FieldContext(
category = CATEGORY_SERVER,
dynamic = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,11 @@ private void startProtocolHandler(String protocol,
bootstrap.option(ChannelOption.SO_REUSEADDR, true);
bootstrap.childOption(ChannelOption.ALLOCATOR, PulsarByteBufAllocator.DEFAULT);
bootstrap.childOption(ChannelOption.TCP_NODELAY, true);
int minReceiveByteBuf = pulsar().getConfiguration().getMinReceiveByteBuf();
int initReceiveByteBuf = pulsar().getConfiguration().getInitReceiveByteBuf();
int maxReceiveByteBuf = pulsar().getConfiguration().getMaxReceiveByteBuf();
bootstrap.childOption(ChannelOption.RCVBUF_ALLOCATOR,
new AdaptiveRecvByteBufAllocator(1024, 16 * 1024, 1 * 1024 * 1024));
new AdaptiveRecvByteBufAllocator(minReceiveByteBuf, initReceiveByteBuf, maxReceiveByteBuf));
EventLoopUtil.enableTriggeredMode(bootstrap);
DefaultThreadFactory defaultThreadFactory =
new ExecutorProvider.ExtendedThreadFactory("pulsar-ph-" + protocol);
Expand All @@ -470,8 +473,12 @@ private ServerBootstrap defaultServerBootstrap() {
bootstrap.childOption(ChannelOption.ALLOCATOR, PulsarByteBufAllocator.DEFAULT);
bootstrap.group(acceptorGroup, workerGroup);
bootstrap.childOption(ChannelOption.TCP_NODELAY, true);
int minReceiveByteBuf = pulsar().getConfiguration().getMinReceiveByteBuf();
int initReceiveByteBuf = pulsar().getConfiguration().getInitReceiveByteBuf();
int maxReceiveByteBuf = pulsar().getConfiguration().getMaxReceiveByteBuf();
bootstrap.childOption(ChannelOption.RCVBUF_ALLOCATOR,
new AdaptiveRecvByteBufAllocator(1024, 16 * 1024, 1 * 1024 * 1024));
new AdaptiveRecvByteBufAllocator(minReceiveByteBuf,
initReceiveByteBuf, maxReceiveByteBuf));
bootstrap.channel(EventLoopUtil.getServerSocketChannelClass(workerGroup));
EventLoopUtil.enableTriggeredMode(bootstrap);
return bootstrap;
Expand Down