I need a little help with properly tuning the Linux I/O Scheduler for spinning drives.
I have a process that writes data to a huge (4-16TB) memory mapped file and is using SHED_FIFO. The kernel then flushes dirty pages out to the file automatically based on some to me unknown heuristics. The process writing the data is real-time and mission critical so the batches of disk writes must have priority over reads.
I also have several other processes that reads data from the file through memory mapping that are not mission critical. If the disk can't keep up with both writes and reads it should just do the reads as fast as it can without affecting writes in such a way that the machine runs out of memory.
Now looking at the different I/O schedulers I've found the following behaviours:
- deadline: read has higher priority than write
- cfq: read and write has the same priority
A scheduler that priorities writes over reads does not seem to exist.
Now my initial thought would be to use the "cfq" scheduler and then use "ionic" with a high value on the read processes which in theory should allow the kernel to always properly flush out dirty pages, I think?
Would that actually work? Is there a better way?
EDIT:
Looking at "Concept about Linux Page Cache and pdflush" there seems to be some settings for the Deadline Scheduler one could use:
We're trying the following:
- writes_starved: 2 (default) => 1
- write_expire: 5000 (default) => 500
- read_expire: 500 (default) => 5000
Does that sounds reasonable?
msync(2)
orfdatasync(2)