Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: An ultra-light-weight tool to quickly test your ping (chrisjeakle.com)
96 points by PNWChris on Oct 1, 2022 | hide | past | favorite | 61 comments
Howdy HN!

I find myself testing my ping from time to time, especially when my internet seems wonky while WFH. It feels like there should be an easier way test my ping than puling up a terminal or a complex web app - especially when I'm on my phone or any other device that doesn't have a terminal.

I figured I should be the change I wish to see in the world and created this super light ping test.

I also created a latency monitoring solution (https://github.com/cjjeakle/network-monitor), feel free to clone and try it out! I know there are a lot more mature monitoring solutions out there, but I never did figure out how to set them up. This one is super simple: clone it to some device that's always on, compile it, set up some systemd stuff, and it's ready to rock on port 8180!




Sorry for being unappreciative but... is this... satire? I honestly don't know...

'easier way to test my ping than pulling up a terminal', ... so a non https website that needs javascript is better than terminal-shortcut + <terminal>$ ping 8.8.8.8</terminal> (or whatever you want to ping, you also could set up an alias/function in your .bashrc to do something more complex)...

can I hit that point home: "easier way than pulling up my terminal", answer: a non-https javascript needing website!!!

>>> 'super simple: clone it to some device that's always on, compile it, set up some systemd stuff, and it's ready to rock on port 8180'

"super simple"... sounds... super simple... installing rust nightly as we speak to build it /s

this world of ours


Fair enough. I think technical users probably don't need this site, but I think there is value to be had (even for those technical users!).

For a bit of context:

I found myself using this site via my xbox's web browser to make sure my wifi latency is acceptable where I put the xbox.

Also, my spouse and I just moved to a new place, so I used this site on my phone to get a quick idea of the latency on wifi in my spouse's office.

There's tons of web-based tools to test your bandwidth, but I feel there just isn't a similar ecosystem of quick, web-based "ping" (well, latency, since I can't send ICMP packets from a web browser) tools.

-

RE: HTTP only, good point. I've set up certbot and the page supports https now. I am not certain how HTTPS will impact the latency measurements, it appears the results are typically a bit higher and occasionally much higher when using HTTPS.

-

I don't get the disappointment with the use of JS. It's just a bit of inline JS, easy to manually audit if concerned. JS is quite safe IMO and is a very powerful tool, it makes a rich universe of interactive applications possible in the humble web browser. I basically got into CS because of the fun I had creating things for and sharing things on the web.


> so I used this site on my phone to get a quick idea of the latency on wifi in my spouse's office.

Sure you did. But there's a whole category of phone apps called Wifi Heat maps, that would actually be "super simple" for a non-techie to use.

People are commenting on your use of javascript, where you are arguing that you built a super simple solution. As many already pointed out, the ping command is already there and is more "super simple" to use than to self host a website to get a skewed HTTP "ping" from some cloud service...


How was it possible to read "easier way to test my ping than pulling up a terminal" but not finish the sentence to "especially when I'm on my phone or any other device that doesn't have a terminal"?


especially when I'm on my phone or any other device that doesn't have a terminal

Mine does, and in fact I have used the ping command from it before. I highly recommend having a terminal app.


Why do you highly recommend it? Don't think I've ever thought while using a phone "damn I wish I had a Linux terminal handy"


I suppose if you don't think of your phone as the general-purpose computer that it really is, then it won't seem obvious. But otherwise, I also recall using dig, netcat, traceroute, and a few other network tools a few times. Having a shell, even a root one, is one of those things that you don't need often, but when you do, you really do.


I mean I know what my phone is. I just do not want to use that interface for those sort of tasks. Tiny little screen, virtual keyboard that tries to hard to be clever, etc.

Even browsing the web to read wikis and documents and stuff is a complete pain half the time.


How I miss my galaxy S3!

I'd hook it up to a proper display using an MHL cable then connect a Bluetooth keyboard. It was a sweet setup and the assorted tools (plus root shell) actually came in very handy. It could fill in for a laptop quite nicely.

These days it seems there's no legitimate alternative to MHL... can any phones directly connect to a display anymore via wire? Or is the only option screencasting to a smart TV?

FWIW, I generally like my appliances on the dumb (or open) side.


A lot of phones can be connected to an external display via USB-C. Better supported than MHL (how many incompatible standards was MHL? 4?).

Samsung has "Dex", their android desktop interface.

Linux phones can generally offer a full DE, either the pinephone or Librem, or compatible phones that have a video out where you can install something likke postmarketos.

Most phones also support miracast, and you can plug in a mouse/keyboard. I think the Charging in + keyboard + mouse + video out is clearer with USB-C.

Sent from my Galaxy S4 ;)


Much easier to just carry my MacBook everywhere as I already do.


>I just do not want to use that interface for those sort of tasks.

That is your preference. For others the advantage of utilizing a familiar interface outweighs the disadvantages (that maybe even aren't for some) mentioned.


Neither do I. Yet sometimes that's the only thing you have on hand.


> Don't think I've ever thought while using a phone "damn I wish I had a Linux terminal handy"

Then maybe it's not for you, but some of us absolutely have had that thought and find it incredibly useful.


Again, why is it "incredibly" useful?


You need to diagnose something on your laptop that has stopped accepting input or with a blank screen. plug in your Android phone, enable USB tethering, ssh in.

You are on holidays, your need to help someone (or yourself) with some server issues. Use your teminal to ping them, ssh, etc. Later, no Internet at your rental house. No computers. Fire up the terminal,diagnose the issue. nmap the network if you need to find the IP of something (also, to check for cameras? IDK).

It's just a huge toolbox, batteries included. You might not need it. It can certainly come handy, especially if you have no Internet to download the corresponding app.

I don't use it often, but when I do, it's much better to have it than not having it.


FWIW This ping/latency tool is a great tool and impressively terse, I've had to implement it myself several times the last 20 years for reasons. So I am glad someone actually shipped a tool for it.

To answer your question: I think your point of view need to change. The need we want to full fill is to do computer stuff, we have a pretty neat computer in our hand it is clear we want to use it as such.


I mean most of us techies know better ways.

On your phone you run for example Fing

Fing iOS: https://apps.apple.com/us/app/fing-network-scanner/id4309211...

Fing Android: https://play.google.com/store/apps/details?id=com.overlook.a...

With Fing App’s free tools and utilities help you:

• Scan networks with Fing’s Wi-Fi & LAN network scanner and discover all devices connected to any network

• Get the most accurate device recognition of IP address, MAC address, device name, model, vendor and manufacturer

• Run WiFi and Cellular internet speed tests, download speed and upload speed analysis and latency

• Browse internet outages in your area, ISP ratings, reviews and speed statistics

• Advanced device analysis of NetBIOS, UPnP, SNMP and Bonjour names, properties and device types

• Includes port scanning, device ping, traceroute and DNS lookup

• Receive network security and device alerts to your phone and email


Can't say I've ever felt the need to test ping from my phone other than finding out if my wifi AP was dead while I was in the attic troubleshooting. There's an app for that.


My phone does have a terminal, and I run ping in termux regularly.


This isn’t Shark Tank. OP built something to share, not looking for seed funding or a Nobel. Relax!


It's even easier to have a ping going in the corner of my laptop screen. Since the Win7 days I've used SimplePing, on my work Mac the app store wanted 99c for this privilege but there's a free one that does the same thing.


Looking at the readme I really thought it was satire:

https://github.com/cjjeakle/network-monitor


Definitely has a "but why?" vibe to it. OP probably learned a lot getting this up and that's usually what motivates me to learn.


I for one welcome the era of PaaS (ping as a service).


...for only $9 a month.


Great start!

One way you could improve this is to not stop at just reporting a single data point but report the P50, P75, and P90 of a reasonable set of data points.

Also, it's probably better to call this HTTP latency rather than ping since the latter is on a much lower layer in the OSI model.


These are great points, I appreciate it!

Labelling this a "ping" was a poor choice on my part. I meant ping in the RTT/latency sense, rather than an ICMP sense. Calling it "HTTP latency" is a huge improvement that clearly (and concisely) gets the idea across, I made a quick edit to do just that.

RE: recording a range of samples and reporting percentiles: My hope is to keep the code super simple and the delay to visible info in the UI very low. Elsewhere in the thread folks mentioned the excellent http://gcping.com/. That site has a ton of destinations to test latency to and reports the median of a number of samples - that is a really cool feature set! I don't think I'll be able to do anything close to that in tens of lines of inline JS, unfortunately.

Still, the measurements start super noisy and I'd like to ensure my site gives useful data even at the start. I did a bit of a hack to hopefully force the RTT to converge to something useful. I now fire off 3 time-delayed measurements after the page loads. By the time the third finishes, the numbers appear to be pretty stable.


Really lightweight, nicely done.

For even more sites/pops, https://gcping.com exists which I believe pings each GCP region worldwide. It feels a bit heavier, as it takes at least a few seconds before I see (relevant to me in the US) results.


This is super cool! I like the ability to review previous results. Not sure why people are getting so hung up on how ping in the terminal is so much simpler.

Not sure if this is desired, but if at some point alerting was built into this, that would be awesome.

---

On a related note, I currently use the following tools to monitor my network:

- bash-uptime[1] -- BASH script I wrote for simple (for me) icmp/http monitoring.

- iPerf3 server so I can test my bandwidth speeds over the LAN or Wireguard

- Nfcapd/nfdump to ingest netflow from my firewall and router and give me the ability to search that netflow with nfdump (I have a multi-arch Docker image for Nfcapd that I maintain[2])

- Syslog-ng to ingest logs and write them to my filesystem with some scripts I use to search the logs quickly via grep

- Gotify for all my network-related notifications

[1] https://github.com/heywoodlh/bash-uptime

[2] https://hub.docker.com/r/heywoodlh/nfcapd


I use https://www.cloudping.info/

Although it’s sad to see they put political messages in it now


I think it's sad we live in a world where an unobtrusive acknowledgment of modern day slavery is adversely received.


I’m against slavery. I’m also against putting political messages into software


Why?


Same reason most people don't like banner ads. It's extra fluff the user didn't ask for, unrelated to the stuff they actually want to see. It's not the case here, but oftentimes the political messages can be large and distracting, think Notepad++. That's reason enough to dislike them, without getting into any of the "purity" arguments.


You're against slavery, but not against doing the slightest gesture against it, even if it barely inconveniences you?


I would take those numbers with a grain of salt. That site claims I have a 3ms ping to a digital ocean droplet in Singapore. Either I have proven faster-than-light information transfer or that measurement is off by several orders of magnitude.


They could be using anycast, but the pings for Digitalocean seemed correct to me


http://ping.playit.gg/ embeds the request epoch in the TCP sequence number to give you your ping.

  Client SYN => 
             <= Server SYN+ACK \w epoch in sequence
  Client ACK =>
             <= HTTP payload calculating ping with NOW - ACK number


Oh snap, that is cool! Does the server use raw sockets to pull that off? Or are regular ole TCP sockets capable of this?


It’s custom software for tunneling (primarily game servers). All the packets are handled directly using AF-XDP. It’s also on an anycast network and this endpoint is used to debug routing issues.


The times will be super different between initial load and retries, since the first request requires a potential DNS lookup, establishing a TCP connection, and potential TLS handshake, and only then the request can be performed. Follow-up requests don't require an additional connection.

If you want timings only for TCP connection establishment, or only for the request, you can use the browsers navigation timing APIs to get those: https://developer.mozilla.org/en-US/docs/Web/Performance/Nav...


Won’t the browser first do an OPTION before the test (GET) starts? The lookups should be cached.


you can check it in the network tab. It won't.


OP here! Great discussion, it's made me realize I should also share my favorite speed test: https://www.waveform.com/tools/bufferbloat

It both tests bandwdith and gives some cool latency measurements (both idle and under load). It's super helpful at diagnosing bufferbloat if there is any on your network connection.

I don't run it much since I don't want to tear through my ISP's data cap, but is an excellent tool.


Not an expert but this doesn't seem like normal ping, it's rather how much HTTP request take including handshakes and content download


I wonder if it could be done better using WebSockets: setup the connection, start the stopwatch, send a byte, wait to receive a byte, stop the stopwatch, and close the connection.


Not entirely.

Modern browsers / webservers will keep TCP connections alive for at least a few minutes. I ran a tcpdump and confirmed there's only one network round trip involved in the critical path (after the first request, anyhow), with a transfer of a few hundred bytes in each direction (HTTP overhead, but nowhere near big enough to incur processing delays on the same scale as propagation delay).

(The actual packets sent: HTTP GET from my end, HTTP response from the server, ACK from my end.)

The latency is still 20-40ms higher than ping times, although it's not clear to me whether that's due to disk seek latency, server load, or something else.


This is super helpful context, thank you! I was wondering why the RTTs appeared to converge only after a couple retries, and why the first measurement was so wildly different when pulling up the page after some time away.


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).


The 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;
      });
  }


You 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?


Super great points, I'm going to experiment with these ideas a bit and see how it goes.


Nice. Now all you need is a catchy URL so people can remember it.


I like this one which I think was a Show HN a while ago

https://github.com/apenwarr/blip


I miss Netalyzer ( http://netalyzr.icsi.berkeley.edu/ )


Perhaps pop a noscript tag in the page with a warning ('this page uses a javascript function')?


Can HN please reject any submissions that are not HTTPS urls? The number of sites that get submitted here via plaintext http is shocking.

To anyone who just started typing out something to inform me that "it doesn't matter on _______ site because _______": there are four purposes of encryption, not just "confidentiality."


Fair point! Just got all the certbot stuff set up. Wasn't too bad, though at first glance it appears there may be a bit more variance in the RTTs.

Edit:

I think I found a way to get the best of both worlds!

I've removed certbot's 301 redirect from HTTP to HTTPS and made it so the protocol used during latency measurements matches the page's state. Now if one wants HTTPS they can use it, but if they want a slightly more stable measurement they can use the http page.


flent.org has some heavy duty, wonderful graphic tests.


Love it




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: