I have been running into issues on my main desktop system running Ubuntu, under high disk IO the system would lock up for couple seconds for no apparent reason (it was locking up for longer than could be expected).
After going through numerous websites, the conclusion I have reached is that by having a lot of memory, the system would cache a sizeable amount of data in RAM before flushing to disk.
In addition to having relatively high amount of (free) RAM and slower disk the system would hiccup trying to flush all available data.
vm.dirty_background_ratio = 1 vm.dirty_ratio = 2
/etc/sysctl.conf (and reboot)
These settings lower the available memory limits for system to cache data, forcing it to start writing to disk sooner, smoothing out the disk IO over slightly longer time.
This is reasonable scenario when using system as a desktop, in server environment you might want different behaviour.
Relevant system spec
- Ubuntu 20.04 LTS
- 64 GB RAM
- Samsung SSD 970 EVO Plus 1TB