Tuning Linux I/O Scheduler for SSDs
NOOP is the simplest of all I/O schedulers. It just sends data to a FIFO queue, merges requests to save on disk seeks and passes data on. It can be useful to use NOOP and PostgreSQL in highly virtualized setups where the underlying host system does all the magic.
CFQ is short for “Completely Fair Scheduler”. The idea of CFQ is give all processes belonging to the same priority class same sized time slices. A process performing sequential I/O might receive a lot more bandwidth than a process doing random I/O (in a database random I/O can frequently happen during OLTP-workloads).
CFQ is the default value and usually a good idea for desktop application, which should stay responsive. It is not necessarily a good idea for database servers such as PostgreSQL.
The deadline scheduler tries to make sure that no process can suffer from starvation. The kernel imposes a deadline for each I/O. Practical tests have shown that using deadline is practically always faster than relying on the default (= CFQ). Actually I have not seen a case personally, in which CFQ was better than deadline. In many cases it makes no difference but I have never encountered a scenario in which deadline was the worse choice.
### for Debian, Ubuntu and RHEL 4,5,6,7 echo noop | sudo tee /sys/block/sda/queue/scheduler ### for RHEL 8 echo none | sudo tee /sys/block/sda/queue/scheduler
### Add "elevator=noop" to the GRUB_CMDLINE_LINUX_DEFAULT line. sudo update-grub