Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hlts2/least-connections
lock-free least-connections balancing algorithm written in golang
https://github.com/hlts2/least-connections
algorithm balancer balancing go golang goroutine-safe least-connected lock-free
Last synced: 4 days ago
JSON representation
lock-free least-connections balancing algorithm written in golang
- Host: GitHub
- URL: https://github.com/hlts2/least-connections
- Owner: hlts2
- License: mit
- Created: 2018-07-19T03:58:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-14T03:50:40.000Z (almost 6 years ago)
- Last Synced: 2024-11-19T06:40:12.795Z (2 months ago)
- Topics: algorithm, balancer, balancing, go, golang, goroutine-safe, least-connected, lock-free
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# least-connections
least-connections is least-connections balancing algorithm written in golang## Requrement
Go (>= 1.8)
## Installation
```shell
go get github.com/hlts2/least-connections
```## Example
### Basic Example
```go
lc, err := New([]*url.URL{
{Host: "192.168.33.10"},
{Host: "192.168.33.11"},
{Host: "192.168.33.12"},
})src1, done1 := lc.Next() // {Host: "192.168.33.10"}
src2, done2 := lc.Next() // {Host: "192.168.33.11"}
done1() // Reduce connection of src1
src3, done3 := lc.Next() // {Host: "192.168.33.10"}
```
## Author
[hlts2](https://github.com/hlts2)## LICENSE
least-connections released under MIT license, refer [LICENSE](https://github.com/hlts2/least-connections/blob/master/LICENSE) file.