Skip to content

xing-boyu/load-balance-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

example to use it:

func SmoothRoundRobinAlg_Next(t *testing.T) {

	smoothRoundRobinAlg := &SmoothRoundRobinAlg{}
	smoothRoundRobinAlg.Add("A", 5)
	smoothRoundRobinAlg.Add("B", 2)
	smoothRoundRobinAlg.Add("C", 3)

	for i:=0; i<10; i++ {
    	fmt.Printf("%s ", smoothRoundRobinAlg.Next())
    }
}

example to use it:

func RoundRobinAlg_Next() {

	roundRobinAlg := &RoundRobinAlg{}
	roundRobinAlg.Add("A", 5)
	roundRobinAlg.Add("B", 2)
	roundRobinAlg.Add("C", 3)

	for i:=0; i<10; i++ {
		fmt.Printf("%s ", roundRobinAlg.Next())
	}
}

About

load-balance-algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages