Fixes https://github.com/cloudflare/pingora/issues/228
This adds a function to set the compression level per supported algorithm. The
behavior of `adjust_level` is changed to set the level for all of the algorithms
such that it still behaves the same.
Before this change, a HTTP client would only respect
the Connection header returned from the server.
Now, if the client sends "Connection: closed", it would not
keepalive regardless what the server returns.
This feature allows to plug in 3rd party extensions with minimal code
required.
The downstream compression logic is now a module.
Add: a new early_request_filter API to fine tune the behavior of the modules.
Add: a few APIs to write the response with these modules enabled. This
should address issues like compression is not applied to custom
responses.
These APIs show how much time a socket spends on waiting for data and
the time waiting for data to be sent. They are good indicators of
performance bottlenecks.
It is possible that when two threads try to release streams of the same
h2 connection, one thread would register the connection in the in_use_pool
while the other register it in the idle_pool.
The solution is to put a lock so that the connection can only appear in
one pool at a time.
Provide default and non_exhaustive for TcpSocketOptions to future proof
its changes.
Also fix an issue that TcpScoketOptions can't be used for IPv4 sockets
at all.
SO_RCVBUF needs to be set before connect otherwise tcp settings will
not be finalized correctly. And since autotuning is not engaged in this
case, the throughput will suffer.
Define `group_id` in the pingora-core's server daemon on FreeBSD.
---
Merge branch 'cloudflare:main' into yonas-~~~
Co-authored-by: Yonas Yanfa <yonas.y@gmail.com>
Includes-commit: 30ee1e8bd4
Includes-commit: df9f2da7bd
Replicated-from: https://github.com/cloudflare/pingora/pull/28
https://github.com/cloudflare/pingora/issues/181
Ran:
```
rg --pcre2 '(?<!(trace\!\()|(println\!\()|(warn\!\()|(info\!\()|(debug\!\()|(format\!\()|(error\!\()|(write\!\()|(panic\!\())\".*\{.+\"'
```
and audited the 200+ results by hand. Only messed up in a few places!
Hat-tip to Kevin for helping me understand the compile error messages I was
seeing trying to fix this naively.