-
Notifications
You must be signed in to change notification settings - Fork 4k
protobuf, api, core, netty: zero copy into protobuf #7330
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
9936df1
Add mark&reset methods and canUseByteBuffer&getByteBuffer methods to …
voidzcy aa93e1d
Default implementations.
voidzcy 454e224
Wire new methods for forwarder
voidzcy 3f47d5e
Support mark&reset and retrieving content via ByteBuffer for netty.
voidzcy b3c9974
Implementation for composite.
voidzcy 2ede525
Define interface for accessing readable content via ByteBuffers.
voidzcy 3dca312
Implement mark&reset for simple readable buffers.
voidzcy 6249353
Use HasByteBuffer interface for accesing input stream's backing ByteB…
voidzcy 29dce67
Eliminate the length argument for retrieving the ByteBuffer.
voidzcy 22ea6c3
Do no require netty buffer to be direct from API's perspective.
voidzcy 53e347c
Use Deque operations to avoid unncessary moves.
voidzcy 27801fe
Make a list of ByteBuffers up-front instead of a running iterator.
voidzcy eb71a68
Add getByteBufferSupported method for HasByteBuffer so that it can be…
voidzcy 5d3c657
It's not necessary to implement getByteBuffer for ByteReadbaleBufferW…
voidzcy 9fd8d3c
Add test coverage for mark&reset and getByteBuffer for generic ByteBu…
voidzcy e3afe50
Add test coverage for netty's special get NIO bytebuffer operation.
voidzcy e2fdd07
Skip test for operations not supported by okhttp.
voidzcy 033270b
Add test coverage for BufferInputStream with getByteBuffer operation.
voidzcy 0622d51
Add test using a known-length input stream with getByteBuffer operati…
voidzcy 0e8caee
Modify test method name.
voidzcy ba4e91b
Add test coverage for mark&reset and getByteBuffer for CompositeReada…
voidzcy 69618b2
Add getByteBuffer support for ByteReadableBufferWrapper.
voidzcy 437857d
Only pull ByteBuffers when message is large.
voidzcy 1363505
Run ByteBuffer codepath only in Java 9+.
voidzcy c46eb73
Slight improvement for avoiding array creation if not necessary.
voidzcy 7b4e070
Merge branch 'master' of github.com:grpc/grpc-java into impl/zero_cop…
voidzcy 772b3ba
Change ReadableBuffer#canUseByteBuffer to hasByteBuffer.
voidzcy b1c99e5
Removed unnecessary reset.
voidzcy 692076c
Simplify checking runtime java version.
voidzcy 10c13b8
Add ExperimentalApi annotation.
voidzcy f13c165
Rename ReadableBuffer#hasByteBuffer to getByteBufferSupported.
voidzcy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Removed unnecessary reset.
- Loading branch information
commit b1c99e551846a02ef5b9e23d0a79ef866cf3023c
There are no files selected for viewing
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
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.
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.
This check should still be done in the new case I think?
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.
We have decided to keep "normal" messages (2~4 KB) in the current codepath, copying small things isn't necessarily bad with CPU caches. So we only enable this for messages >= 64 KB (most messages should be below this threshold).
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.
Sounds reasonable, would be interesting to benchmark different message sizes/sparsity to verify the threshold (of course likely system dependent).
But what about the
size <= DEFAULT_MAX_MESSAGE_SIZEcheck?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.
For large messages (larger than DEFAULT_MAX_MESSAGE_SIZE), we would prefer the ByteBuffer approach if it is supported. This shouldn't cause a problem.