roles/common: Set I/O scheduler via udev

All servers with non-rotating disks (SSDs) should be running noop,
and the rest should be running deadline.

Signed-off-by: Alan Orth <alan.orth@gmail.com>
This commit is contained in:
Alan Orth 2015-03-15 17:52:05 +03:00
parent 9fda345a24
commit 3a5b50f941
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 24 additions and 0 deletions

View File

@ -43,6 +43,10 @@
when: ansible_distribution == 'Ubuntu'
template: src=rc.local_{{ ansible_distribution }}.j2 dest=/etc/rc.local owner=root group=root mode=0755
- name: Set I/O scheduler
template: src=etc/udev/rules.d/60-scheduler.rules.j2 dest=/etc/udev/rules.d/60-scheduler.rules owner=root group=root mode=0644
tags: udev
- include: ssh-keys.yml
tags: ssh-keys

View File

@ -0,0 +1,20 @@
# set noop scheduler for non-rotating disks (SSD)
# the glob matches sd* on physical hosts, xvd* on Xen hosts, and vd* on KVM hosts
ACTION=="add|change", KERNEL=="xvd[a-z]|[sv]d[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="noop"
# set deadline scheduler for rotating disks
# the glob matches sd* on physical hosts, xvd* on Xen hosts, and vd* on KVM hosts
#
# newer KVM guests (Ubuntu 14.04 at least, so Linux >=3.13) using virtio vda don't
# allow it to be set, but it's non fatal so let's just set it for now
ACTION=="add|change", KERNEL=="xvd[a-z]|[sv]d[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="deadline"
{% if 'storage' in group_names %}
## set disk tweaks
## see: http://www.fhgfs.com/wiki/wikka.php?wakka=StorageServerTuning
## see: http://community.gluster.org/a/linux-kernel-tuning-for-glusterfs/
# give the IO scheduler more flexibility by increasing the number of schedulable requests (queue_depth * 2):
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/nr_requests}="512"
# To improve throughput for sequential reads, increase the maximum amount of read-ahead data. The actual amount of read-ahead is adaptive, so using a high value here won't harm performance for small random access.
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/read_ahead_kb}="4096"
{% endif %}