Skip to content

lock-free least-connections balancing algorithm written in golang

License

Notifications You must be signed in to change notification settings

hlts2/least-connections

Repository files navigation

least-connections

least-connections is least-connections balancing algorithm written in golang

Requrement

Go (>= 1.8)

Installation

go get github.com/hlts2/least-connections

Example

Basic Example

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

LICENSE

least-connections released under MIT license, refer LICENSE file.

Releases

No releases published

Packages

No packages published

Languages