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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpc_util: Reuse memory buffer for receiving message #5862
rpc_util: Reuse memory buffer for receiving message #5862
Changes from 37 commits
493be5d
ecdb6d2
cb8827d
bae37e3
cbaef54
f9730dd
e746250
711db78
c05feed
9390057
b1c6496
086dd28
d6c1d97
1b11bba
a44c200
6b5000f
c34da60
acec626
3cbb6b5
57b9c67
76caf74
8f33b9b
5155566
15f820e
539eef3
056b3e5
0d07cfc
7f6fdb2
ca9f6de
9be7889
25b60e3
8e8f683
96f5a27
fe1294f
5535416
2678efb
8199eeb
a70df17
86d999f
63a360e
1f4bc35
3dcd833
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why this optimization is not going to work with
StatsHandler
? I'm not very familiar with the codebase, but I couldn't see anything that'd explain this in the MR. I'm usingStatsHandler
for metrics and for some other things, but I also want my app to benefit from this optimization because currently most memory allocations in my app come from protobuf (golang/protobuf#1495) and gRPC.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the current
StatsHandler
relies onuncompressedBytes
, making it difficult to determine when to return memory to the buffer pool.grpc-go/stream.go
Line 1096 in 2cd95c7
A possible solution I've thought of is to allow users to control the
payloadInfo
configuration, but that change may be too extensive to include in this PR. If you're interested in pursuing this, please create a new issue, and I'll follow it after this.grpc-go/rpc_util.go
Line 723 in 2cd95c7
Any thoughts on this? @dfawley @easwars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any way around this, given our current API, unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hueypark Opened #6660 to track this as a feature request. Thank you.