-
Notifications
You must be signed in to change notification settings - Fork 100
[Master] Enforce HTTP/2 maxConcurrentStreams limit on server #2637
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
base: master
Are you sure you want to change the base?
Changes from all commits
bc9ff6b
fcb295d
06a6e2b
d2bf76b
d4c1995
e543634
c0d4b86
8500a75
38f5bce
f4b4157
98c70d5
e71164a
d05659d
00d615c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ The conforming implementation of the specification is released and included in t | |
| * 2.1.1. [Automatically starting the service](#211-automatically-starting-the-service) | ||
| * 2.1.2. [Programmatically starting the service](#212-programmatically-starting-the-service) | ||
| * 2.1.3. [Default listener](#213-default-listener) | ||
| * 2.1.4. [HTTP2 stream concurrency](#214-http2-stream-concurrency) | ||
| * 2.2. [Service](#22-service) | ||
| * 2.2.1. [Service type](#221-service-type) | ||
| * 2.2.2. [Service-base-path](#222-service-base-path) | ||
|
|
@@ -177,6 +178,7 @@ public type ListenerConfiguration record {| | |
| string? server = (); | ||
| RequestLimitConfigs requestLimits = {}; | ||
| int http2InitialWindowSize = 65535; | ||
| int http2MaxActiveStreams = 100; | ||
| decimal minIdleTimeInStaleState = 300; | ||
| decimal timeBetweenStaleEviction = 30; | ||
| |}; | ||
|
|
@@ -254,6 +256,21 @@ path = "resources/certs/ballerinaKeystore.p12" | |
| password = "ballerina" | ||
| ``` | ||
|
|
||
| #### 2.1.4. HTTP2 stream concurrency | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here also, should it be HTTP/2? |
||
|
|
||
| Each HTTP/2 connection can carry multiple requests concurrently over independent streams. The listener limits the | ||
| number of concurrent streams a single connection can open, advertised to clients via the `SETTINGS_MAX_CONCURRENT_STREAMS` | ||
| parameter, using the `http2MaxActiveStreams` field of the `ListenerConfiguration`. This defaults to `100`, the value | ||
| recommended by [RFC 7540 Section 6.5.2](https://www.rfc-editor.org/rfc/rfc7540#section-6.5.2). | ||
|
|
||
| ```ballerina | ||
| listener http:Listener h2Listener = new (9090, { | ||
| http2MaxActiveStreams: 500 | ||
| }); | ||
| ``` | ||
|
|
||
| A client that reaches this limit on a connection opens an additional connection rather than stalling. | ||
|
|
||
| ### 2.2. Service | ||
| Service is a collection of resources functions, which are the network entry points of a ballerina program. | ||
| In addition to that a service can contain public and private functions which can be accessed by calling with `self`. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,6 +134,7 @@ | |
| import static io.ballerina.stdlib.http.api.HttpConstants.ANN_CONFIG_ATTR_SSL_ENABLED_PROTOCOLS; | ||
| import static io.ballerina.stdlib.http.api.HttpConstants.CREATE_INTERCEPTORS_FUNCTION_NAME; | ||
| import static io.ballerina.stdlib.http.api.HttpConstants.ENDPOINT_CONFIG_HTTP2_INITIAL_WINDOW_SIZE; | ||
| import static io.ballerina.stdlib.http.api.HttpConstants.ENDPOINT_CONFIG_HTTP2_MAX_ACTIVE_STREAMS; | ||
| import static io.ballerina.stdlib.http.api.HttpConstants.HTTP_HEADERS; | ||
| import static io.ballerina.stdlib.http.api.HttpConstants.RESOLVED_REQUESTED_URI; | ||
| import static io.ballerina.stdlib.http.api.HttpConstants.RESPONSE_CACHE_CONTROL; | ||
|
|
@@ -1583,6 +1584,8 @@ public static ListenerConfiguration getListenerConfig(long port, BMap endpointCo | |
| listenerConfiguration.setPipeliningEnabled(true); //Pipelining is enabled all the time | ||
| listenerConfiguration.setHttp2InitialWindowSize(endpointConfig | ||
| .getIntValue(ENDPOINT_CONFIG_HTTP2_INITIAL_WINDOW_SIZE).intValue()); | ||
| listenerConfiguration.setHttp2MaxConcurrentStreams( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the pr description, it says: "Set to Where is this logic handled? |
||
| endpointConfig.getIntValue(ENDPOINT_CONFIG_HTTP2_MAX_ACTIVE_STREAMS).intValue()); | ||
|
|
||
| double minIdleTimeInStaleState = | ||
| ((BDecimal) endpointConfig.get(HttpConstants.ENDPOINT_CONFIG_IDLE_TIME_STALE_STATE)).floatValue(); | ||
|
|
||
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.
should we keep the terms consistent, with HTTP/2?