Expand description
Adaptive concurrency control for Tower services.
This crate provides a ConcurrencyLimit middleware that dynamically
adjusts the number of in-flight requests based on observed latency, rather
than requiring a fixed limit chosen at deploy time. It is inspired by
Netflix’s concurrency-limits library and the TCP Vegas congestion control
algorithm.
§Quick start
use tower::ServiceBuilder;
use tower_acc::{ConcurrencyLimitLayer, Vegas};
let service = ServiceBuilder::new()
.layer(ConcurrencyLimitLayer::new(Vegas::default()))
.service(my_service);§Pluggable algorithms
The built-in Vegas algorithm works well for most workloads. To implement
a custom strategy, see the Algorithm trait.
Structs§
- Concurrency
Limit - Enforces an adaptive limit on the concurrent number of requests the underlying service can handle.
- Concurrency
Limit Layer - A
Layerthat wraps services with an adaptiveConcurrencyLimit. - Vegas
- TCP Vegas–inspired adaptive concurrency limit strategy.
Traits§
- Algorithm
- An algorithm that dynamically adjusts the maximum number of allowed concurrent requests based on the observed traffic.