3

I have a linux database(MySQL) server(Dell 2950) with a 6-disk RAID 10. The default IO scheduler on it is CFQ. However, from what I have read and heard, there is no need for a scheduler like CFQ when reordering/scheduling is also done by underlying RAID controller; on the contrary since it does not account underlying RAID configuration into account performance may actually degrade with CFQ. The primary concern is to reduce CPU usage and improve throughput. Also, I have seen recommendations of using noop/deadline IO scheduler for databases primarily because of the nature of their R/W access.

So, the question is whether noop or deadline scheduler should be used instead of CFQ in these circumstances.

Raghu
  • 286
  • 1
  • 3
  • 6

2 Answers2

4

Every workload is different. So there's not one size fits all answer to this question. To make things more complicated most of the IO Schedulers have tunables. So the best thing you can do is test with as close to real workload benchmarking as possible. Just as long as your test is repeatable it should work.

You can change IO schedulers on the fly without rebooting which makes experimenting with io schedulers easy to do. To do this use a command like this echo anticipatory | sudo tee /sys/block/sdb/queue/scheduler replacing the anticipatory with the scheduler of choice and sdb with the correct block device. You can also do echo anticipatory > /sys/block/sdb/queue/scheduler if you're logged in as root. I use the tee approach so that I can just use sudo.

Like minaev I've had a lot of luck with Deadline on busy file servers. We didn't have any database stuff as it was mostly image processing with a computing cluster. But they would saturate 2 GigE links and load up that server for 48 hours at a time.

I have also used NOOP when dealing with external RAID arrays. What I mean by external is that the RAID controller is self contained in the external chassis and the server just sees this as a SCSI drive. If the RAID controller is in the server then I think you still want to avoid NOOP. But you should be able to figure out what works best for you with some benchmarking.

3dinfluence
  • 12,449
  • 2
  • 28
  • 41
  • Just a word of caution. You can change the scheduler on the fly, but I had servers freeze when I changed it. They where fairly busy when I switched scheduler and it was some time ago, so it may not be entirely relevant today. – Dan Andreatta Apr 16 '10 at 14:39
  • @Dan Andreatta Good word of caution. I've never run into that myself even while the server was spitting out a couple hundred MB/s but the kernel is always changing and each distro have their own sets of patches they apply to it. So it's quite possible that issue was limited to a certain kernel version or set of distro patches. In any case hopefully that problem has been resolved. – 3dinfluence Apr 16 '10 at 14:51
  • Regarding the benchmarking - I tried out sysbench and bonnie++. Bonnie++ turned out to be better. Are there any better disk benchmarks out there which can stress CPU and disk throughput. – Raghu Apr 16 '10 at 18:22
  • You'll probably want to run some sort of MySQL benchmark since that's your primary purpose. But ideally you'd want some sort of load generator that matches the production workload. – 3dinfluence Apr 16 '10 at 18:53
  • Also note that Anticipatory is not within the latest kernels. Your choices in 2.6.33 are CFQ, noop and Deadline. –  Apr 16 '10 at 22:15
2

Not sure if it helps, but here's an interesting article from Red Hat Magazine: "Choosing an I/O Scheduler for Red Hat® Enterprise Linux® 4 and the 2.6 Kernel". I usually set the scheduler to deadline and it works OK on my servers, but I have to admit I have no figures that would prove that deadline is really better.

minaev
  • 1,617
  • 1
  • 13
  • 13