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 Netty server configuration #7824

Merged
merged 11 commits into from
Oct 3, 2024
Merged

Conversation

nathphon
Copy link
Contributor

@nathphon nathphon commented Oct 1, 2024

Enhanced Netty server settings for performance, including connection and idle timeouts, header validation, buffer size, and response compression.

nathphon.jeamjit and others added 6 commits September 24, 2024 17:20
Replaces the annotation-based controller with a functional routing approach. Introduces a `RouterFunction` bean to handle HTTP requests, eliminates redundant response creation, and improves efficiency by directly parsing path variables.
Simplified the route definitions by using lambda expressions directly in the RouterFunction. This reduces unnecessary method declarations and enhances readability.
This change aligns the class name with its intended functionality. The class was previously named incorrectly, which could cause confusion. The new name clarifies its role as a controller within the Spring WebFlux framework.
This change corrects a package naming inconsistency in the BenchmarkController class. The package was previously listed incorrectly as "router" and has been updated to "controller" to reflect its actual content and functionality.
Added a 15-second cache control to key GET endpoints in `BenchmarkController`. Enhanced Netty server settings for performance, including connection and idle timeouts, header validation, buffer size, and response compression.
Updated EMPTY_RESPONSE and user/{id} route to exclude DATE and SERVER headers. This change improves security by not exposing server information and standardizes response headers.
@waghanza waghanza requested a review from whiplash October 1, 2024 05:44
nathphon.jeamjit added 2 commits October 1, 2024 14:39
Removed unnecessary DATE header manipulations and streamlined SERVER header removal in response preparation. Changed content type to TEXT_PLAIN and added shared caching logic for consistent behavior.
Removed HttpHeaders.CONNECTION for added security in response headers. Enabled HTTP/2 and adjusted connection and idle timeouts in application properties for optimized server performance. Changed root logging level from ERROR to WARN to capture more detailed logs.
Copy link
Collaborator

@waghanza waghanza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain a bit your PR ?

Why 15 seconds ?

@nathphon
Copy link
Contributor Author

nathphon commented Oct 1, 2024

@waghanza

I've been trying to configure various things based on other Java frameworks like Vertx, ActiveJ, Jooby, Quarkus, and others to observe the test results against WebFlux.

The 15-second setting is because I noticed that the benchmarking only lasts 15 seconds, so I set it as needed. I've seen that some languages and some frameworks also use cache through additional configuration.

@waghanza
Copy link
Collaborator

waghanza commented Oct 1, 2024

Ok. Understood. My point is that those configurations should not be used.

I mean the idea of this project is to show how frameworks could react with a production ready configuration, generally the default one.

If you spot some frameworks with caching configuration, could you make some PRs to remove those configurations ?

This commit eliminates the `CacheControl` mechanism from the `BenchmarkController`. The `maxAge` duration and related caching properties were removed for both the empty response and the user-specific response. This change might impact performance and response handling in caching-sensitive environments.
@nathphon
Copy link
Contributor Author

nathphon commented Oct 2, 2024

@waghanza I already remove cache control from Webflux , so please review and merge please , just want to see the performance next round

Replaced CacheControl and Duration imports with HttpHeaders and MediaType imports. This change addresses unnecessary imports and streamlines the code dependencies.
@nathphon nathphon changed the title Enable caching and optimize Netty server configuration Optimize Netty server configuration Oct 2, 2024
@nathphon nathphon requested a review from waghanza October 2, 2024 02:59
@waghanza waghanza merged commit d198e99 into the-benchmarker:master Oct 3, 2024
2 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.

2 participants