Found an Ideal I/O Scheduler for my MySQL boxes
Today I was doing some work on one of our database servers (each of them has 4 SAS disks in RAID10 on an Adaptec controller) and it required huge multi-thread I/O-bound read load. Basically it was a set of parallel full-scan reads from a 300Gb compressed innodb table (yes, we use innodb plugin). Looking at the iostat I saw pretty expected results: 90-100% disk utilization and lots of read operations per second. Then I decided to play around with linux I/O schedulers and try to increase disk subsystem throughput. Here are the results:
| Scheduler | Reads per second |
|---|---|
| cfq | 20000-25000 |
| noop | 35000-60000 |
| deadline | 33000-45000 |
| anticipatory | 22000-29000 |
Notice: The box can’t be restarted to check with clean caches and stuff, but I was doing full reads from this huge table on a machine with 16Gb RAM so all caches were washed out by this load anyways.
As you can see, less work linux does on its side to optimize disk I/O, slower it works
Actually it was pretty expected, but still – surprising result. The problem (as guys from Youtube explained on the last year MySQL Conf) is there because Linux knows nothing about RAID’s internals and specific drives’ queues so when it is trying to re-arrange requests in its own queue it wastes CPU resources and could potentially prevent RAID controller from doing its own queue optimizations.
After this test I’ve tried it on a few other I/O-bound servers (both read and write bound) and the result was the same – noop (do nothing) I/O scheduler gave me the best results. Long story short, I’ve decided to try this scheduler on all our boxes for a week and look at the results in cacti graphs to see how it works.
Related posts:
- MySQL Performance Blog – Отличный ресурс для администраторов MySQL
- Список 1000 (84) Лучших Советов по Производительности MySQL с MySQL Camp 2006
- MySql Больше не предоставляет бинарные сборки своим пользователям?
- MySQL UC 2007 Videos are Available!
- Rails Developer for a Large Startup: My Vision of an Ideal Candidate
11 Responses to this entry
Result is predictable, this situation (raid controller) described in many documents about linux io scheduler. Scheduler (any) works only for hdd without any raid controllers.
echo 1 > /proc/sys/vm/drop_caches
Kernel version?
Well there isn’t much that the I/O schedulers can do if your access pattern is quite random beyond maybe giving you better average latencies .
Running cfq with slice_idle=0 might be a good idea btw, keeping the disks idle for up to slice_idle (8ms by default) isn’t probably the best option for a db workload.
It would be interesting to get some plots/movies from seekwatcher also, I find that it gives you a nice insight on your workload and how each scheduler is affecting it.
2.6.18-53.el5
what is the number of threads in mysqld?
2Yordan: There were 8 separate threads in our “database load generation tool” (sphinx indexer) + some number of requests is being done from the site directly.
Link to the conference:
http://video.google.com/videoplay?docid=-6304964351441328559
[...] =”http://coderchina.72pines.com/feed/”; 刚读一Mysql DBA写的文章受到提示,知道了Linux下的IO [...]
Спасибо!очнь интересная статья!
mysql :: Homo-Adminus Blog by Alexey Kovyrin…
Disk IO performance…