202106-05 golang 实现一个负载均衡案例(随机,轮训) 今天用go实现一个简单的负载均衡的算法,虽然简单,还是要写一下。1.首先就是服务器的信息packagebalancetypeInstancestruct{hoststringportint}funcNewInstance(hoststring,portint)*Instance{return&Instance{host:host,port:port,}}func(p*Instance)GetHost()string{returnp.host}func(p*Instance)GetPort()int{returnp.port}2.接着定义接口packagebalanc... 继续阅读 >