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 gcping and gcping.com use the same method to calculate latency #27

Open
corneliusweig opened this issue Dec 1, 2019 · 4 comments

Comments

@corneliusweig
Copy link

It looks like this tool reports the mean time for a network roundtrip, whereas gcping.com reports the one-way latency. That's a bit confusing..

I have no strong opinion what is better, but it would be nice to mention this difference. Alternatively, the tool and website could align their measurement methods.

@corneliusweig corneliusweig changed the title gcping and gcping.com differ by factor of 2 gcping and gcping.com differ by factor of 2 Dec 1, 2019
@corneliusweig corneliusweig changed the title gcping and gcping.com differ by factor of 2 gcping and gcping.com differ by factor of ~2 Dec 1, 2019
@enocom
Copy link
Member

enocom commented Jul 30, 2021

The differences between the CLI and the webapp should be much smaller now. However, the webapp and the CLI use different methods to calculate latency. We should change it so they both use the same method.

The webapp sends requests to the backend for 30 seconds and then takes the median for each region.

The CLI just sends 10 requests (although it's configurable) before taking the median.

@enocom enocom changed the title gcping and gcping.com differ by factor of ~2 Make gcping and gcping.com use the same method to calculate latency Jul 30, 2021
@crwilcox
Copy link
Contributor

Taking some notes:

Web Version

For 30 seconds, send pings on loop. Once 20 pings have occurred, shift old pings out, keeping the latest 20. Always toss out the first request to avoid reading cold start.

Time Measured is from the start of the request to the time response is read.

CLI Version

For all regions make 10 requests. makes request, reads status code. Doesn't reject first request time

As for requests, they both await a response. There is a small amount possibly more for the js due to reading the body, but I added that to the go impl and it made a negligible difference in timing. It is important to remember the most valid way to use this is for relative timing. There are likely optimisations that could be made to lessen the overall time, but as they all use the same backend the measurement is valid for the purpose of gcping.

@yuryu
Copy link
Member

yuryu commented Sep 10, 2021

Checking in here as I opened #55.
Go also introduced ClientTrace so we can measure the request sent - first byte received time in both clients. There would be a slight difference if we make the change, because the web API measures request start - first byte, where go measures request sent - first byte, but since the request is small, the difference should be negligible.

image

This is what you can measure with the web api.

@enocom
Copy link
Member

enocom commented Sep 13, 2021

This seems like a great idea both for the web app and the CLI. And I agree, the difference is probably negligible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants