Commit graph

138 commits

Author SHA1 Message Date
Yuchen Wu
5397e2bd56 Change from debug to display when socket mismatch happens
The display format contains more useful info.
2024-07-12 11:24:29 -07:00
Yuchen Wu
0035064d04 Provide a group key for connection reuse isolation 2024-07-12 11:24:29 -07:00
Yuchen Wu
cdefa5c431 Mark the error source from get_http_session()
Although it is implied that fail_to_connect() errors are already caused
by upstream connections, it is more clear for the user's code inside this callback
by marking the error source in this case.
2024-07-12 11:24:29 -07:00
Yuchen Wu
65b1d6c733 Invoke request_body_filter of modules for proxies 2024-07-12 11:24:29 -07:00
Yuchen Wu
ee7f66082f Allow to create a new connection when the current one is shutting down
When we see a GOAWAY(NO_ERROR), the connector no longer fail the entire request.
Now the connector creates a new connection instead.
2024-07-12 11:24:29 -07:00
Matthew Gumport
38a9d556b5 make seeded estimator and plumbing for tests
I started fidgeting with another one of the tests breaking because of the
estimator not being deterministic, and then decided to do this another way.

This adds `seeded` and `seeded_compact` constructors to the estimator which are
used in tests to override the LFU. These are hidden behind `cfg(test)`. The
`random_status` field of the UFO object is also overridden with the same seeds
as used for the seeded LFU.

These make the tests pass consistently without requiring further monkeying.
2024-06-28 12:34:25 -07:00
Edward Wang
a483902c46 Change max allowed resp headers in HeaderSerde to match H1 max
Currently the allowed max is hardcoded, the HeaderSerde should match the
H1 max count to avoid problems deserializing from cache.
2024-06-28 12:34:25 -07:00
Kevin Guthrie
c67b5d0141 Add a replacement cli-parsing function for Opt that can be used in quickstart with no external dependencies 2024-06-28 12:34:25 -07:00
Wladimir Palant
86e6cd2912 Fixes #261 - Better Default implementation for Opt
---
Empty commit to trigger checks again
---
Another empty commit to trigger checks

Includes-commit: 0e9d853e05
Includes-commit: 1237b26493
Includes-commit: 6fdaf38b63
Replicated-from: https://github.com/cloudflare/pingora/pull/272
2024-06-28 12:34:25 -07:00
Andrew Hauck
ace9d4f135 Update comments on digest functions 2024-06-28 12:34:25 -07:00
Wladimir Palant
23c0378ce6 Fixes #270 - Add Session::digest_mut() method
Includes-commit: 5dd90aadd2
Replicated-from: https://github.com/cloudflare/pingora/pull/271
2024-06-28 12:34:25 -07:00
Yuchen Wu
92bbeb1139 Parse UDS with prefix
Now UDS can be parsed from string with prefix "unix:". The raw path
support will be deprecated.

From https://github.com/cloudflare/pingora/pull/141

