Skip to content
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

Merged
merged 16 commits into from
Feb 14, 2025
Merged

Conversation

panchenko
Copy link
Contributor

@panchenko panchenko commented Feb 4, 2025

Currently this improves 2 flows

  1. 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

  2. in case of compression, the first write is always 10 bytes buffer (gzip header), but worth allocating more space

@panchenko panchenko changed the title okhttp: remove 4096 min buffer size optimize number of buffer allocations Feb 8, 2025
@ejona86
Copy link
Member

ejona86 commented Feb 10, 2025

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

@ejona86 ejona86 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 10, 2025
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 10, 2025
@ejona86
Copy link
Member

ejona86 commented Feb 11, 2025

CC @AgraVator

@ejona86 ejona86 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 13, 2025
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 13, 2025
@ejona86
Copy link
Member

ejona86 commented Feb 13, 2025

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.

@ejona86 ejona86 requested a review from larry-safran February 13, 2025 22:24
@ejona86 ejona86 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 14, 2025
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 14, 2025
@ejona86 ejona86 merged commit 5a7f350 into grpc:master Feb 14, 2025
16 checks passed
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.

4 participants