3

System is Ubuntu 10 LTS 64bit (2.6.35.31), I'm running on xen 4.0, no services active, cron stopped, scheduler is cfq for the disk /usr is mounted from:

time find /usr -exec stat {} \; > /dev/null 2>&1 &

giving

real    0m35.760s
user    0m0.270s
sys 0m3.910s

and

time ionice -c3 find /usr -exec stat {} \; > /dev/null 2>&1 &

giving

real    0m36.110s
user    0m0.310s
sys 0m4.100s

which is exactly as expected, now I run both at the same time:

time find /usr -exec stat {} \; > /dev/null 2>&1 & time ionice -c3 find /usr -exec stat {} \; > /dev/null 2>&1 &

where to my believe the ioniced version should be much slower while the straight version should be as fast as if running alone. but:

straight:

real    1m10.430s
user    0m0.320s
sys 0m3.940s

ioniced:

real    1m10.230s
user    0m0.250s
sys 0m4.020s

which implies that ionice did not work at all. Any hints?

Khaled
  • 35,688
  • 8
  • 69
  • 98
tim
  • 1,197
  • 3
  • 10
  • 23

2 Answers2

3

This almost certainly isn't working because you're not using the CFQ kernel scheduler.

Look at /sys/block/xvdh/queue/scheduler to see which you are using. The one in [] brackets is the active one.

It seems to be deadline on most systems now, for which ionice doesn't work. (This all as far as I can tell, it's terribly badly documented).

frabcus
  • 204
  • 2
  • 6
2

Since both processes are asking for the same files, whichever one gets there second will get them from the filesystem cache. Since it isn't actually moving spindles, it isn't affected by ionice.

Ladadadada
  • 25,847
  • 7
  • 57
  • 90
  • Well, If you were right, the second process must have been much faster. Which it isn't. – tim Jan 27 '12 at 10:30
  • 2
    As soon as the second one overtakes the first one, it becomes the first one. At that point, it **is** moving spindles and the other one is reading from the cache. Whichever one is behind will catch up easily but can't overtake. – Ladadadada Jan 27 '12 at 11:00
  • 1
    That makes little sense, as one of them is ionice idle, whereas the other isn't! – frabcus Jun 06 '14 at 14:38