I'm trying to limit IO usage of a service (or process/command). (Limit for IO read/write on hardware device, not for network.)
I found IOAccounting from systemd:
systemd-run --scope --user -p "IOReadBandwidthMax=/dev/zero 1M" -p "IOAccounting=true" \
time dd if=/dev/zero count=1 bs=100M of=/tmp/foo conv=fdatasync
systemd-run --scope --user -p "IOWriteBandwidthMax=/dev/sdd 1M" -p "IOAccounting=true"
time dd if=/dev/zero count=1 bs=100M of=/tmp/foo conv=fdatasync
The command ends quickly and report 200/300 MB/s. Exactly the same results when I run the command, without systemd-run wrapper.
I tried also to write the systemd service, without systemd-run: IO bandwidth limitation is not working.
Do you have any tips?