![](https://pdfstore-manualsonline.prod.a.ki/pdfasset/4/71/4713fe75-cd62-4eff-8525-9c80ed772468/4713fe75-cd62-4eff-8525-9c80ed772468-bg88.png)
4285ch04.fm Draft Document for Review May 4, 2007 11:35 am
122 Linux Performance and Tuning Guidelines
Figure 4-12 Random write throughput comparison between Ext3 and ReiserFS (asynchronous)
Using ionice to assign I/O priority
A new feature of the CFQ I/O elevator is the possibility to assign priorities on an process level.
Using the ionice utility it is now possible to restrict the disk subsystem utilization of a specific
process. At the time of writing this paper there are three priorities that can be assigned using
ionice, these are:
Idle: A process with the assigned I/O priority idle will only be granted access to the disk
subsystems if no other processes with a priority of best-effort or higher request access
to data. This setting is hence very useful for tasks that should only run when the system
has free resources such as the updatedb task.
Best-effort: As a default all processes that do not request a specific I/O priority are
assigned to this class. Processes will inherit 8 levels of the priority of their respective CPU
nice level to the I/O priority class.
Real time: The highest available I/O priority is real time meaning that the respective
process will always be given priority access to the disk subsystem. The real time priority
setting may also accept 8 priority levels. Caution should be used when assigning a thread
a priority level of real time as this process may cause starvation of other tasks.
The ionice tool accepts the following options:
-c<#> I/O priority1 for real time, 2 for best-effort, 3 for idle
-n<#> I/O priority class data 0 to 7
-p<#> process id of a running task, use without -p to start a task with the respective
I/O priority
An example of running ionice is displayed below in Example 4-15 where ionice is used to
assign an idle I/O priority to the process with the PID 113.
0
20000
40000
60000
80000
100000
120000
140000
kB/sec
4 8 16 32 64 128 256 512 1024 2048
kB/op
ReiserFS
Ext3
Ext2