restore old logic/constants (#2045)
* fix indices * Update serversInfo.go For safety go back to former logic, just generalized for lbStrategy, until someone comes up with an actual improvement. * restore old logic/constants
This commit is contained in:
parent
ac6abfb985
commit
9ec8a35468
|
@ -24,7 +24,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
RTTEwmaDecay = 15.0
|
||||
RTTEwmaDecay = 10.0
|
||||
)
|
||||
|
||||
type RegisteredServer struct {
|
||||
|
@ -264,9 +264,9 @@ func (serversInfo *ServersInfo) estimatorUpdate() {
|
|||
serversInfo.inner[candidate], serversInfo.inner[currentActive] = serversInfo.inner[currentActive], serversInfo.inner[candidate]
|
||||
dlog.Debugf("New preferred candidate: %s (RTT: %d vs previous: %d)", serversInfo.inner[currentActive].Name, int(candidateRtt), int(currentActiveRtt))
|
||||
partialSort = true
|
||||
} else if candidateRtt > 0 && candidateRtt > serversInfo.inner[activeCount].rtt.Value() {
|
||||
} else if candidateRtt > 0 && candidateRtt >= (serversInfo.inner[0].rtt.Value()+serversInfo.inner[activeCount-1].rtt.Value())/2.0*4.0 {
|
||||
if time.Since(serversInfo.inner[candidate].lastActionTS) > time.Duration(1*time.Minute) {
|
||||
serversInfo.inner[candidate].rtt.Add(serversInfo.inner[activeCount].rtt.Value())
|
||||
serversInfo.inner[candidate].rtt.Add(candidateRtt/2.0)
|
||||
dlog.Debugf("Giving a new chance to candidate [%s], lowering its RTT from %d to %d (best: %d)", serversInfo.inner[candidate].Name, int(candidateRtt), int(serversInfo.inner[candidate].rtt.Value()), int(serversInfo.inner[0].rtt.Value()))
|
||||
partialSort = true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue