-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
optimize number of buffer allocations #11879
Conversation
I think I see what you're trying to do, but I'm not sure this is how we want to do it. You've basically realized that we needed the minimum allocation size for unknown message sizes/compression. It seems we should quickly revert the Netty/Servlet changes, since those are known to cause regressions. And I need to stare at this more. CC @shivaspeaks |
CC @AgraVator |
core/src/main/java/io/grpc/internal/WritableBufferAllocator.java
Outdated
Show resolved
Hide resolved
Checkstyle is annoying being upset with FIRST_BUFFER_SIZE. But, yeah, you'll need to move it a bit. Thank you for noticing the issues and adjusting the code! I'm really glad you noticed before we did the release. |
Currently this improves 2 flows
Known length message which length is greater than 1Mb
previously the first buffer was 1Mb, and then many buffers of 4096 bytes (from CodedOutputStream), now subsequent buffers are also up to 1Mb
in case of compression, the first write is always 10 bytes buffer (gzip header), but worth allocating more space