MongoDB Readahead warning

The answer was to run blockdev --setra in a startup script. Every time the system reboots the read-ahead values revert back to default.

In my case I just figured out what my logical drives were with blockdev --report, I then run blockdev --setra on every drive in the "start" section of the MongoDB startup script in init.d.

Hope this helps anybody else having similar issues.


You can do this:

echo 'ACTION=="add", KERNEL=="xvdb", ATTR{bdi/read_ahead_kb}="64"' | sudo tee -a /etc/udev/rules.d/85-ebs.rules
echo 'ACTION=="add", KERNEL=="xvdc", ATTR{bdi/read_ahead_kb}="64"' | sudo tee -a  /etc/udev/rules.d/85-ebs.rules
echo 'ACTION=="add", KERNEL=="xvdd", ATTR{bdi/read_ahead_kb}="64"' | sudo tee -a /etc/udev/rules.d/85-ebs.rules
echo 'ACTION=="add", KERNEL=="xvde", ATTR{bdi/read_ahead_kb}="64"' | sudo tee -a   /etc/udev/rules.d/85-ebs.rules
echo 'ACTION=="add", KERNEL=="dm-0", ATTR{bdi/read_ahead_kb}="64"' | sudo tee -a /etc/udev/rules.d/85-ebs.rules
echo 'ACTION=="add", KERNEL=="dm-1", ATTR{bdi/read_ahead_kb}="64"' | sudo tee -a /etc/udev/rules.d/85-ebs.rules
echo 'ACTION=="add", KERNEL=="dm-2", ATTR{bdi/read_ahead_kb}="64"' | sudo tee -a /etc/udev/rules.d/85-ebs.rules
echo 'ACTION=="add", KERNEL=="md127", ATTR{bdi/read_ahead_kb}="64"' | sudo tee -a /etc/udev/rules.d/85-ebs.rules

where KERNEL=="" is your HDD device

then on restart everything will be set properly

rw   256   512  4096          0     42949672960   /dev/xvda1
rw   128   512  4096          0    214748364800   /dev/xvdc
rw   128   512  4096          0    214748364800   /dev/xvde
rw   128   512  4096          0    214748364800   /dev/xvdd
rw   128   512  4096          0    214748364800   /dev/xvdb
rw   128   512  4096          0    429227769856   /dev/md127
rw   128   512  4096          0    343379279872   /dev/dm-0
rw   128   512  4096          0     42920312832   /dev/dm-1
rw   128   512  4096          0     42920312832   /dev/dm-2

Tags:

Linux

Mongodb