You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add compression support for reactor-netty http2 client (#26381)
## Description
1. add data compression support for http2. zstd only for better
performance.
2. all parameters are configurable
3. will only be enabled if configured properly
4. work together with #26382
## Motivation and Context
1. when communicating with cpp worker via http2, coordinator will
compress both the header and body and will also receive compressed
response. We see great compression ratio for payload greater than 8 kB.
## Impact
<!---Describe any public API or user-facing feature change or any
performance impact-->
## Test Plan
1. passed verifier run
## Contributor checklist
- [ ] Please make sure your submission complies with our [contributing
guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md),
in particular [code
style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style)
and [commit
standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards).
- [ ] PR description addresses the issue accurately and concisely. If
the change is non-trivial, a GitHub Issue is referenced.
- [ ] Documented new properties (with its default value), SQL syntax,
functions, or other functionality.
- [ ] If release notes are required, they follow the [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines).
- [ ] Adequate tests were added if applicable.
- [ ] CI passed.
- [ ] If adding new dependencies, verified they have an [OpenSSF
Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or
higher (or obtained explicit TSC approval for lower scores).
## Release Notes
Please follow [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines)
and fill in the release notes below.
```
== RELEASE NOTES ==
General Changes
* Add data compression support for http2 protocol
```
@@ -114,11 +127,11 @@ public ReactorNettyHttpClient(ReactorNettyHttpClientConfig config, HttpClientCon
114
127
if (os.toLowerCase(Locale.ENGLISH).contains("linux")) {
115
128
// Make sure Open ssl is available for linux deployments
116
129
if (!OpenSsl.isAvailable()) {
117
-
thrownewUnsupportedOperationException(format("OpenSsl is not unavailable. Stacktrace: %s", Arrays.toString(OpenSsl.unavailabilityCause().getStackTrace()).replace(',', '\n')));
130
+
thrownewUnsupportedOperationException(format("OpenSsl is not available. Stacktrace: %s", Arrays.toString(OpenSsl.unavailabilityCause().getStackTrace()).replace(',', '\n')));
118
131
}
119
132
// Make sure epoll threads are used for linux deployments
120
133
if (!Epoll.isAvailable()) {
121
-
thrownewUnsupportedOperationException(format("Epoll is not unavailable. Stacktrace: %s", Arrays.toString(Epoll.unavailabilityCause().getStackTrace()).replace(',', '\n')));
134
+
thrownewUnsupportedOperationException(format("Epoll is not available. Stacktrace: %s", Arrays.toString(Epoll.unavailabilityCause().getStackTrace()).replace(',', '\n')));
122
135
}
123
136
}
124
137
@@ -166,9 +179,10 @@ public ReactorNettyHttpClient(ReactorNettyHttpClientConfig config, HttpClientCon
166
179
167
180
// Create HTTP/2 client
168
181
SslContextfinalSslContext = sslContext;
182
+
169
183
this.httpClient = HttpClient
170
-
// The custom pool is wrapped with a HttpConnectionProvider over here
171
-
.create(pool)
184
+
.create(pool) // The custom pool is wrapped with a HttpConnectionProvider over here
185
+
.compress(false) // we will enable response compression manually
172
186
.protocol(HttpProtocol.H2, HttpProtocol.HTTP11)
173
187
.runOn(loopResources, true)
174
188
.http2Settings(settings -> {
@@ -179,6 +193,9 @@ public ReactorNettyHttpClient(ReactorNettyHttpClientConfig config, HttpClientCon
0 commit comments