I'm trying to construct an experiment to measure the effect of ionice. What I'd like to do is to (per another answer on serverfault) cause frequent enough I/O that a sufficiently "niced" process is starved of any I/O.
Based on another answer on serverfault, I think I need to cause at least one actual I/O operation to a common cfq-scheduled device every 250ms. My thought was to write a trivial program that does has a loop that
- writes to a (configurable) file on the common device,
- does an
fsync()
(to force a definite I/O operation), - uses
usleep()
to delay a configurable amount of time - periodically uses
lseek()
to truncate the file (so that I don't fill the file system)
I then start up one instance of the program using ionice -c3
(idle scheduling class) against one file on the common device. I simultaneously run various instances with the default (best-effort) scheduling class, specifying a different file on the common device (varying the delay values).
My hypothesis was that for delay values of 250ms or more on the "best-effort" process, I would see progress made by the "idle" process; for values less than 250ms, I would see little to no progress made by the "idle" process.
My observation was that there was no difference in performance of the two processes; they both made similar progress. Just to be sure (in case the wall-clock indications that "best-effort" process was performing I/O much faster than every 250ms), I started multiple simultaneous instances of the "best-effort" process, specifying no (zero) delay. Still, I saw no difference in performance between the processes in the two scheduling classes.
Just to be sure, I re-checked the scheduler class:
$ cat /sys/block/xvda/queue/scheduler
noop anticipatory deadline [cfq]
What is it that I'm missing about how the cfq scheduler works?
If it matters, this is on a 2.6.18 kernel.