-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make latency measurement a moving average #84
Comments
+1 for EWMA Whatcha think of this? https://godoc.org/github.com/rcrowley/go-metrics#EWMA |
Yeap, Agreed. |
Looks like go-metrics EWMA counts number of events, not value averages: https://github.com/rcrowley/go-metrics/blob/3be59ceb5538550555459fb77d0efe0e218cdfc7/ewma.go#L79-L118 Am i looking at this wrong? |
Using a library is probably overkill, to implement it you simply need to do: const w float32 = 0.6 // set a weight for how fast the average changes
...
ping := peer.Ping() // get the current latency
avgPing = ping*w + avgPing*(1-w) // update EWMA So if our |
@mappum +1 |
@jbenet where do you get all of these images? |
That's @substack's avatar |
I think this is done already. |
dht keeps Peer's latency, but right now it's only the last value. this should probably be an EWMA.
The text was updated successfully, but these errors were encountered: