1. Optimize Pre-reading
Optimize IO performance by using the Linux Blockdev command to set the pre-read size to smaller and reduce the unused data consumption in memory
The RA represents the read-ahead size (sector), the recommended value is 16 to 32, such as the document is small, the pre-reading value can be smaller, modified MongoDB restart to take effect.
Read-Ahead default 256 sectors with a size of 128K
MongoDB is a lot of random access, readhead to set a little bit. For example, just read 10k, but read 128K.
[email protected]:~# blockdev--report
RO RA SSZ BSZ startsec Size Device
rw 4096 0 800166076416/DEV/SDA
RW 2048 524288000/dev/sda1
rw 4096 1026048 799639863296/dev/sda2
rw 4096 0 53687091200/dev/dm-0
rw 4096 0 33822867456/dev/dm-1
rw 4096 0 712125710336/dev/dm-2
use the following command
Blockdev--setra 128/dev/sda2
represents a read-ahead size of 128*512 bytes/sector =64k
This article is from the DBA Sky blog, so be sure to keep this source http://9425473.blog.51cto.com/9415473/1661060
MongoDB optimized pre-read