Deadline Scheduler

Posted By: Tony Baird

Last Updated: Monday February 23, 2009

Most modern Linux distributions have the default scheduler as CFG for all block devices but we’ve found for us and from our reading many other web hosts are finding this to not be the best scheduler.  There are several schedulers available which you can read about here: http://www.redhat.com/magazine/008jun05/features/schedulers/ .  The one we’re using now and have for a little bit has been the deadline scheduler.  It is also the choice of many web hosts trying to squeeze every little bit of performance out of their servers.  It is actually very easy to determine the scheduler you’re running as well as change it on the fly to see if the changes make a difference.

You can check what scheduler you’re running by doing:

cat /sys/block/sdX/queue/scheduler

Replacing X with your block device which in most cases will be a so you’d run:

cat /sys/block/sda/queue/scheduler

Right now you’ll see something like [cfg] which means you’re using the cfg scheduler.  You can change the scheduler to deadline by running the following:

echo deadline > /sys/block/sdX/queue/scheduler

replacing X with the device so in most cases you’ll have a for sda.

If you wish for it to be added automatically upon a reboot you just need to add it on your bootloader as elevator=deadline.  For example this is what it would look like

kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ console=tty0 console=ttyS1,19200n8 elevator=deadline

Obviously yours might differ but essentially just add the elevator portion to the end.

Now our experience with this has been a dramatic improvement.  This is especially true when running litespeed compared to apache.  This mostly has to do with how i/o can affect litespeed in comparison to say our old environment of apache with numerous children processes and threads.

I hope this helps out the few looking to squeeze a little bit extra out of their server when it comes to i/o.

Ready to get started? Build your site from
$2.24/mo
GET STARTED NOW