Reputation: 1344
I am getting this warning on mongodb,
WARNING: Readahead for /data is set to 1024KB
We suggest setting it to 256KB (512 sectors) or less
http://dochub.mongodb.org/core/readahead
When querying for this, every link suggests setting readahead value to some less figure and how to set it?
I know that setting it to a lesser value would let me get rid of warning, but I am more interested in what readahead stands for? What would be the repercussions if I set it to higher value?
Upvotes: 3
Views: 4450
Reputation: 2021
Read-ahead is a kernel feature, it works at block device level and is global (is not process-dependend). It is a technique employed in an attempt to improve file reading performance. If the kernel has reason to believe that a particular file is being read sequentially, it will attempt to read blocks from the file into memory before the application requests them. When readahead works, it speeds up the system's throughput, since the reading application does not have to wait for its requests. When readahead fails, instead, it generates useless I/O and occupies memory pages which are needed for some other purpose. (https://lwn.net/Articles/155510/)
Here's a more in depth explanation -> http://man7.org/linux/man-pages/man2/readahead.2.html
In order to fix this ensure that readahead settings for the block devices that store the database files are appropriate. For random access use patterns, set low readahead values. A readahead of 32 (16 kB) often works well.
In Linux:
login as root -> su -
run sudo blockdev --report
to get the readahead settings
run sudo blockdev --setra <value> <device>
to change the readahead settings
Upvotes: 8