Skip to content

[ISSUE #10510] Add gRPC server permit keepalive configuration#10516

Merged
lizhimins merged 2 commits into
apache:developfrom
RockteMQ-AI:fix/issue-10510
Jun 15, 2026
Merged

[ISSUE #10510] Add gRPC server permit keepalive configuration#10516
lizhimins merged 2 commits into
apache:developfrom
RockteMQ-AI:fix/issue-10510

Conversation

@RockteMQ-AI

Copy link
Copy Markdown
Contributor

Motivation

When a TCP connection is broken without a RST, the gRPC client needs to rely on HTTP/2 PING (keepalive) to detect the dead connection. Currently, the gRPC server in the Proxy does not configure permitKeepAliveTime or permitKeepAliveWithoutCalls, which means gRPC Netty server defaults apply:

  • permitKeepAliveTime = 5 minutes — clients cannot send keepalive pings more frequently than every 5 minutes
  • permitKeepAliveWithoutCalls = false — keepalive pings on idle connections are rejected

This causes slow dead-connection detection (up to 5.5 minutes) and ineffective idle connection health checks.

Fixes #10510

Changes

Add two configurable parameters to ProxyConfig:

Parameter Default Description
grpcServerPermitKeepAliveTimeMillis 10000 (10s) Minimum time between client keepalive pings
grpcServerPermitKeepAliveWithoutCalls true Allow keepalive pings when no active RPCs

Apply these in GrpcServerBuilder:

serverBuilder
    .permitKeepAliveTime(config.getGrpcServerPermitKeepAliveTimeMillis(), TimeUnit.MILLISECONDS)
    .permitKeepAliveWithoutCalls(config.isGrpcServerPermitKeepAliveWithoutCalls());

Impact

  • Backward compatible: Default values are more permissive than current implicit defaults
  • Minimal overhead: ~8KB/hour per connection at 30s interval
  • Enables faster detection: Once clients reduce keepAliveTime, dead-connection detection can drop from 5.5 minutes to ~40 seconds

Add configurable parameters to allow clients to send keepalive pings
more frequently, enabling faster dead-connection detection:

- grpcServerPermitKeepAliveTimeMillis (default: 10000ms = 10s)
- grpcServerPermitKeepAliveWithoutCalls (default: true)

Previously, gRPC server used implicit defaults (5min minimum interval,
no pings without active RPCs), causing slow dead-connection detection
(up to 5.5 minutes) and ineffective idle connection health checks.

Fixes apache#10510
@qianye1001

Copy link
Copy Markdown
Contributor

grpcServerPermitKeepAliveTimeMillis default value set 30s

@qianye1001

Copy link
Copy Markdown
Contributor

@RockteMQ-AI grpcServerPermitKeepAliveTimeMillis default value set 30s

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.36364% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.03%. Comparing base (c4f18d9) to head (cbf8018).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
.../org/apache/rocketmq/proxy/config/ProxyConfig.java 50.00% 4 Missing ⚠️
.../apache/rocketmq/proxy/grpc/GrpcServerBuilder.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10516      +/-   ##
=============================================
- Coverage      48.11%   48.03%   -0.08%     
+ Complexity     13348    13331      -17     
=============================================
  Files           1377     1377              
  Lines         100707   100730      +23     
  Branches       13010    13012       +2     
=============================================
- Hits           48455    48388      -67     
- Misses         46318    46395      +77     
- Partials        5934     5947      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RockteMQ-AI

Copy link
Copy Markdown
Contributor Author

Done. The default value of grpcServerPermitKeepAliveTimeMillis has been updated to 30000 (30s) in commit cbf8018.

@RockteMQ-AI

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! The default value of grpcServerPermitKeepAliveTimeMillis has been updated to 30000 (30 seconds) in commit cbf8018.


Automated reply by github-manager-bot

@RockteMQ-AI

Copy link
Copy Markdown
Contributor Author

Hi @qianye1001, thanks for the suggestion! The default value of grpcServerPermitKeepAliveTimeMillis has been updated to 30000 (30 seconds) in commit cbf8018. Please let us know if any further adjustments are needed.

@lizhimins lizhimins merged commit 7347c44 into apache:develop Jun 15, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Make gRPC server keepalive parameters configurable in ProxyConfig

4 participants