Skip to content

[rpc] Client zero-copy lazy parse ByteBuf to avoid deep memory copy#2948

Open
fresh-borzoni wants to merge 1 commit intoapache:mainfrom
fresh-borzoni:lazy-parse-byte-buf
Open

[rpc] Client zero-copy lazy parse ByteBuf to avoid deep memory copy#2948
fresh-borzoni wants to merge 1 commit intoapache:mainfrom
fresh-borzoni:lazy-parse-byte-buf

Conversation

@fresh-borzoni
Copy link
Copy Markdown
Contributor

@fresh-borzoni fresh-borzoni commented Mar 28, 2026

closes #1184

Fix: each DefaultCompletedFetch retains the parsed ByteBuf and releases in drain(). The response handler releases the base reference in finally. Netty refcounting keeps the buffer alive exactly until the last bucket's records are consumed.

Effectively this is similar how it works in Rust SDK with Arc refcounting and Drop automatic release.

Both client paths now use zero-copy. isInnerClient flag removed as it was used only for this.

@fresh-borzoni fresh-borzoni changed the title [rpc] Client zero-copy lazy parse ByteBuf to avoid deep memory copy (… [rpc] Client zero-copy lazy parse ByteBuf to avoid deep memory copy Mar 28, 2026
@fresh-borzoni
Copy link
Copy Markdown
Contributor Author

@swuferhong @luoyuxia PTAL 🙏

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.

Client lazy parse ByteBuf to avoid deeply memory copy

1 participant