Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB Readahead warning

Tags:

linux

mongodb

I'm receiving this warning when starting my MongoDB shell:

Wed Mar 20 22:40:49.850 [initandlisten]

Wed Mar 20 22:40:49.850 [initandlisten] ** WARNING: Readahead for /data is set to 2048KB

Wed Mar 20 22:40:49.850 [initandlisten] ** We suggest setting it to 256KB (512 sectors) or less

Wed Mar 20 22:40:49.850 [initandlisten] ** http://dochub.mongodb.org/core/readahead

I've used:

df /data

To find where the drive is that my data is mounted and subsequently used:

sudo blockdev --setra 256 /dev/mapper/vg0-data

to set the readahead to the 256 that was specified. I've confirmed this has worked with:

sudo blockdev --getra /dev/mapper/vg0-data

I'm still however getting the same error when starting my shell?

UPDATE

I've restarted the mongodb server instance and am still receiving this error.

UPDATE 2

My linux server is hosted on AWS and therefore uses virtual volumes. I have set the readahead value for all those volumes to 256 and still receive this error.

UPDATE 3

This is a blockdev --report of the Primary instance of MongoDB

RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0      8589934592   /dev/xvda1
rw   256   512  4096          0     10737418240   /dev/xvdh8
rw   256   512  4096          0     10737418240   /dev/xvdh7
rw   256   512  4096          0     10737418240   /dev/xvdh6
rw   256   512  4096          0     10737418240   /dev/xvdh5
rw   256   512  4096          0     10737418240   /dev/xvdh4
rw   256   512  4096          0     10737418240   /dev/xvdh3
rw   256   512  4096          0     10737418240   /dev/xvdh2
rw   256   512  4096          0     10737418240   /dev/xvdh1
rw  4096   512  4096          0     42944430080   /dev/md127
rw  4096   512  4096          0     38646317056   /dev/dm-0
rw  4096   512  4096          0      2143289344   /dev/dm-1
rw  4096   512  4096          0      2143289344   /dev/dm-2

This is a blockdev --report of the Secondary instance of MongoDB

RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0      8589934592   /dev/xvda1
rw   256   512  4096          0     10737418240   /dev/xvdh8
rw   256   512  4096          0     10737418240   /dev/xvdh7
rw   256   512  4096          0     10737418240   /dev/xvdh6
rw   256   512  4096          0     10737418240   /dev/xvdh5
rw   256   512  4096          0     10737418240   /dev/xvdh4
rw   256   512  4096          0     10737418240   /dev/xvdh3
rw   256   512  4096          0     10737418240   /dev/xvdh2
rw   256   512  4096          0     10737418240   /dev/xvdh1
rw  4096   512  4096          0     42944430080   /dev/md127
rw  4096   512  4096          0     38646317056   /dev/dm-0
rw  4096   512  4096          0      2143289344   /dev/dm-1
rw  4096   512  4096          0      2143289344   /dev/dm-2

This is a blockdev --report of the Arbiter instance of MongoDB

RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0      8589934592   /dev/xvda1
like image 520
Josh Elias Avatar asked May 23 '13 14:05

Josh Elias


1 Answers

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.

like image 54
Josh Elias Avatar answered Oct 01 '22 18:10

Josh Elias