[−][src]Module tower_balance::pool
This module defines a load-balanced pool of services that adds new services when load is high.
The pool uses poll_ready as a signal indicating whether additional services should be spawned
to handle the current level of load. Specifically, every time poll_ready on the inner service
returns Ready, [Pool] consider that a 0, and every time it returns Pending, [Pool]
considers it a 1. [Pool] then maintains an exponential moving
average over those
samples, which gives an estimate of how often the underlying service has been ready when it was
needed "recently" (see [Builder::urgency]). If the service is loaded (see
[Builder::loaded_above]), a new service is created and added to the underlying [Balance].
If the service is underutilized (see [Builder::underutilized_below]) and there are two or
more services, then the latest added service is removed. In either case, the load estimate is
reset to its initial value (see [Builder::initial] to prevent services from being rapidly
added or removed.
Structs
| Builder | A builder that lets you configure how a [ |
| Pool | A dynamically sized, load-balanced pool of |
| PoolDiscoverer | A wrapper around |