I'm running a number of MongoDB nodes on dedicated servers running Centos6. Each machine has two SSDs which I have in Raid1 with two logical partitions:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 424G 233G 170G 58% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/md1 496M 116M 355M 25% /boot
# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb2[1] sda2[0]
524224 blocks super 1.0 [2/2] [UU]
md2 : active raid1 sdb3[1] sda3[0]
451545792 blocks super 1.0 [2/2] [UU]
md0 : active raid1 sda1[0] sdb1[1]
16777088 blocks super 1.0 [2/2] [UU]
It is recommended for MongoDB to reduce the read ahead from 256 to ~32 since that give about 16kb which is bigger than the average document.
# sudo blockdev --report
RO RA SSZ BSZ StartSec Size Device
rw 256 512 4096 0 480103981056 /dev/sdb
rw 256 512 512 2048 17179869696 /dev/sdb1
rw 256 512 512 33558528 536871424 /dev/sdb2
rw 256 512 512 34609152 462383047168 /dev/sdb3
rw 256 512 4096 0 480103981056 /dev/sda
rw 256 512 512 2048 17179869696 /dev/sda1
rw 256 512 512 33558528 536871424 /dev/sda2
rw 256 512 512 34609152 462383047168 /dev/sda3
rw 256 512 4096 0 17179738112 /dev/md0
rw 256 512 4096 0 462382891008 /dev/md2
rw 256 512 1024 0 536805376 /dev/md1
Since I have this structure, do I need to just run sudo blockdev --setra 32 /dev/md2
? Since the underlying drives still load 256 will this have any impact, or do I need to manually set the 32 block readahead for all /dev/sdaX and /dev/sdbX also?
Also, is an OS restart required to see the impact of the change in readahead?
Update: I think this is slightly different to the previous questioner, since here the RA for the mdX is much smaller than the underlying block device. I'm thinking that even if /dev/md2
loads only 16kb, the underlying block device will still load 128kb each time.