Skip to content

Commit

Permalink
balance: Add a p2c Pool implementation (#2541)
Browse files Browse the repository at this point in the history
Following #2540, which introduces a new PoolQueue and Pool interface,
this change introduces a P2cPool implementation that replaces
Tower's p2c balancer (using the same underlying ReadyCache and p2c
implementations).

This balancer implementation is currently unused. It will be integrated
in a follow-up change.
  • Loading branch information
olix0r authored Dec 5, 2023
1 parent f920e6c commit f72cc7f
Show file tree
Hide file tree
Showing 5 changed files with 451 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1677,20 +1677,27 @@ dependencies = [
name = "linkerd-proxy-balance"
version = "0.1.0"
dependencies = [
"ahash",
"futures",
"futures-util",
"indexmap",
"linkerd-error",
"linkerd-metrics",
"linkerd-proxy-core",
"linkerd-proxy-pool",
"linkerd-stack",
"linkerd-tracing",
"parking_lot",
"pin-project",
"quickcheck",
"rand",
"thiserror",
"tokio",
"tokio-stream",
"tokio-test",
"tokio-util",
"tower",
"tower-test",
"tracing",
]

Expand Down
11 changes: 10 additions & 1 deletion linkerd/proxy/balance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ license = "Apache-2.0"
publish = false

[dependencies]
ahash = "0.8"
futures = { version = "0.3", default-features = false }
futures-util = "0.3"
indexmap = "1"
linkerd-error = { path = "../../error" }
linkerd-metrics = { path = "../../metrics" }
linkerd-proxy-core = { path = "../core" }
linkerd-proxy-pool = { path = "../pool" }
linkerd-stack = { path = "../../stack" }
parking_lot = "0.12"
pin-project = "1"
rand = "0.8"
thiserror = "1"
Expand All @@ -24,4 +27,10 @@ tracing = "0.1"
[dependencies.tower]
version = "0.4.13"
default-features = false
features = ["balance", "discover", "load"]
features = ["balance", "load", "ready-cache"]

[dev-dependencies]
linkerd-tracing = { path = "../../tracing" }
tokio-test = "0.4"
tower-test = "0.4"
quickcheck = { version = "1", default-features = false }
2 changes: 2 additions & 0 deletions linkerd/proxy/balance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ use tower::{

mod discover;
mod gauge_endpoints;
mod pool;

pub use self::{
discover::DiscoveryStreamOverflow,
gauge_endpoints::{EndpointsGauges, NewGaugeEndpoints},
pool::P2cPool,
};
pub use tower::load::peak_ewma::Handle;

Expand Down
4 changes: 4 additions & 0 deletions linkerd/proxy/balance/src/pool.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mod p2c;

pub use self::p2c::P2cPool;
pub use linkerd_proxy_pool::{Pool, Update};
Loading

0 comments on commit f72cc7f

Please sign in to comment.