Created
September 20, 2011 06:20
-
-
Save tobert/1228485 to your computer and use it in GitHub Desktop.
Tuning Linux MDRAID 5 for acceptable performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Linux RAID5 tuning | |
# Al Tobey 2011-09-19 <al@ooyala.com> | |
for sysent in /sys/block/sd* | |
do | |
drive=$(basename $sysent) | |
sector_size=$(blockdev --getss /dev/$drive) | |
# it should already be CFQ, make sure, I use ionice extensively | |
echo cfq > /sys/block/$drive/queue/scheduler | |
# allow 256 in-flight BIO's per drive for better IO merging | |
echo 256 > /sys/block/$drive/queue/nr_requests | |
# set each drive's readahead to 256k | |
disk_ra=$((2**18 / $sector_size)) | |
blockdev --setra $disk_ra /dev/$drive | |
done | |
# significantly increase the number of entries in the stripe cache (default 128) | |
echo 16384 > /sys/block/md7/md/stripe_cache_size | |
# set RAID5 /data device to 8MB RA | |
sector_size=$(blockdev --getss /dev/md7) | |
blockdev --setra $((2**23)) /dev/md7 | |
# these next few are guesses and not verified, but not really dangerous either | |
# set the RAID1 /commit device RA to 0, since it's practically write-only | |
blockdev --setra 0 /dev/md6 | |
# disable RA on boot, root, and var, underlying device RA should kick in (need to verify) | |
blockdev --setra 0 /dev/md1 # /boot | |
blockdev --setra 0 /dev/md3 # / | |
blockdev --setra 0 /dev/md5 # /var |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment