-
Notifications
You must be signed in to change notification settings - Fork 181
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
HTTP/2 set initial settings #2341
Conversation
7b0e71c
to
266ca6b
Compare
@@ -52,6 +54,11 @@ public static H1ProtocolConfigBuilder h1() { | |||
/** | |||
* Returns {@link H2ProtocolConfig} with the default configuration for | |||
* <a href="https://tools.ietf.org/html/rfc7540">HTTP/2</a>. | |||
* <p> | |||
* Note this doesn't necessarily provide {@link H2ProtocolConfig#initialSettings()} that corresponds to |
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.
worth calling out for visibility... default values were set based upon experience and this carve out is meant to highlight that folks should be explicit if they depend upon specific values (defaults are subject to change).
266ca6b
to
73d92b6
Compare
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ProtocolConfig.java
Show resolved
Hide resolved
bc57b6d
to
ac3ba07
Compare
test failure attributed to #2343 |
Motivaiton: There is no way to define initial values for [http/2 settings](https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2). Modifications: - Enhance H2ProtocolConfigBuilder to accept Map<Character, Integer> to set the initial settings values. - Set the default value of settings with bound max header list size and 1mb default initial flow control window. - Increase flow control quantum to 16kb because the flow control window is larger. This allows streams to write an entire frame per write operation and increases goodput on the connection.
ac3ba07
to
c324d8a
Compare
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ProtocolConfig.java
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Http2Settings.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ProtocolConfig.java
Show resolved
Hide resolved
...alk-http-netty/src/main/java/io/servicetalk/http/netty/H2ServerParentChannelInitializer.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Http2Settings.java
Outdated
Show resolved
Hide resolved
...alk-http-netty/src/main/java/io/servicetalk/http/netty/H2ClientParentChannelInitializer.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Http2Settings.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Http2Settings.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Http2SettingsBuilder.java
Show resolved
Hide resolved
...alk-http-netty/src/main/java/io/servicetalk/http/netty/H2ClientParentChannelInitializer.java
Outdated
Show resolved
Hide resolved
...alk-http-netty/src/main/java/io/servicetalk/http/netty/H2ServerParentChannelInitializer.java
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ProtocolConfig.java
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ProtocolConfig.java
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ProtocolConfigBuilder.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ProtocolConfigBuilder.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Http2SettingsBuilder.java
Show resolved
Hide resolved
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.
Overall looks great, last findings:
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Http2Settings.java
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Http2SettingsBuilder.java
Outdated
Show resolved
Hide resolved
...alk-http-netty/src/main/java/io/servicetalk/http/netty/H2ClientParentChannelInitializer.java
Outdated
Show resolved
Hide resolved
...alk-http-netty/src/main/java/io/servicetalk/http/netty/H2ClientParentChannelInitializer.java
Show resolved
Hide resolved
...alk-http-netty/src/main/java/io/servicetalk/http/netty/H2ClientParentChannelInitializer.java
Outdated
Show resolved
Hide resolved
@@ -60,6 +61,35 @@ default String alpnId() { | |||
@Nullable | |||
KeepAlivePolicy keepAlivePolicy(); | |||
|
|||
/** | |||
* Get the {@link Http2Settings} that provides a hint for the initial settings. Note that some settings may be | |||
* ignored if not supported (e.g. push promise). |
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.
Consider clarifying that we throw an exception instead of ignoring
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.
the behavior may vary depending upon the use site and implementation, some settings maybe OK to ignore ... I don't think we need to over specify exception usage (illegal argument exception may always be thrown).
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ProtocolConfig.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Http2SettingsBuilder.java
Outdated
Show resolved
Hide resolved
build failure caused by #2345 |
Motivation: apple#2341 changed default HTTP/2 settings that client sends to notify the server it does not support Server Push. Modification: - Set `ENABLE_PUSH=0, MAX_CONCURRENT_STREAMS=0` in settings frame that client sends to a server; - Validate custom initial settings that users pass to `H2ProtocolConfig` and throw if users try to override ENABLE_PUSH/MAX_CONCURRENT_STREAMS on the client or set ENABLE_PUSH other than 0 for the server; - Include content message in GO_AWAY frame if client receives a Push Stream frame; Result: Default client behavior doesn't change, custom settings validated to prevent programming mistakes.
Motivation: #2341 changed default HTTP/2 settings that client sends to notify the server it does not support Server Push. Modification: - Set `ENABLE_PUSH=0, MAX_CONCURRENT_STREAMS=0` in settings frame that client sends to a server; - Validate custom initial settings that users pass to `H2ProtocolConfig` and throw if users try to override ENABLE_PUSH/MAX_CONCURRENT_STREAMS on the client or set ENABLE_PUSH other than 0 for the server; - Include content message in GO_AWAY frame if client receives a Push Stream frame; Result: Default client behavior doesn't change, custom settings validated to prevent programming mistakes.
Motivation: apple#2341 added 3 new methods on `H2ProtocolConfig` interface but didn't provide default implementations. Modifications: - Add default impls for `initialSettings()`, `flowControlQuantum()`, and `flowControlWindowIncrement()`; Result: `H2ProtocolConfig` is backward compatible with 0.42.16 release.
Motivation: apple#2341 added 3 new methods on `H2ProtocolConfig` interface but didn't provide default implementations. Modifications: - Add default impls for `initialSettings()`, `flowControlQuantum()`, and `flowControlWindowIncrement()`; Result: `H2ProtocolConfig` is backward compatible with 0.42.16 release.
Motivation: #2341 added 3 new methods on `H2ProtocolConfig` interface but didn't provide default implementations. Modifications: - Add default impls for `initialSettings()`, `flowControlQuantum()`, and `flowControlWindowIncrement()`; Result: `H2ProtocolConfig` is backward compatible with 0.42.16 release.
Motivaiton:
There is no way to define initial values for
http/2 settings.
Modifications:
set the initial settings values.
and 1mb default initial flow control window.