box: dynamically adjust xlog readahead size
XLOG_READ_AHEAD defines the number of bytes added to the `count' argument of the `pread' syscall, currently it equals to 16 KB. However xlog and snap files are written by 128 KB chunks of data, which turn into ~80 KB chunks after compression (in average, depending on the data), so the 16 KB read- ahead doesn't make any sense. According to performance experiments, 8 MB readahead gives the best results for large files. However, 8 MB read buffers would increase memory consumption of the replication relays, which usually read small portions of data and does not need such a big buffers. For this reason, dynamically- sized read buffer is implemented by this patch. The minimal readahead is now 128 KB, and the maximal is 8 MB. As a result, the recovery time of a 900 MB snapshot decreased from 25 sec to 13 sec (when reading from HDD). Performance of a recovery from SSD is not affected. Closes #8108 NO_DOC=performance improvement NO_TEST=performance improvement
Showing
- changelogs/unreleased/gh-8108-adjust-xlog_read_ahead.md 4 additions, 0 deletionschangelogs/unreleased/gh-8108-adjust-xlog_read_ahead.md
- src/box/xlog.c 26 additions, 3 deletionssrc/box/xlog.c
- src/box/xlog.h 4 additions, 0 deletionssrc/box/xlog.h
- src/lib/small 1 addition, 1 deletionsrc/lib/small
- test/unit/CMakeLists.txt 4 additions, 0 deletionstest/unit/CMakeLists.txt
- test/unit/xlog.c 161 additions, 0 deletionstest/unit/xlog.c
Loading
Please register or sign in to comment