Skip to content
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

Extract tower-load from tower-balance #285

Merged
merged 5 commits into from
May 29, 2019
Merged

Conversation

olix0r
Copy link
Collaborator

@olix0r olix0r commented May 28, 2019

The tower-balance crate includes the Load and Instrument traits,
which are likely useful outside of balancers; and certainly have no
tight coulping with any specific balancer implementation. This change
extracts these protocol-agnostic traits into a dedicated crate.

The Load trait includes a latency-aware PeakEWMA load strategy as
well as a simple PendingRequests strategy for latency-agnostic
applications.

The Instrument trait is used by both of these strategies to track
in-flight requests without knowing protocol details. It is expected that
protocol-specific crates will provide, for instance, HTTP
time-to-first-byte latency strategies.

A default NoInstrument implementation tracks the a request until its
response future is satisfied.

This crate should only be published once tower-balance is published.

The tower-balance crate includes the `Load` and `Instrument` traits,
which are likely useful outside of balancers; and certainly have no
tight coulping with any specific balancer implementation. This change
extracts these protocol-agnostic traits into a dedicated crate.

The `Load` trait includes a latency-aware _PeakEWMA_ load strategy as
well as a simple _PendingRequests_ strategy for latency-agnostic
applications.

The `Instrument` trait is used by both of these strategies to track
in-flight requests without knowing protocol details. It is expected that
protocol-specific crates will provide, for instance, HTTP
time-to-first-byte latency strategies.

A default `NoInstrument` implementation tracks the a request until its
response future is satisfied.

This crate should only be published once tower-balance is published.
@olix0r olix0r marked this pull request as ready for review May 29, 2019 16:58
@olix0r olix0r requested a review from carllerche May 29, 2019 16:58
@olix0r olix0r self-assigned this May 29, 2019
Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one minor thought inline.

tower-load/src/lib.rs Outdated Show resolved Hide resolved
@olix0r olix0r merged commit a496fbf into tower-rs:master May 29, 2019
@olix0r olix0r deleted the ver/tower-load branch May 29, 2019 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants