regression: fix ewma warmup again (#2079)

* Update estimators.go

* Update go.mod

* Update modules.txt

* Update go.sum

* Update serversInfo.go

* Update estimators.go

* Update serversInfo.go
This commit is contained in:
livingentity 2022-04-02 17:41:36 +02:00 committed by GitHub
parent 5d023d2a7c
commit f67e9cab32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 10 deletions

View file

@ -3,7 +3,7 @@ package main
import ( import (
"sync" "sync"
"github.com/lifenjoiner/ewma" "github.com/jedisct1/ewma"
) )
const ( const (
@ -13,7 +13,7 @@ const (
type QuestionSizeEstimator struct { type QuestionSizeEstimator struct {
sync.RWMutex sync.RWMutex
minQuestionSize int minQuestionSize int
ewma *ewma.EWMA ewma ewma.MovingAverage
} }
func NewQuestionSizeEstimator() QuestionSizeEstimator { func NewQuestionSizeEstimator() QuestionSizeEstimator {

View file

@ -16,9 +16,9 @@ import (
"time" "time"
"github.com/jedisct1/dlog" "github.com/jedisct1/dlog"
"github.com/jedisct1/ewma"
clocksmith "github.com/jedisct1/go-clocksmith" clocksmith "github.com/jedisct1/go-clocksmith"
stamps "github.com/jedisct1/go-dnsstamps" stamps "github.com/jedisct1/go-dnsstamps"
"github.com/lifenjoiner/ewma"
"github.com/miekg/dns" "github.com/miekg/dns"
"golang.org/x/crypto/ed25519" "golang.org/x/crypto/ed25519"
) )
@ -46,7 +46,7 @@ type DOHClientCreds struct {
type ServerInfo struct { type ServerInfo struct {
DOHClientCreds DOHClientCreds DOHClientCreds DOHClientCreds
lastActionTS time.Time lastActionTS time.Time
rtt *ewma.EWMA rtt ewma.MovingAverage
Name string Name string
HostName string HostName string
UDPAddr *net.UDPAddr UDPAddr *net.UDPAddr
@ -199,6 +199,7 @@ func (serversInfo *ServersInfo) refreshServer(proxy *Proxy, name string, stamp s
dlog.Fatalf("[%s] != [%s]", name, newServer.Name) dlog.Fatalf("[%s] != [%s]", name, newServer.Name)
} }
newServer.rtt = ewma.NewMovingAverage(RTTEwmaDecay) newServer.rtt = ewma.NewMovingAverage(RTTEwmaDecay)
newServer.rtt.SetWarmupSamples(1)
newServer.rtt.Set(float64(newServer.initialRtt)) newServer.rtt.Set(float64(newServer.initialRtt))
isNew = true isNew = true
serversInfo.Lock() serversInfo.Lock()

2
go.mod
View file

@ -10,6 +10,7 @@ require (
github.com/hashicorp/golang-lru v0.5.4 github.com/hashicorp/golang-lru v0.5.4
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95
github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f
github.com/jedisct1/ewma v1.2.1-0.20220220223311-a30af446ecb9
github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868 github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868
github.com/jedisct1/go-dnsstamps v0.0.0-20220328103132-6fb2da762370 github.com/jedisct1/go-dnsstamps v0.0.0-20220328103132-6fb2da762370
github.com/jedisct1/go-hpke-compact v0.0.0-20210930135406-0763750339f0 github.com/jedisct1/go-hpke-compact v0.0.0-20210930135406-0763750339f0
@ -17,7 +18,6 @@ require (
github.com/jedisct1/xsecretbox v0.0.0-20210927135450-ebe41aef7bef github.com/jedisct1/xsecretbox v0.0.0-20210927135450-ebe41aef7bef
github.com/k-sone/critbitgo v1.4.0 github.com/k-sone/critbitgo v1.4.0
github.com/kardianos/service v1.2.1 github.com/kardianos/service v1.2.1
github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2
github.com/miekg/dns v1.1.47 github.com/miekg/dns v1.1.47
github.com/powerman/check v1.6.0 github.com/powerman/check v1.6.0
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064

4
go.sum
View file

@ -350,6 +350,8 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f h1:XICcphytniQKdtd4FGrK0b1ERzS7FBvFtVUCReSppmU= github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f h1:XICcphytniQKdtd4FGrK0b1ERzS7FBvFtVUCReSppmU=
github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f/go.mod h1:35aII3PkLMvmc8daWy0vcZXDU+a40lJczHHTFRJmnvw= github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f/go.mod h1:35aII3PkLMvmc8daWy0vcZXDU+a40lJczHHTFRJmnvw=
github.com/jedisct1/ewma v1.2.1-0.20220220223311-a30af446ecb9 h1:U5QPCoM1KkMJ9RfEfP0joKNwwwIHG1oP9RzjvQTuh98=
github.com/jedisct1/ewma v1.2.1-0.20220220223311-a30af446ecb9/go.mod h1:qCWdft6DX9wxyNsUS+sxS44UkxE7eQnNtBttTWoW0cU=
github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868 h1:QZ79mRbNwYYYmiVjyv+X0NKgYE6nyN1yo3gtEFdzpiE= github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868 h1:QZ79mRbNwYYYmiVjyv+X0NKgYE6nyN1yo3gtEFdzpiE=
github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868/go.mod h1:SAINchklztk2jcLWJ4bpNF4KnwDUSUTX+cJbspWC2Rw= github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868/go.mod h1:SAINchklztk2jcLWJ4bpNF4KnwDUSUTX+cJbspWC2Rw=
github.com/jedisct1/go-dnsstamps v0.0.0-20220328103132-6fb2da762370 h1:VQyy4FYgkGVvMnfMauP3phjlwmQQu+DxnE5jBBH4It8= github.com/jedisct1/go-dnsstamps v0.0.0-20220328103132-6fb2da762370 h1:VQyy4FYgkGVvMnfMauP3phjlwmQQu+DxnE5jBBH4It8=
@ -421,8 +423,6 @@ github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJ
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2 h1:eD3+F7WMC7wryFGBrLSyzoRqK+kR7nCT/9VT2E3XJzc=
github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2/go.mod h1:SJvYtJnDKXqTrIvyRocCJmuNuM3bUb4krn9UbZXj+tw=
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=

6
vendor/modules.txt vendored
View file

@ -248,6 +248,9 @@ github.com/inconshreveable/mousetrap
# github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f # github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f
## explicit; go 1.17 ## explicit; go 1.17
github.com/jedisct1/dlog github.com/jedisct1/dlog
# github.com/jedisct1/ewma v1.2.1-0.20220220223311-a30af446ecb9
## explicit; go 1.12
github.com/jedisct1/ewma
# github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868 # github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868
## explicit ## explicit
github.com/jedisct1/go-clocksmith github.com/jedisct1/go-clocksmith
@ -303,9 +306,6 @@ github.com/ldez/gomoddirectives
# github.com/ldez/tagliatelle v0.2.0 # github.com/ldez/tagliatelle v0.2.0
## explicit; go 1.16 ## explicit; go 1.16
github.com/ldez/tagliatelle github.com/ldez/tagliatelle
# github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2
## explicit; go 1.16
github.com/lifenjoiner/ewma
# github.com/magiconair/properties v1.8.1 # github.com/magiconair/properties v1.8.1
## explicit ## explicit
github.com/magiconair/properties github.com/magiconair/properties