-
Notifications
You must be signed in to change notification settings - Fork 278
Eliminate Bind & Listen traits #584
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We have some abstractions, like the `Bind` and `Listen` traits, that don't really serve a purpose. Each have only a single implementation in our codebase. And, furthermor, the `Listen` trait is better-represented as a `Stream` (so that we can use general tools with it). This change eliminates these traits and modifies the implementation to use `async-stream` to take advantage of `async/await` syntax. Similarly, the logic of `listen::Serve` is now directly implemented in the `serve` task. The `proxy::cor::listen` module has been replaced by an `accept` module. All of this helps us cut down on unnecessary types and helps to consolidate logic (rather than having it spread across many crates).
hawkw
reviewed
Jun 27, 2020
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.
It looks like some integration tests that still reference the removed traits are failing to compile.
This change ensures that the accept service's readiness can't block shutdown.
hawkw
approved these changes
Jun 30, 2020
kleimkuhler
approved these changes
Jun 30, 2020
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.
👍
olix0r
added a commit
to linkerd/linkerd2
that referenced
this pull request
Jul 2, 2020
This release increases the default buffer size to match the proxy's in-flight request limit. This reduces contention in overload--especially high-concurrency--situations, substantially reducing tail latency. --- * update test-support clients and servers to be natively async (linkerd/linkerd2-proxy#580) * Print build diagnostics in docker (linkerd/linkerd2-proxy#583) * update test controllers to std::future/Tonic; remove threads (linkerd/linkerd2-proxy#585) * buffer: Box the inner service's reponse future (linkerd/linkerd2-proxy#586) * Eliminate Bind & Listen traits (linkerd/linkerd2-proxy#584) * cache: replace Lock with Buffer (linkerd/linkerd2-proxy#587)
cpretzer
pushed a commit
to linkerd/linkerd2
that referenced
this pull request
Jul 2, 2020
This release increases the default buffer size to match the proxy's in-flight request limit. This reduces contention in overload--especially high-concurrency--situations, substantially reducing tail latency. --- * update test-support clients and servers to be natively async (linkerd/linkerd2-proxy#580) * Print build diagnostics in docker (linkerd/linkerd2-proxy#583) * update test controllers to std::future/Tonic; remove threads (linkerd/linkerd2-proxy#585) * buffer: Box the inner service's reponse future (linkerd/linkerd2-proxy#586) * Eliminate Bind & Listen traits (linkerd/linkerd2-proxy#584) * cache: replace Lock with Buffer (linkerd/linkerd2-proxy#587)
cratelyn
added a commit
that referenced
this pull request
Mar 14, 2025
this commit updates our tower dependency from 0.4 to 0.5. note that this commit does not affect the `tower-service` and `tower-layer` crates, reëxported by `tower` itself. the `Service<T>` trait and the closely related `Layer<S>` trait have not been changed. the `tower` crate's utilities have changed in various ways, some of particular note for the linkerd2 proxy. see these items, excerpted from the tower changelog: - **retry**: **Breaking Change** `retry::Policy::retry` now accepts `&mut Req` and `&mut Res` instead of the previous mutable versions. This increases the flexibility of the retry policy. To update, update your method signature to include `mut` for both parameters. ([#584]) - **retry**: **Breaking Change** Change Policy to accept &mut self ([#681]) - **retry**: Add generic backoff utilities ([#685]) - **retry**: **Breaking Change** `Budget` is now a trait. This allows end-users to implement their own budget and bucket implementations. ([#703]) - **util**: **Breaking Change** `Either::A` and `Either::B` have been renamed `Either::Left` and `Either::Right`, respectively. ([#637]) - **util**: **Breaking Change** `Either` now requires its two services to have the same error type. ([#637]) - **util**: **Breaking Change** `Either` no longer implemenmts `Future`. ([#637]) - **buffer**: **Breaking Change** `Buffer<S, Request>` is now generic over `Buffer<Request, S::Future>.` ([#654]) the `Either` trait bounds are particularly impactful for us. * <tower-rs/tower@v0.4.x...master> * <https://github.com/tower-rs/tower/blob/master/tower/CHANGELOG.md> * <tower-rs/tower#815> * <tower-rs/tower#817> * <tower-rs/tower#818> this work is based upon #3504. for more information, see: * linkerd/linkerd2#8733 * #3504 Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn
added a commit
that referenced
this pull request
Mar 14, 2025
this commit updates our tower dependency from 0.4 to 0.5. note that this commit does not affect the `tower-service` and `tower-layer` crates, reëxported by `tower` itself. the `Service<T>` trait and the closely related `Layer<S>` trait have not been changed. the `tower` crate's utilities have changed in various ways, some of particular note for the linkerd2 proxy. see these items, excerpted from the tower changelog: - **retry**: **Breaking Change** `retry::Policy::retry` now accepts `&mut Req` and `&mut Res` instead of the previous mutable versions. This increases the flexibility of the retry policy. To update, update your method signature to include `mut` for both parameters. ([#584]) - **retry**: **Breaking Change** Change Policy to accept &mut self ([#681]) - **retry**: **Breaking Change** `Budget` is now a trait. This allows end-users to implement their own budget and bucket implementations. ([#703]) - **util**: **Breaking Change** `Either::A` and `Either::B` have been renamed `Either::Left` and `Either::Right`, respectively. ([#637]) - **util**: **Breaking Change** `Either` now requires its two services to have the same error type. ([#637]) - **util**: **Breaking Change** `Either` no longer implemenmts `Future`. ([#637]) - **buffer**: **Breaking Change** `Buffer<S, Request>` is now generic over `Buffer<Request, S::Future>.` ([#654]) see: * <tower-rs/tower#584> * <tower-rs/tower#681> * <tower-rs/tower#703> * <tower-rs/tower#637> * <tower-rs/tower#654> the `Either` trait bounds are particularly impactful for us. because this runs counter to how we treat errors (skewing towards boxed errors, in general), we temporarily vendor a version of `Either` from the 0.4 release, whose variants have been renamed to match the 0.5 interface. updating to box the inner `A` and `B` services' errors, so we satiate the new `A::Error = B::Error` bounds, can be addressed as a follow-on. that's intentionally left as a separate change, due to the net size of our patchset between this branch and #3504. * <tower-rs/tower@v0.4.x...master> * <https://github.com/tower-rs/tower/blob/master/tower/CHANGELOG.md> this work is based upon #3504. for more information, see: * linkerd/linkerd2#8733 * #3504 Signed-off-by: katelyn martin <kate@buoyant.io> X-Ref: tower-rs/tower#815 X-Ref: tower-rs/tower#817 X-Ref: tower-rs/tower#818 X-Ref: tower-rs/tower#819
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have some abstractions, like the
Bind
andListen
traits, thatdon't really serve a purpose. Each have only a single implementation in
our codebase. And, furthermor, the
Listen
trait is better-representedas a
Stream
(so that we can use general tools with it).This change eliminates these traits and modifies the implementation to
use
async-stream
to take advantage ofasync/await
syntax. Similarly,the logic of
listen::Serve
is now directly implemented in theserve
task. The
proxy::cor::listen
module has been replaced by anaccept
module.
All of this helps us cut down on unnecessary types and helps to
consolidate logic (rather than having it spread across many crates).