Co-authored-by: blackanger <blackanger.z@gmail.com>
2024-06-28 12:34:25 -07:00
Yuchen Wu
62ddb7ebae Move adding ResponseCompression module logic to init_downstream_modules
So that users can override this behavior.
2024-06-28 12:34:25 -07:00
Wladimir Palant
dda7bec58c Added init_downstream_modules phase allowing modules to be set up before startup
Includes-commit: 1bf3d4dfea
Replicated-from: https://github.com/cloudflare/pingora/pull/284
2024-06-28 12:34:25 -07:00
Yuchen Wu
1176af300b Make type alias http::Module public
Easier for 3rd party to implement the trait.
2024-06-28 12:34:25 -07:00
Yuchen Wu
f9148430db Report evction/invalidtion types
This helps the storage to log/track different type of cache deletions.
2024-06-28 12:34:25 -07:00
Edward Wang
03bd29044e Always respect_keepalive when releasing http session
When a user calls `release_http_session` on an http Connector, it is
usually implied that they intend to reuse the underlying connection if
possible. Previously for H1 this involved reaching into the H1 client
Session and calling `respect_keepalive`. The new behavior always
respects keepalive as part of releasing the http session, as it was very
easy to overlook this step and unintentionally disable connection reuse
for H1 sessions.
2024-06-28 12:34:25 -07:00
Andrew Hauck
fbf3a95749 Add a write timeout to write body buf and an option to set a minimum send rate 2024-06-28 12:34:25 -07:00
Edward Wang
6e83d51ab1 Add is_hit fn to RTCache CacheStatus 2024-06-28 12:34:25 -07:00
Yuchen Wu
c0b23c6736 Expose a few more TLS APIs 2024-06-28 12:34:25 -07:00
Wladimir Palant
05005e2a4d Fixes #234 - Clarify ServerConf documentation
Includes-commit: d9a37a1f38
Replicated-from: https://github.com/cloudflare/pingora/pull/273
2024-06-21 09:54:09 -07:00
Matthew Gumport
c943fc1c78 compression: allow setting level per algorithm
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.
2024-06-21 09:54:09 -07:00
Edward Wang
9500e62855 Make ipv6_only flag an Option<bool>
Fixes #279. This allows falling back to the system default on None, or
explicitly setting false if the system default happens to be true.
2024-06-21 09:54:09 -07:00
Matthew Gumport
899d86c5d4 change tinyufo test to be deterministic
Previously the test would fail because the item evicted may be the entry (4,4,1)
failing admission. I adjusted the weights so that all weights for items besides
the one we want moved to the main cache are equal and the cache can only hold
three. The test then checks that 1 is moved to the main, the evicted key is
gone, and the other two are present.
2024-06-21 09:54:09 -07:00
Edward Wang
02111515c6 Expose TCP_INFO fields as pub 2024-06-21 09:54:09 -07:00
Andrew Hauck
a1f1ad8a43 h2c support 2024-06-21 09:54:09 -07:00
Wladimir Palant
2d30077683 Fixed typo in docs: connnection => connection
Includes-commit: bbef4bdd75
Replicated-from: https://github.com/cloudflare/pingora/pull/274
2024-06-21 09:54:09 -07:00
Yuchen Wu
4e251f663a Fxi clippy for Rust 1.79 2024-06-21 09:54:09 -07:00
Yuchen Wu
708e03211d Auto generate the size and verify it for setsockops calls
This avoids human error with stronger validation.
2024-06-21 09:54:09 -07:00
Ivan Babrou
bf07ed3f10 add get_socket_cookie helper
This cab be used for tracing to match the sockets in the kernel.
2024-06-21 09:54:09 -07:00
Andrew Hauck
d86c5855a0 Track write duration on Poll::Ready(Err) 2024-06-21 09:54:09 -07:00
Andrew Hauck
35b9f1db00 Remove Accept-Ranges header when response is compressed 2024-06-21 09:54:09 -07:00
James Munns
a432c2da9b Fix a couple of typos/grammar issues 2024-06-14 16:00:03 -07:00
Andrew Hauck
70b027e9f8 Add trait for converting Options to Errors 2024-06-14 16:00:03 -07:00
Alex Severin
20cac2e673 expose new_uds err 2024-06-14 16:00:03 -07:00
Gideon Tong
4d6690ec53 Update bleeper 2024-06-14 10:27:45 -07:00
Yuchen Wu
31d7b63ed7 Add new_h1() back
This function turns out to be actually useful for testing and mocking
2024-06-07 15:42:30 -04:00
Yuchen Wu
8a8302cf7b Respect the keepalive setting sent in HTTP client
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.
2024-06-07 15:42:30 -04:00
Yuchen Wu
11863d27a2 Introduce HttpModules to pingora-proxy.
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.
2024-06-07 15:42:30 -04:00
Yuchen Wu
53e696d1dd Faster remove_header() call.
It saves one lookup when the header to remove is not in the map.
Micro-benchmark shows about 40% speedup.
2024-06-07 15:42:30 -04:00
Zaidoon Abd Al Hadi
e3c655b781 update CacheKey to allow overriding primary key hash 2024-06-07 15:42:30 -04:00
Yuchen Wu
216d8e9d92 Pin triomphe to keep our MSRV 2024-05-31 11:04:36 -07:00
Wladimir Palant
b7ac8a50fc Fixes #231 - Remove Markdown code from the long CLI help
---
While at it, fix grammar in the description of the --daemon flag

Includes-commit: a8dee4e975
Includes-commit: f420f36c53
Replicated-from: https://github.com/cloudflare/pingora/pull/247
2024-05-31 11:04:36 -07:00
Alex Severin
d41231191c finish todo
---
reafactor

Includes-commit: 41ca473605
Includes-commit: f5870a985c
Replicated-from: https://github.com/cloudflare/pingora/pull/215
2024-05-31 11:04:36 -07:00
Andrew Hauck
4579a780c6 get_tcp_info and get_recv_buf should return None for UDS 2024-05-31 11:04:36 -07:00
Yuchen Wu
fa071eb506 Refactor Service API: Arc is no longer needed for apps.
This change makes a bit cleaner to use the API. It also allows to
modify the application logic before starting the service.
2024-05-31 11:04:36 -07:00
Yuchen Wu
4019aa0819 Simplify vectored write API
Provide a write_vec_all() API so that users don't have to loop
themselves.
2024-05-31 11:04:36 -07:00
Yuchen Wu
ea1db2fb9d Add read and write pending time info
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.
2024-05-31 11:04:36 -07:00
Andrew Hauck
47844a7ea4 Add ability to get TCP_INFO through SocketDigest, add get_recv_buf function 2024-05-31 11:04:36 -07:00
Yuchen Wu
2902dc5365 Redesign the API of HTTP module
Make it async and more natural.
2024-05-31 11:04:36 -07:00