Skip to content

optimize(gRPC): support pooling HTTP2 framer write buffer to reduce idle connection memory#1944

Merged
DMwangnima merged 1 commit intocloudwego:mainfrom
DMwangnima:optimize/grpc-framer-buf
Apr 13, 2026
Merged

optimize(gRPC): support pooling HTTP2 framer write buffer to reduce idle connection memory#1944
DMwangnima merged 1 commit intocloudwego:mainfrom
DMwangnima:optimize/grpc-framer-buf

Conversation

@DMwangnima
Copy link
Copy Markdown
Contributor

@DMwangnima DMwangnima commented Apr 13, 2026

What type of PR is this?

optimize

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:

  • AddEnableReuseHTTP2FramerBuffertoReuseWriteBufferConfig.
  • UpdateWithGRPCReuseWriteBuffer comment to describe both config switches.
  • Allocate per-frame wbuf from mcache in startWrite and return after successful endWrite.
    On write failure the buffer is not returned, as the underlying writer may still hold a reference.
    zh(optional):

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

@DMwangnima DMwangnima requested review from a team as code owners April 13, 2026 03:17
@DMwangnima DMwangnima changed the title optimize: support reusing gRPC framer encoding write buffer optimize(gRPC): support reusing framer encoding write buffer Apr 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.66%. Comparing base (bfa27f3) to head (d172d09).
⚠️ Report is 42 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1944      +/-   ##
==========================================
+ Coverage   61.37%   62.66%   +1.28%     
==========================================
  Files         388      393       +5     
  Lines       35063    30089    -4974     
==========================================
- Hits        21521    18855    -2666     
+ Misses      12247     9940    -2307     
+ Partials     1295     1294       -1     
Flag Coverage Δ
integration 51.75% <0.00%> (+1.25%) ⬆️
unit 53.04% <100.00%> (+1.40%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@DMwangnima DMwangnima force-pushed the optimize/grpc-framer-buf branch from f764c0b to 76fe625 Compare April 13, 2026 05:32
…idle memory

Add EnableReuseHTTP2FramerBuffer to ReuseWriteBufferConfig.
Allocate per-frame wbuf from mcache in startWrite and return after successful endWrite.
On write failure the buffer is not returned, as the underlying writer may still hold a reference.
Update WithGRPCReuseWriteBuffer godoc to describe both config switches.
Add unit tests for zero-payload, large-payload and write-failure paths.
Add integration test cases covering framer buffer pooling combinations.
@DMwangnima DMwangnima force-pushed the optimize/grpc-framer-buf branch from 76fe625 to d172d09 Compare April 13, 2026 05:46
@DMwangnima DMwangnima changed the title optimize(gRPC): support reusing framer encoding write buffer optimize(gRPC): support pooling HTTP2 framer write buffer to reduce idle connection memory Apr 13, 2026
@DMwangnima DMwangnima merged commit ffe9073 into cloudwego:main Apr 13, 2026
25 checks passed
@DMwangnima DMwangnima deleted the optimize/grpc-framer-buf branch April 13, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants