Smoothing down the right under the Weighted Round Robin Algorithm

func (this *LoadBalance) RoundRobinByWeight3() *HttpServer { //平滑加权轮询
    for _, s := range this.Servers {
        s.CWeight = s.CWeight + s.Weight
    }
    sort.Sort(this.Servers)
    max := this.Servers[0]

    max.CWeight = max.CWeight - SumWeight
    return max
}




Guess you like

Origin www.cnblogs.com/hualou/p/12070718.html