Given a busy system with a really fast block device (highend NVMe raid, 2 GB/s write, 4 GB/s read) mounted at
/data and an a really slow device (USB HDD with spinning 8 TB disk, 50 MB/s write, 60 MB/s read) mounted at
/backup, how can I limit processes reading from and writing to
/backup without sacrificing I/O of
As far as I know, the problem is that linux only has global knobs
dirty_bytes. If I set those limits to sensible values for NVMe (around 2 GB and 4 GB in practice) the throughput is fine until a process (e.g.
rsync) starts to write to USB with lots of data. In that case
dirty_background is filled with data going to USB device and
rsync is stopped from dirtying more pages. However, that causes processes writing to fast devices to be aggressively slowed down because
dirty_background is global limit and shared between fast and slow devices. I know that I can limit dirty bytes according to slowest device connected to the system and that will avoid huge stalls but will sacrifice some throughput of the faster devices.
Is there equivalent of
dirty_background_bytes for a single block device? It really makes zero sense to slow down all processes writing to
/data in case
/backup is slow and accessed by some other process.
I know that
cgroup can be used to do this manually (How to Throttle per process I/O to a max limit?). However, I would like to adjust this per block device and all processes accessing said devices should be throttled down before slowing down the whole system. If a process writes to both fast and slow devices, it should get slowed down only if it's writing too much to the slow device.