So I did some speedtests with a bit more evolved strategy. The current incarnation of the reliable UDP strategy:
The publisher sends a bunch of N chunks, followed by a heartbeat. The subscriber responds to the heartbeat only, by either saying “I got everything up to, but not including X” or “I still need X through, but not including Y”. The first message acknowledges to the publisher that chunks are received. The second message instructs the publisher to mix in chunks for retransmit during the next bunch.
Now, this whole thing is only actually worth anything if it sends data across the network faster than plain TCP does. Because if it doesn’t, just use TCP. So I wanted to know what kinds of throughput I could expect from TCP on my machine. Running a quick iperf3
(linux network performance measurement tool) told me that data tends to travel at 4634 MBytes/sec over TCP, so this is the value to beat.
That’s kind of fast… Wow.
That’s almost as fast as USB 3.0.
That’s way too fast for a network interface.
That it is… As it turns out, the operating system shortcuts direct localhost-localhost TCP connections with a data pipe, which apparently goes up to USB 3.0 speeds.
Time to bring in a second machine on the local network. After copying and compiling the code, I did the same iperf3
test, and it got all the way up to 112 MBytes/sec for a plain TCP stream between the two machines. That’s more like it.
Now to measure the reliable UDP throughput. After some tuning and tweaking, I managed to get the throughput up to 118 MBytes/sec.
Yay.
On to the next challenge!