平滑加权轮询算法下的降权

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
}




posted @ 2019-12-19 22:44  离地最远的星  阅读(207)  评论(0编辑  收藏  举报