Skip to content
Snippets Groups Projects
Commit 0479cfaf authored by Ilya Verbin's avatar Ilya Verbin Committed by Vladimir Davydov
Browse files

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
parent 1b4a81fa
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment