linux poison RSS
linux poison Email

How To Set the Disk IO Priority For a Process on Linux - ionice

ionice program sets or gets the io scheduling class and priority for a program. If no arguments or just -p is given, ionice will query the current io scheduling class and priority for that process.

A process can be in one of three scheduling classes:
Idle
A program running with idle io priority will only get disk time when no other program has asked for disk io for a defined grace period. The impact of idle io processes on normal system activity should be zero. This scheduling class does not take a priority argument. This scheduling class is permitted for an ordinary user (since kernel 2.6.25).
Best effort
This is the effective scheduling class for any process that has not asked for a specific io priority. This class takes a priority argument from 0-7, with lower number being higher priority. Programs running at the same best effort priority are served in a round-robin fashion.

Real time
The RT scheduling class is given first access to the disk, regardless of what else is going on in the system. Thus the RT class needs to be used with some care, as it can starve other processes. As with the best effort class, 8 priority levels are defined denoting how big a time slice a given process will receive on each scheduling window. This scheduling class is not permitted for an ordinary (i.e., non-root) user.
Using IOnice:
Sets process with PID 5668 as an idle io process.
sudo ionice -c3 -p 5668
Prints the class and priority of the processes with PID 5668.
sudo ionice -p 5668

WARNING:
Read the description for realtime carefully. Realtime IO nice processes will starve the system completely until they are done using the disk. You can easily make your system non responsive for long periods of time.

Also, IO niceness only has effect if you are using the CFQ io scheduler . If you have an elevator= (as, deadline,noop) line in your menu.lst, IO niceness will have no effect.




1 comments:

Post a Comment

Related Posts with Thumbnails