2017-10-05 13:41:44 -07:00
|
|
|
[package]
|
|
|
|
name = "tower-balance"
|
2019-04-26 21:31:25 -07:00
|
|
|
# When releasing to crates.io:
|
|
|
|
# - Remove path dependencies
|
|
|
|
# - Update html_root_url.
|
|
|
|
# - Update doc url
|
|
|
|
# - Cargo.toml
|
|
|
|
# - README.md
|
|
|
|
# - Update CHANGELOG.md.
|
|
|
|
# - Create "v0.1.x" git tag.
|
2017-10-05 13:41:44 -07:00
|
|
|
version = "0.1.0"
|
2019-04-26 21:31:25 -07:00
|
|
|
authors = ["Tower Maintainers <team@tower-rs.com>"]
|
2019-04-09 10:59:30 -07:00
|
|
|
license = "MIT"
|
2019-04-26 22:31:07 -07:00
|
|
|
readme = "README.md"
|
|
|
|
repository = "https://github.com/tower-rs/tower"
|
|
|
|
homepage = "https://github.com/tower-rs/tower"
|
|
|
|
documentation = "https://docs.rs/tower-balance/0.1.0"
|
|
|
|
description = """
|
|
|
|
Balance load across a set of uniform services.
|
|
|
|
"""
|
|
|
|
categories = ["asynchronous", "network-programming"]
|
2019-04-08 20:11:09 -07:00
|
|
|
edition = "2018"
|
2019-04-26 21:31:25 -07:00
|
|
|
publish = false
|
2017-10-05 13:41:44 -07:00
|
|
|
|
2019-07-12 11:46:50 -07:00
|
|
|
[features]
|
|
|
|
log = ["tracing/log"]
|
|
|
|
default = ["log"]
|
|
|
|
|
2017-10-05 13:41:44 -07:00
|
|
|
[dependencies]
|
2019-04-26 21:31:25 -07:00
|
|
|
futures = "0.1.26"
|
|
|
|
indexmap = "1.0.2"
|
2019-07-12 11:46:50 -07:00
|
|
|
tracing = "0.1"
|
2019-04-26 21:31:25 -07:00
|
|
|
rand = "0.6.5"
|
2019-07-05 20:46:33 -07:00
|
|
|
tokio-sync = "0.1.3"
|
balance: Implement a Peak-EWMA load metric (#76)
The balancer provides an implementation of two load balancing strategies: RoundRobin and
P2C+LeastLoaded. The round-robin strategy is extremely simplistic and not sufficient for
most production systems. P2C+LL is a substantial improvement, but relies exclusively on
instantaneous information.
This change introduces P2C+PeakEWMA strategy. P2C+PE improves over P2C+LL by maintaining
an exponentially-weighted moving average of response latencies for each endpoint so that
the recent history directly factors into load balancing decisions. This technique was
pioneered by Finagle for use at Twitter. [Finagle's P2C+PE implementation][finagle] was
referenced heavily while developing this.
The provided demo can be used to illustrate the differences between load balacing
strategies. For example:
```
REQUESTS=50000
CONCURRENCY=50
ENDPOINT_CAPACITY=50
MAX_ENDPOINT_LATENCIES=[1ms, 10ms, 10ms, 10ms, 10ms, 100ms, 100ms, 100ms, 100ms, 1000ms, ]
P2C+PeakEWMA
wall 15s
p50 5ms
p90 56ms
p95 78ms
p99 96ms
p999 105ms
P2C+LeastLoaded
wall 18s
p50 5ms
p90 57ms
p95 80ms
p99 98ms
p999 857ms
RoundRobin
wall 72s
p50 9ms
p90 98ms
p95 496ms
p99 906ms
p999 988ms
````
[numbers]: https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
[finagle]: https://github.com/twitter/finagle/blob/9cc08d15216497bb03a1cafda96b7266cfbbcff1/finagle-core/src/main/scala/com/twitter/finagle/loadbalancer/PeakEwma.scala
2018-06-06 23:16:49 -07:00
|
|
|
tokio-timer = "0.2.4"
|
2019-04-26 21:31:25 -07:00
|
|
|
tower-discover = "0.1.0"
|
2019-06-04 13:59:47 -07:00
|
|
|
tower-layer = "0.1.0"
|
2019-05-29 10:32:02 -07:00
|
|
|
tower-load = { version = "0.1.0", path = "../tower-load" }
|
|
|
|
tower-service = "0.2.0"
|
2019-04-26 21:31:25 -07:00
|
|
|
tower-util = "0.1.0"
|
2018-01-24 12:18:12 -08:00
|
|
|
|
|
|
|
[dev-dependencies]
|
2019-07-12 11:46:50 -07:00
|
|
|
tracing-fmt = { git = "https://github.com/tokio-rs/tracing.git" }
|
2019-07-05 14:10:11 -07:00
|
|
|
hdrhistogram = "6.0"
|
2018-02-23 20:24:22 -08:00
|
|
|
quickcheck = { version = "0.6", default-features = false }
|
balance: Implement a Peak-EWMA load metric (#76)
The balancer provides an implementation of two load balancing strategies: RoundRobin and
P2C+LeastLoaded. The round-robin strategy is extremely simplistic and not sufficient for
most production systems. P2C+LL is a substantial improvement, but relies exclusively on
instantaneous information.
This change introduces P2C+PeakEWMA strategy. P2C+PE improves over P2C+LL by maintaining
an exponentially-weighted moving average of response latencies for each endpoint so that
the recent history directly factors into load balancing decisions. This technique was
pioneered by Finagle for use at Twitter. [Finagle's P2C+PE implementation][finagle] was
referenced heavily while developing this.
The provided demo can be used to illustrate the differences between load balacing
strategies. For example:
```
REQUESTS=50000
CONCURRENCY=50
ENDPOINT_CAPACITY=50
MAX_ENDPOINT_LATENCIES=[1ms, 10ms, 10ms, 10ms, 10ms, 100ms, 100ms, 100ms, 100ms, 1000ms, ]
P2C+PeakEWMA
wall 15s
p50 5ms
p90 56ms
p95 78ms
p99 96ms
p999 105ms
P2C+LeastLoaded
wall 18s
p50 5ms
p90 57ms
p95 80ms
p99 98ms
p999 857ms
RoundRobin
wall 72s
p50 9ms
p90 98ms
p95 496ms
p99 906ms
p999 988ms
````
[numbers]: https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
[finagle]: https://github.com/twitter/finagle/blob/9cc08d15216497bb03a1cafda96b7266cfbbcff1/finagle-core/src/main/scala/com/twitter/finagle/loadbalancer/PeakEwma.scala
2018-06-06 23:16:49 -07:00
|
|
|
tokio = "0.1.7"
|
|
|
|
tokio-executor = "0.1.2"
|
2019-07-05 20:46:33 -07:00
|
|
|
tower = { version = "*", path = "../tower" }
|
|
|
|
tower-buffer = { version = "*", path = "../tower-buffer" }
|
|
|
|
tower-limit = { version = "*", path = "../tower-limit" }
|
|
|
|
tower-test = { version = "*", path = "../tower-test" }
|