Skip to content

v2.1.0

Choose a tag to compare

@javimosch javimosch released this 09 Aug 02:13
· 15 commits to master since this release

What's new

Two optimizations that together bring 10MB transfer to rbm21 from 14s to 9.5s — 1.45x faster than scp.

Async relay write queue

When a chunked file transfer begins, the relay starts a background goroutine to drain a buffered channel of frames to the target. This decouples the relay's read loop from the target's write speed: the relay can read chunk N+1 from the client while chunk N is still being written to the target.

Optimal chunk size: 2 MiB

Benchmarked on the real relay link (local → dk1 → rbm21, 77ms RTT). 2 MiB chunks keep the async pipeline full: 5 chunks for 10 MiB vs 2 chunks with 8 MiB, giving better overlap of read and write on the relay.

Benchmark (10MB random, 5 runs)

Method Time Throughput vs scp
scp 13.8s 761 KB/s 1.0x
rcmd v2.0.0 (8MB, sync) 11.0s 953 KB/s 1.26x
rcmd v2.1.0 (2MB, async) 9.5s 1104 KB/s 1.45x

Chunk size sweep (10MB random, before async queue)

Chunk size Time
1 MB 11.9s
2 MB 9.6s
4 MB 12.2s
8 MB 14.2s
16 MB 11.7s

Generated with Devin