UDP metronome vs. Starlink
I created a custom tool for monitoring network connections. Here’s some notes on what I learned from it and what I plan next.
I wrote the tool in a couple of hours. It uses aioudp to send a UDP packet to a server every 100ms or so, the server reflects it back. This very vaguely mimics application traffic. I then log back whether the reply came back in order and how long it took. Data is sent to influx and graphed with Grafana. 1 second timeouts or packets out of order are marked as “errors”.
I left this running with the client behind Starlink and the server on my lightly loaded reliable machine in a datacenter. Quick and dirty and there’s some things I’d improve in the timing of packet sends (it only sends after it receives the last one, so slow RTT means fewer packets), but it got me some data pretty quick. However I’m going to stop running it because it’s kinda sloppy.
Going forward I am going to look at irtt for the network testing. It’s a ~5 year old program that does something similar with UDP to monitor connection latency. But written and tested much more carefully than mine. I haven’t dug into what all it can do but it seems to the task. This experiment made me realize it’s much more useful to graph anomalies and shifts in the general trend, not the basic sequence of successes you expect.
I was a little worried about this high frequency testing but the volume isn’t so bad. My data packets are about 20 bytes, so call it 50 bytes total for the packet (including headers) or 0.5 kbytes/sec or 43 megabytes a day. It’s negligible.
Starlink on a normal day
Here’s a graph of the data after a full day. For each slot I’m graphing the mean RTT and the max/min for the time interval. The scale here is about 1 minute a pixel, so there’s up to 600 packets being measured. Errors peak at about 10, or under 2% packet loss.

I like how this shows the daily congestion so clearly. The heavy line of mean RTT in the second graph is very clear; you can see the latency creep up from 100ms to 150ms in the busy times of day. The max/min also spreads significantly, showing the jitter. (Standard deviation just follows the same trend as mean.) The error rate graph at the top is also illuminating. Unfortunately I screwed up here because most errors are timeouts (1 second) and that delays my dumb code from sending another packet, so at 100% packet loss I’m only possibly getting 60 packets a minute through, not the 600 I intended.

For comparison here is a graph from ICMP pings in the same time interval. This shows roughly the same pattern of evening congestion, particularly in the packet loss red dots. But the picture with mean RTT isn’t nearly so clear. Not sure why that is but I think it’s because of my higher frequency sampling with the metronome; 600 a minute vs. 4 x 5 packets a minute with the pings.

One thing that’s instructive with this high frequency data is to graph every single packet. Here’s 1 minute worth of data representing 400-600 packets during a bad time when 11 of those packets got lost. You can see the spread of latencies is just all over. It should be 100ms but some packets are taking 4x as long.
Starlink’s bad day
I lucked out and got this monitoring running on 2023-01-22 when Starlink was having a bad day. I managed to capture the bad behavior and its fix pretty clearly.

You can see a radical change around 22:40 (22:41:27, precisely). Before then error rates were very high and latency was all over the map. Suddenly it smooths out; almost no lost packets, steady latency, and a lower minimum latency. Starlink changed something. FWIW here’s a closeup of the transition.
