rocksdb/include/rocksdb
Sagar Vemuri 3548e4220d Improve explicit user readahead performance (#5246)
Summary:
Improve the iterators performance when the user explicitly sets the readahead size via `ReadOptions.readahead_size`.

1. Stop creating new table readers when the user explicitly sets readahead size.
2. Make use of an internal buffer based on `FilePrefetchBuffer` instead of using `ReadaheadRandomAccessFileReader`, to handle the user readahead requests (for both buffered and direct io cases).
3. Add `readahead_size` to db_bench.

**Benchmarks:**
https://gist.github.com/sagar0/53693edc320a18abeaeca94ca32f5737

For 1 MB readahead, Buffered IO performance improves by 28% and Direct IO performance improves by 50%.
For 512KB readahead, Buffered IO performance improves by 30% and Direct IO performance improves by 67%.

**Test Plan:**
Updated `DBIteratorTest.ReadAhead` test to make sure that:
- no new table readers are created for iterators on setting ReadOptions.readahead_size
- At least "readahead" number of bytes are actually getting read on each iterator read.

TODO later:
- Use similar logic for compactions as well.
- This ties in nicely with #4052 and paves the way for removing ReadaheadRandomAcessFile later.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5246

Differential Revision: D15107946

Pulled By: sagar0

fbshipit-source-id: 2c1149729ca7d779e4e8b7710ba6f4e8cbfd3bea
2019-04-26 21:24:10 -07:00
..
utilities Option string/map/file can set env from object registry (#5237) 2019-04-25 11:35:09 -07:00
advanced_options.h Use creation_time or mtime when file_creation_time=0 (#5184) 2019-04-18 22:39:34 -07:00
c.h Refresh snapshot list during long compactions (#5099) 2019-04-25 18:17:22 -07:00
cache.h Make adaptivity of LRU cache mutexes configurable (#5054) 2019-03-20 12:33:44 -07:00
cleanable.h Support pragma once in all header files and cleanup some warnings (#4339) 2018-09-05 18:13:31 -07:00
compaction_filter.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
compaction_job_stats.h Add a new CPU time counter to compaction report (#4889) 2019-01-29 17:24:00 -08:00
comparator.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
concurrent_task_limiter.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
convenience.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
db_bench_tool.h Change RocksDB License 2017-07-15 16:11:23 -07:00
db_dump_tool.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
db.h Introduce a new MultiGet batching implementation (#5011) 2019-04-11 14:28:26 -07:00
env_encryption.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
env.h Optionally wait on bytes_per_sync to smooth I/O (#5183) 2019-04-22 11:51:39 -07:00
experimental.h Change RocksDB License 2017-07-15 16:11:23 -07:00
filter_policy.h Remove a couple of non-public includes from public header file (#5219) 2019-04-19 11:10:33 -07:00
flush_block_policy.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
iostats_context.h Add a new CPU time counter to compaction report (#4889) 2019-01-29 17:24:00 -08:00
iterator.h Revert "BaseDeltaIterator: always check valid() before accessing key(… (#4744) 2018-12-03 23:38:27 -08:00
ldb_tool.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
listener.h Add copyright headers per FB open-source checkup tool. (#5199) 2019-04-18 10:55:01 -07:00
memory_allocator.h JemallocNodumpAllocator: option to limit tcache memory usage (#4736) 2018-11-29 17:33:40 -08:00
memtablerep.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
merge_operator.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
metadata.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
options.h Improve explicit user readahead performance (#5246) 2019-04-26 21:24:10 -07:00
perf_context.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
perf_level.h Introduce a CPU time counter in perf_context (#4741) 2018-12-20 12:03:44 -08:00
persistent_cache.h Change RocksDB License 2017-07-15 16:11:23 -07:00
rate_limiter.h Fix typos in comments (#4819) 2018-12-26 09:43:56 -08:00
slice_transform.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
slice.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
snapshot.h Change RocksDB License 2017-07-15 16:11:23 -07:00
sst_dump_tool.h tools: use provided options instead of the default (#4839) 2019-01-03 11:23:49 -08:00
sst_file_manager.h Smooth the deletion of WAL files (#5116) 2019-03-28 15:17:13 -07:00
sst_file_reader.h Get CompactionJobInfo from CompactFiles 2018-12-13 14:21:24 -08:00
sst_file_writer.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
statistics.h Introduce a new MultiGet batching implementation (#5011) 2019-04-11 14:28:26 -07:00
stats_history.h add GetStatsHistory to retrieve stats snapshots (#4748) 2019-02-20 15:52:54 -08:00
status.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
table_properties.h Add copyright headers per FB open-source checkup tool. (#5199) 2019-04-18 10:55:01 -07:00
table.h Add BlockBasedTableOptions::index_shortening (#5174) 2019-04-22 08:20:35 -07:00
thread_status.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
threadpool.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
trace_reader_writer.h Add the max trace file size limitation option to Tracing (#4610) 2018-11-27 14:27:05 -08:00
transaction_log.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
types.h WriteUnPrepared: less virtual in iterator callback (#5049) 2019-04-02 14:47:16 -07:00
universal_compaction.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
version.h Update history and version to 6.1.1 (#5171) 2019-04-15 10:49:38 -07:00
wal_filter.h Run automatic formatter against public header files (#5115) 2019-03-27 13:24:25 -07:00
write_batch_base.h Fix WriteBatchBase::DeleteRange API comment (#4935) 2019-01-31 14:43:40 -08:00
write_batch.h refactor SavePoints (#5192) 2019-04-19 20:33:04 -07:00
write_buffer_manager.h WriteBufferManger doens't cost to cache if no limit is set (#4695) 2018-11-18 16:55:43 -08:00