https://github.com/getlantern/balancer
Connection balancer library for Go
https://github.com/getlantern/balancer
Last synced: 8 months ago
JSON representation
Connection balancer library for Go
- Host: GitHub
- URL: https://github.com/getlantern/balancer
- Owner: getlantern
- License: apache-2.0
- Created: 2014-11-21T23:44:19.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T17:35:58.000Z (over 8 years ago)
- Last Synced: 2024-06-19T05:58:21.655Z (almost 2 years ago)
- Language: Go
- Size: 45.9 KB
- Stars: 5
- Watchers: 19
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
balancer [](https://travis-ci.org/getlantern/balancer) [](https://coveralls.io/r/getlantern/balancer) [](http://godoc.org/github.com/getlantern/balancer)
==========
Connection balancer library for Go
To install:
`go get github.com/getlantern/balancer`
For docs:
`godoc github.com/getlantern/balancer`
===Benchmark
`go test -bench .` to evaluate performance of different strategy to pick
dialer. `Sticky` and `QualityFirst` strategy seems has better result at this
moment.
Example output:
```
BenchmarkQualityFirst-4 100000 23222 ns/op
--- BENCH: BenchmarkQualityFirst-4
benchmark_test.go:98: '1%': 83/16850, '10%': 199/3596, '99%': 228/524, fail/total = 510/20970 (2.4%) in 10000 runs
benchmark_test.go:98: '1% 10ns±8ns': 85/18319, '10% 10ns±8ns': 86/1982, '50% 10ns±8ns': 85/457, fail/total = 256/20758 (1.2%) in 10000 runs
benchmark_test.go:98: '1%': 843/169828, '10%': 1784/35104, '99%': 3074/6879, fail/total = 5701/211811 (2.7%) in 100000 runs
benchmark_test.go:98: '1% 10ns±8ns': 955/184247, '10% 10ns±8ns': 954/19488, '50% 10ns±8ns': 954/4734, fail/total = 2863/208469 (1.4%) in 100000 runs
```