Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between CFQ, Deadline, and NOOP? [closed]

I'm recompiling my kernel, and I want to choose an I/O scheduler. What's the difference between these?

like image 500
Orcris Avatar asked Feb 18 '12 03:02

Orcris


2 Answers

If you compile them all, you can select at boot time or per-device which scheduler to use. No need to pick at compile time, unless you are targeting an embedded device where every byte counts. See Documentation/block/switching-sched.txt for details on switching per-device or system-wide at boot.

The CFQ scheduler allows you to set priorities via the ionice(1) tool or the ioprio_set(2) system call. This allows giving precedence to some processes or forcing others to do their IO only when the system's block devices are relatively idle. The queues are implemented by segregating the IO requests from processes into queues, and handling the requests from each queue similar to CPU scheduling. Details on configuring it can be found in Documentation/block/cfq-iosched.txt.

The deadline scheduler by contrast looks at all writes from all processes at once; it sorts the writes by sector number, and writes them all in linear fashion. The deadlines means that it tries to write each block before its deadline expires, but within those deadlines, is free to re-arrange blocks as it sees fit. Details on configuring it can be found in Documentation/block/deadline-iosched.txt.

like image 87
sarnold Avatar answered Oct 01 '22 20:10

sarnold


Probably very little in practice.

In my testing, I found that in general NOOP is a bit better if you have a clever RAID controller. Others have reported similar results, but your workload may be different.

However, you can select them at runtime (without reboot) so don't worry about it at compile-time.

My understanding was that the "clever" schedulers (CFQ and deadline) are only really helpful on traditional "spinning disc" devices which don't have a RAID controller.

like image 44
MarkR Avatar answered Oct 01 '22 20:10

MarkR