-
Notifications
You must be signed in to change notification settings - Fork 564
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
4.x: Concurrency limits module, and support in Helidon WebServer #9295
4.x: Concurrency limits module, and support in Helidon WebServer #9295
Conversation
Signed-off-by: Tomas Langer <[email protected]> Co-authored-by: André Rouél <[email protected]> Signed-off-by: Tomas Langer <[email protected]>
Signed-off-by: Tomas Langer <[email protected]>
Signed-off-by: Tomas Langer <[email protected]>
Signed-off-by: Tomas Langer <[email protected]>
d85a7d0
to
cd3282b
Compare
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.
LGTM, great rework and integration
Have few clarifications
|
After discussing the needs in Helidon, we must do this using the |
I wanted to bring up that metrics would be super important for production as @vasanth-bhat brought it up as well. Within my draft I figured quickly that the limiting works as expected but metrics would give me the insights I need to build convidence. Maybe this is something for a follow-up Pull Request, idk. |
Signed-off-by: Tomas Langer <[email protected]>
Metrics must be a follow up, as it would require much more work. I cannot just add a dependency on |
Signed-off-by: Tomas Langer <[email protected]>
Pushed a new version, updated original description to reflect new implementation. |
Created a follow up issue: #9304 |
Signed-off-by: Tomas Langer <[email protected]>
Signed-off-by: Tomas Langer <[email protected]>
Went through the new changes. I think it would help to clarify between the below 2 , with example to understand the difference between the two. Do both them provide same functionality but via different approaches ?
|
I think we should have also some method, which ignores waiting to obtain the token, if wait period is configured. Such as Justification |
…onfiguration. Added support to bypass queuing and return immediately. Signed-off-by: Tomas Langer <[email protected]>
try { | ||
routing.route(ctx, request, response); | ||
} finally { | ||
if (response.status() == Status.NOT_FOUND_404) { |
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.
Maybe something for a future PR: Should we allow a user to specify which 4xx codes can be ignored?
permit.success(); | ||
this.lastRequestTimestamp = DateTime.timestamp(); | ||
} catch (Throwable e) { | ||
permit.dropped(); |
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.
Maybe something for a future PR: Should we allow a user to specify which exception can be recorded as ignored instead of being counted as dropped?
common/concurrency/limits/src/main/java/io/helidon/common/concurrency/limits/AimdLimitImpl.java
Outdated
Show resolved
Hide resolved
common/concurrency/limits/src/main/java/io/helidon/common/concurrency/limits/FixedLimit.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Tomas Langer <[email protected]>
…idon-io#9295) * Concurrency limits module, and support in Helidon WebServer * Align configuration key for server feature and server. * Refactored to use tokens. * Added tests for configuration based limits. * Added copy to a limit, so we can get another instance with the same configuration. * Added support to bypass queuing and return immediately. Signed-off-by: Tomas Langer <[email protected]> Co-authored-by: André Rouél <[email protected]> Signed-off-by: Tomas Langer <[email protected]>
…9384) * 4.x: Concurrency limits module, and support in Helidon WebServer (#9295) * Concurrency limits module, and support in Helidon WebServer * Align configuration key for server feature and server. * Refactored to use tokens. * Added tests for configuration based limits. * Added copy to a limit, so we can get another instance with the same configuration. * Added support to bypass queuing and return immediately. Signed-off-by: Tomas Langer <[email protected]> Co-authored-by: André Rouél <[email protected]> Signed-off-by: Tomas Langer <[email protected]> --------- Signed-off-by: Tomas Langer <[email protected]> Co-authored-by: Tomas Langer <[email protected]> Co-authored-by: André Rouél <[email protected]>
Description
Resolves #8897
Resolves #9229
Documentation
This PR introduces
common/concurrency/limits
that provides API and SPI for concurrency limit implementations, and a couple of default implementations (AIMD, Fixed).webserver/concurrency-limits
that provides feature with a filter to impose limits within a filter in routingwebserver/webserver
to use aLimit
instead of aSemaphore
in connection handlers (backward compatible)Configuration reference will be in the generated documentation.
Configure limits on WebServer
This will configure limit for a server listener (configurable per listener), enforced on the connection level (i.e. outside of routing and filters).
The default behavior is the same (unlimited).
If
server.max-concurrent-requests
is configured (value is not-1
), it will be used andconcurrency-limit
configuration for the listener will be ignored.Configuration:
Configure limits for routing
This will configure limit for as a server feature, enforced in an HTTP filter.
Configuration: