Rate-limit pipes with pv
Here’s a short one: pv
can be used to rate-limit pipes.
pv is often used to show the progress of operations, but it offers a lot more.
In my case, I had to limit the network usage of a zfs send/recv that was running over ssh, because the traffic was disturbing other processes who needed the bandwidth as well.
Turns out it’s easy with pv:
zfs send ... | pv -L 5M | ssh remote zfs recv ...
limits the pipe to 5M/s.