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

Improvements observed with larger buffer sizes and chunked encoding #9189

Closed
nairiti-sharma opened this issue Aug 21, 2024 · 2 comments
Closed
Assignees
Milestone

Comments

@nairiti-sharma
Copy link

We observed 6X response time degradation on an API that fetches >7KB response with chunked encoding.

  • Helidon Version: 4.0.11
  • Helidon SE or Helidon MP : SE
  • JDK version: GraalVM on JDK21
  • OS: Linux
  • Docker version (if applicable): NA

Problem Description

On H3, there was no setting specific to byte buffer and it was left at the default value (https://github.com/netty/netty/blob/netty-4.1.108.Final/transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java )

On H4, there is a default of 512B which is causing the performance degradation.

In the JFR we could see that the number of Socket Writes with H4 are 2 times more than H3, even when throughput of H3 is 4 times more than H4.

When we increased this value to 8KB (-Dserver.write-buffer-size=8192), performance is at par with H3.

H3 : RT - 4.02ms
H4 (Default) : RT - 24ms
H4 with write-buffer-size - 1KB : RT - 5.37ms
H4 with write-buffer-size - 8KB : RT - 4.23ms

Steps to reproduce

Any response that has size greater than 7KB and "Transfer-Encoding: chunked" , would reproduce this issue.

H3JFR
H4JFR

@github-project-automation github-project-automation bot moved this to Triage in Backlog Aug 21, 2024
@spericas spericas self-assigned this Aug 21, 2024
@spericas spericas changed the title 6X RT degradation observed on an API using chunked encoding, on helidon 4.X vs helidon 3.X Improvements observed with larger buffer sizes and chunked encoding Aug 21, 2024
@spericas
Copy link
Member

@nairiti-sharma Let's consider a buffer size of 2-4K as a potential new default. Apps can always increase this if necessary.

@nairiti-sharma
Copy link
Author

These are the final numbers
H3 : RT - 3.87ms
H4 (Default) : RT - 28.5ms
H4 with write-buffer-size - 1KB : RT - 5.37ms
H4 with write-buffer-size - 4KB : RT - 5.24ms
H4 with write-buffer-size - 8KB : RT - 3.94ms

Setting 4K by default should work well. Services can tune this further as per their requirement.

@barchetta barchetta added this to the 4.1.1 milestone Aug 26, 2024
@barchetta barchetta moved this from Triage to Sprint Scope in Backlog Aug 26, 2024
@github-project-automation github-project-automation bot moved this from Sprint Scope to Closed in Backlog Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants