package
Version:
v0.0.0-...-2b4093a
Opens a new window with list of versions in this module.
Published: Nov 20, 2019
License: MIT
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package roundrobin provides smooth weighted round-robin balancing
> For edge case weights like { 5, 1, 1 } we now produce { a, a, b, a, c, a, a }
> sequence instead of { c, b, a, a, a, a, a } produced previously.
the basic idea is from nginx, refer details in following link
https://github.com/nginx/nginx/commit/52327e0627f49dbda1e8db695e63a4b0af4448b1
Peer represents a backend server.
CreatePeer return a Peer object.
Pool is a group of Peers, one Peer can not belong to multiple Pool.
CreatePool return a Pool object.
func (p *Pool) Add(addr string, args ...interface{})
Add append a peer to the pool if not exists.
DownPeer mark the peer down.
EqualGet get peer by turn, without considering weight.
Get return peer in smooth weighted roundrobin method.
Remove removes the peer from the pool.
Size return the number of the peer.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.