❮ zur Übersicht

ionice and the lullaby

  • Autor: Max Ferstl
  • Datum: 20.10.2010

Back in 2003, I’ve been working as trainee at a big webhosting company. Back in the days I’ve been really keen on the upcoming 2.6 linux kernel series, and compiled nearly every RC, but when the real working at the providers abuse department started I’ve lost track of all the new features that are implemented into the kernel, besides the “popular” stuff, like btrfs…

That’s the reason I totally missed out the CFQ io scheduler, which is currently the default scheduler for io used by vanilla kernels, and is available in linux kernel since 2.6.13 (commit), until yesterday in the evening, when I was “forced” to refresh my knowledge on io scheduling.

While aptitude was extracting and installing loads of updates, and my torrent client doing some voodoo while downloading some episodes of Chaos Radio Express my raid got performance issues when I tried to watch a Concert Video of Reyn Ouwehand, kinda the nerd version of mothers good old lullaby.

So, being a bit sleepy the first thing i thought was “Hey, in 2010 there must be a way to schedule io on a linux system.”, so I opened up a shell, typed io\t\t and, like a punch in my face, ionice showed up… So I read the manpage, which is short and good, so there’s no need to explain all the stuff here. The most important, and the only 2 switches for scheduling your io are -c and -n ---snip--- -c class The scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -n classdata The scheduling class data. This defines the class data, if the class accepts an argument. For real time and best effort, 0-7 is valid data. ---snip---

When I fired up my video with the command ionice -n 0 mplayer BP08_Concert_ReynOuwehand.mp4, the video still stopped every now and then… After blaming my hardware, I came up with the idea of checking which priorities are used by the software blocking my io. I was sure the torrent client uses the default value for ubuntu (-n 4), but when I checked aptitude by ionice -p $aptitude_PID I discovered that aptitude seems to use -n 0, so I lowered the priority of aptitude and was finally able to view the video without random hangs, but at the time the need of a lullaby was gone ; )

Tags: kernel linux