Support bookie server config tcp keep-alive#4762
Merged
wenbingshen merged 3 commits intoapache:masterfrom Apr 28, 2026
Merged
Conversation
Signed-off-by: xiaolongran <xiaolongran@tencent.com>
zymap
approved these changes
Apr 28, 2026
wenbingshen
reviewed
Apr 28, 2026
lhotari
reviewed
Apr 28, 2026
Signed-off-by: xiaolongran <xiaolongran@tencent.com>
Signed-off-by: xiaolongran <xiaolongran@tencent.com>
Member
Author
|
@lhotari @wenbingshen PTAL again, thanks |
Member
Author
|
rerun failure checks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
In PR #4683, we introduced support for configuring TCP keep-alive parameters (TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT) on the Bookie client side (PerChannelBookieClient). This allowed users to fine-tune keep-alive behavior per connection instead of relying solely on the kernel-level defaults defined in /proc/sys/net/ipv4/tcp_keepalive_*.
However, as discussed in apache/pulsar#25580, a one-sided configuration is not enough. TCP keep-alive is a per-socket setting that works independently on each end of a connection. If only the client enables custom keep-alive parameters while the server still uses the OS-level defaults, operators are still forced to tune the kernel parameters of the host on which the Bookie runs in order to achieve a consistent end-to-end keep-alive behavior. This defeats the purpose of having fine-grained, application-level control and makes it cumbersome to deploy Bookies in environments where modifying OS-wide TCP settings is not permitted (e.g., shared or managed hosts).
To close this gap, we need to provide the same configurability on the Bookie server side (BookieNettyServer), so that a complete, symmetric TCP keep-alive configuration can be achieved from BookKeeper itself, without requiring any changes to the underlying operating system.
Changes
Backward Compatibility
All new options default to -1 and Epoll-specific channel options are only applied on EpollEventLoopGroup. Existing deployments see no behavior change after upgrading.
References