Skip to content
/ sping Public

Split ping, see what direction the loss or latency is on

License

Notifications You must be signed in to change notification settings

benjojo/sping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

287083d · Sep 19, 2023

History

38 Commits
Feb 18, 2021
Jan 7, 2021
Mar 2, 2021
Jan 15, 2021
Sep 19, 2023
Mar 3, 2021
Feb 18, 2021
Feb 18, 2021
Mar 10, 2022
Mar 8, 2021
Mar 2, 2021
Mar 2, 2021
Mar 2, 2021
Feb 18, 2021
Mar 10, 2022
Jan 19, 2020

Repository files navigation

split-ping

split-ping is a tool that can tell you what direction packet latency or loss is on. This is handy for network debugging and locating congestion.

It was built as part of a personal blog post: https://blog.benjojo.co.uk/post/ping-with-loss-latency-split

split-ping's binary name is shorted to sping for ease, it's help page is as follows:

$ ./sping -h
Usage of ./sping:
  -clock-is-perfect
        Enable userspace calibration against Apple's GPS NTP servers (default true)
  -debug.showslots
        Show incoming packet latency slots
  -debug.showstats
        Show per ping info, and timestamps
  -listenAddr string
        Listening address (default "[::]:6924")
  -peers string
        List of IPs that are peers
  -pps.debug
        Enable debug output for PPS inputs
  -pps.path string
        what PPS device to use (default "/dev/pps0")
  -udp.pps int
        max inbound PPS that can be processed at once (default 100)
  -use.pps
        If to use a PPS device instead of system clock
  -web.listen-address string
        Address on which to expose metrics and web interface (default "[::]:9523")
  -web.telemetry-path string
        Path under which to expose metrics. (default "/metrics")

Example output

When viewing the stats via the CLI:

# run this on each host, pointed at the other host as a peer
$ ./sping -peers 198.16.109.36 -debug.showstats
2021/03/03 19:04:10 Listening on[::]:9523
it is now: 2021-03-03 19:04:11.000241999 +0000 GMT m=+0.500559754
it is now: 2021-03-03 19:04:12.000174134 +0000 GMT m=+1.500491809
2021/03/03 19:04:12 [198.16.109.36] RX: 8.131386ms TX: 0s [Loss RX: 0/0 | Loss TX 0/0]
...

When viewing the stats via the web interface:

$ ./sping -peers 198.16.109.36
$ open http://127.0.0.1:9523/metrics
# HELP splitping_latency The latency (in seconds) in each direction
# TYPE splitping_latency gauge
splitping_latency{direction="rx",host="23.132.96.179"} 0.068701256
splitping_latency{direction="tx",host="23.132.96.179"} 0.066165156
# HELP splitping_loss The loss in each direction
# TYPE splitping_loss gauge
splitping_loss{direction="rx",host="23.132.96.179"} 0
splitping_loss{direction="tx",host="23.132.96.179"} 0
...

Building

A simple go build in this directory should build sping (after auto-fetching the go modules)