4 ms·
I’m on my phone and I can’t debug/look into it but the jitter is very high. Over 5 tries I’ve received widely varying ping times to SF, two of which were 1s wh
by isatty 4y ago
I’m on my phone and I can’t debug/look into it but the jitter is very high.
Over 5 tries I’ve received widely varying ping times to SF, two of which were 1s while NYC was 140 ms ish.
Just weird because I’m on a reliable connection in SF (sonic).
- vdfs 4y agoThe code my clarify that up, it simply calculate how much time an http request take to complete: function ping_test() { time_request("http://ping.projects.chrisjeakle.com/ping/data.txt", "result-east"); time_request("http://ping.projects-west.chrisjeakle.com/ping/data.txt", "result-west"); } function time_request(url, output_id) { document.getElementById(output_id).innerText = "..."; const start_time = new Date().getTime(); fetch(url, { mode: "no-cors", cache: "no-cache", }).then(async (result) => { const elapsed_time = new Date().getTime() - start_time; document.getElementById(output_id).innerText = elapsed_time; }); }
- 0x0 4y agoYou should consider switching to window.performance.now() as that is a monotonically increasing clock, instead of a wall clock that might randomly be adjusted with time sync services. Also, maybe you should run the tests in sequence instead of at the same time. I wonder if running two concurrent fetches might disadvantage the second fetch?
- PNWChris 4y agoSuper great points, I'm going to experiment with these ideas a bit and see how it goes.