-
Notifications
You must be signed in to change notification settings - Fork 271
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
Introduce a backpressure-propagating buffer #451
Conversation
@carllerche's feedback is that the delay-based probing may be unnecessary if inner services are responsible for notifying the task when they need to change (even when they return Ready). |
The tower buffer implementation uses the underlying channel for backpressure. This admits requests before the inner service becomes ready, and doesn't fully propagate error conditions. This replacement buffer implementation exposes readiness via a `Watch`. This prevents callers from sending requests when the inner service is not ready and allows service errors to be propagated reliably. The buffer's background task drops the inner service as soon as it fails. The effect of this is that the buffer's channel is only used for requests that race to submit requests while the inner service is ready, and so it seems likely that they only need enough slots to satisfy the proxy's expected concurrency (i.e. in terms of cores).
I've removed the probing logic from the buffer and moved it into a dedicated middleware -- there's no reason it needs to be coupled to the buffer. |
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.
overall, this looks good to me...i had a thought about how we drive the inner service's response future, if you're interested, although i'm not sure whether or not it has that big an impact.
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.
looks great! 🙌
.as_mut() | ||
.expect("Service must not be dropped") | ||
.call(request); | ||
let _ = tx.send(Ok(fut)); |
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.
how often do we think requesters will hang up after requests are dispatched? is this something that we would want to record a TRACE/DEBUG event for?
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.
This will happen whenever a request is canceled (i.e. the client resets the stream or drops the connection). Could go either way
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.
Change looks awesome! I have a question about when an inner service errors, but otherwise looks good.
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.
👍
This release builds on changes in the prior release to ensure that balancers process updates eagerly. Cache capacity limitations have been removed; and services now fail eagerly, rather than making all requests wait for the timeout to expire. Also, a bug was fixed in the way the `LINKERD2_PROXY_LOG` env variable is parsed. --- * Introduce a backpressure-propagating buffer (linkerd/linkerd2-proxy#451) * trace: update tracing-subscriber to 0.2.3 (linkerd/linkerd2-proxy#455) * timeout: Introduce FailFast, Idle, and Probe middlewares (linkerd/linkerd2-proxy#452) * cache: Let services self-evict (linkerd/linkerd2-proxy#456)
This release builds on changes in the prior release to ensure that balancers process updates eagerly. Cache capacity limitations have been removed; and services now fail eagerly, rather than making all requests wait for the timeout to expire. Also, a bug was fixed in the way the `LINKERD2_PROXY_LOG` env variable is parsed. --- * Introduce a backpressure-propagating buffer (linkerd/linkerd2-proxy#451) * trace: update tracing-subscriber to 0.2.3 (linkerd/linkerd2-proxy#455) * timeout: Introduce FailFast, Idle, and Probe middlewares (linkerd/linkerd2-proxy#452) * cache: Let services self-evict (linkerd/linkerd2-proxy#456)
The tower buffer implementation uses the underlying channel for
backpressure. This admits requests before the inner service becomes
ready, and doesn't fully propagate error conditions.
This replacement buffer implementation exposes readiness via a
Watch
.This prevents callers from sending requests when the inner service is
not ready and allows service errors to be propagated reliably. The
buffer's background task drops the inner service as soon as it fails.
The effect of this is that the buffer's channel is only used for
requests that race to submit requests while the inner service is ready,
and so it seems likely that they only need enough slots to satisfy the
proxy's expected concurrency (i.e. in terms of cores).