Remove reallocation of AlignedBuffer in direct_io sync reads if already aligned (#11600)
Summary: Remove reallocation of AlignedBuffer in direct_io sync reads in RandomAccessFileReader::Read if buffer passed is already aligned. Pull Request resolved: https://github.com/facebook/rocksdb/pull/11600 Test Plan: Setup: `TEST_TMPDIR=./tmp-db/ ./db_bench -benchmarks=filluniquerandom -disable_auto_compactions=true -target_file_size_base=1048576 -write_buffer_size=1048576 -compression_type=none` Benchmark: `TEST_TMPDIR=./tmp-db/ perf record ./db_bench --cache_size=8388608 --use_existing_db=true --disable_auto_compactions=true --benchmarks=seekrandom --use_direct_reads=true -use_direct_io_for_flush_and_compaction=true -reads=1000 -seek_nexts=1 -max_auto_readahead_size=131072 -initial_auto_readahead_size=16384 -adaptive_readahead=true -num_file_reads_for_auto_readahead=0` Perf profile- Before: ``` 8.73% db_bench libc.so.6 [.] __memmove_evex_unaligned_erms 3.34% db_bench [kernel.vmlinux] [k] filemap_get_read_batch ``` After: ``` 2.50% db_bench [kernel.vmlinux] [k] filemap_get_read_batch 2.29% db_bench libc.so.6 [.] __memmove_evex_unaligned_erms ``` `make crash_test -j `with direct_io enabled completed succesfully locally. Ran few benchmarks with direct_io from seek_nexts varying between 912 to 327680 and different readahead_size parameters and it showed no regression so far. Reviewed By: ajkr Differential Revision: D47478598 Pulled By: akankshamahajan15 fbshipit-source-id: 6a48e21cb34696f5d09c22a6311a3a1cb5f9cf33oxigraph-main
parent
b1b6f87fbe
commit
749b179c04
@ -0,0 +1 @@ |
|||||||
|
In case of direct_io, if buffer passed by callee is already aligned, RandomAccessFileRead::Read will avoid realloacting a new buffer, reducing memcpy and use already passed aligned buffer. |
Loading…
Reference in new issue