-
Notifications
You must be signed in to change notification settings - Fork 665
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
Conversation
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.
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.
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.
Could you explain a bit your PR ?
Why 15 seconds ?
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. |
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.
@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.
Enhanced Netty server settings for performance, including connection and idle timeouts, header validation, buffer size, and response compression.