Skip to content
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

Closed
jbenet opened this issue Sep 16, 2014 · 9 comments
Closed

make latency measurement a moving average #84

jbenet opened this issue Sep 16, 2014 · 9 comments
Labels
help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature

Comments

@jbenet
Copy link
Member

jbenet commented Sep 16, 2014

dht keeps Peer's latency, but right now it's only the last value. this should probably be an EWMA.

@btc
Copy link
Contributor

btc commented Sep 16, 2014

@whyrusleeping
Copy link
Member

Yeap, Agreed.

@btc btc added help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature labels Sep 16, 2014
@jbenet
Copy link
Member Author

jbenet commented Sep 16, 2014

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?

@mappum
Copy link
Contributor

mappum commented Sep 17, 2014

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 w is set to 0.75, our average is at 100ms, then we send a new ping and get 50ms, the average will update to 87.5ms.

@whyrusleeping
Copy link
Member

@mappum +1

@jbenet
Copy link
Member Author

jbenet commented Sep 17, 2014

Using a library is probably overkill


Modularity!!!

you simply need to do

But you're right, no need to use a library as bloated as that. Maybe implement it in one small package.

all of this will get easier once ipfs can be a package manager for go code

@whyrusleeping
Copy link
Member

@jbenet where do you get all of these images?

@mappum
Copy link
Contributor

mappum commented Sep 17, 2014

That's @substack's avatar

@jbenet
Copy link
Member Author

jbenet commented Oct 23, 2014

I think this is done already.

@jbenet jbenet closed this as completed Oct 23, 2014
@aschmahmann aschmahmann mentioned this issue Sep 22, 2020
72 tasks
ribasushi pushed a commit that referenced this issue Jul 4, 2021
@aschmahmann aschmahmann mentioned this issue Dec 1, 2021
80 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

4 participants