2

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?

  • You can try explicit write flushing with msync(2) or fdatasync(2) – meuh Oct 28 '15 at 14:31
  • @meuh: yes, but that does nothing for the priority between reads and writes. – ronag Oct 28 '15 at 14:34
1

ionice allows to change priority per process. From what I understand, you have some processes that write and some that read. Man page says it applies to CFQ scheduler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.