项目作者: xing-boyu

项目描述 :
load-balance-algorithm
高级语言: Go
项目地址: git://github.com/xing-boyu/load-balance-algorithm.git
创建时间: 2018-08-19T04:13:48Z
项目社区:https://github.com/xing-boyu/load-balance-algorithm

开源协议:

下载


The package load-balance-algorithm implements two kinds of Round-Robin algorithm.

example to use it:

  1. func SmoothRoundRobinAlg_Next(t *testing.T) {
  2. smoothRoundRobinAlg := &SmoothRoundRobinAlg{}
  3. smoothRoundRobinAlg.Add("A", 5)
  4. smoothRoundRobinAlg.Add("B", 2)
  5. smoothRoundRobinAlg.Add("C", 3)
  6. for i:=0; i<10; i++ {
  7. fmt.Printf("%s ", smoothRoundRobinAlg.Next())
  8. }
  9. }

example to use it:

  1. func RoundRobinAlg_Next() {
  2. roundRobinAlg := &RoundRobinAlg{}
  3. roundRobinAlg.Add("A", 5)
  4. roundRobinAlg.Add("B", 2)
  5. roundRobinAlg.Add("C", 3)
  6. for i:=0; i<10; i++ {
  7. fmt.Printf("%s ", roundRobinAlg.Next())
  8. }
  9. }