Skip to content

Commit

Permalink
balance: remove Pool (#658)
Browse files Browse the repository at this point in the history
Per #456, there are a number of issues with the `balance::Pool` API that
limit its usability, and it isn't widely used. In the discussion on that
issue, we agreed that it should probably just be removed in 0.5 --- it
can be replaced with something more useful later.

This branch removes `balance::Pool`.

CLoses #456.
  • Loading branch information
hawkw committed Mar 31, 2022
1 parent cc9e5be commit 71292ee
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 669 deletions.
21 changes: 5 additions & 16 deletions tower/src/balance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@
//! Otherwise, clients could see spikes in latency if their request goes to a particularly loaded
//! service, even when spare capacity is available to handle that request elsewhere.
//!
//! This module provides two pieces of middleware that helps with this type of load balancing:
//!
//! First, [`p2c`] implements the "[Power of Two Random Choices]" algorithm, a simple but robust
//! technique for spreading load across services with only inexact load measurements. Use this if
//! the set of available services is not within your control, and you simply want to spread load
//! among that set of services.
//! This module provides the [`p2c`] middleware, which implements the "[Power of
//! Two Random Choices]" algorithm. This is a simple but robust technique for
//! spreading load across services with only inexact load measurements. Use this
//! if the set of available services is not within your control, and you simply
//! want to spread load among that set of services.
//!
//! [Power of Two Random Choices]: http://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf
//!
//! Second, [`pool`] implements a dynamically sized pool of services. It estimates the overall
//! current load by tracking successful and unsuccessful calls to [`poll_ready`], and uses an
//! exponentially weighted moving average to add (using [`MakeService`]) or remove (by dropping)
//! services in response to increases or decreases in load. Use this if you are able to
//! dynamically add more service endpoints to the system to handle added load.
//!
//! # Examples
//!
//! ```rust
Expand Down Expand Up @@ -52,10 +45,6 @@
//! }
//! # }
//! ```
//!
//! [`MakeService`]: crate::MakeService
//! [`poll_ready`]: crate::Service::poll_ready

pub mod error;
pub mod p2c;
pub mod pool;
4 changes: 0 additions & 4 deletions tower/src/balance/p2c/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@ where
let (_, svc) = self.services.get_ready_index(index).expect("invalid index");
svc.load()
}

pub(crate) fn discover_mut(&mut self) -> &mut D {
&mut self.discover
}
}

impl<D, Req> Service<Req> for Balance<D, Req>
Expand Down
Loading

0 comments on commit 71292ee

Please sign in to comment.