Revision aed7abbcca7574ed438c3b22e27db9bf249e8de3 authored by Xin Tong on 18 May 2018, 00:49:06 UTC, committed by Facebook Github Bot on 18 May 2018, 00:57:48 UTC
Summary:
Running. TEST_TMPDIR=/dev/shm ./buck-out/gen/rocks/tools/rocks_db_bench --benchmarks=readwhilewriting --num=5000000 -benchmark_write_rate_limit=2000000 --threads=32

Collected esan data and reorder field. Accesses to 4th and 6th fields take majority of the access.  Group them. Overall, this struct takes 10%+ of the total accesses in the program. (637773011/6107964986)

==2433831==  class rocksdb::InlineSkipList
==2433831==   size = 48, count = 637773011, ratio = 112412, array access = 0
==2433831==   # 0: offset = 0,   size = 2,       count = 455137, type = i16
==2433831==   # 1: offset = 2,   size = 2,       count = 6,      type = i16
==2433831==   # 2: offset = 4,   size = 4,       count = 182303, type = i32
==2433831==   # 3: offset = 8,   size = 8,       count = 263953900, type = %"class.rocksdb::MemTableRep::KeyComparator"*
==2433831==   # 4: offset = 16,  size = 8,       count = 136409, type = %"class.rocksdb::Allocator"*
==2433831==   # 5: offset = 24,  size = 8,       count = 366628820, type = %"struct.rocksdb::InlineSkipList<const rocksdb::MemTableRep::KeyComparator &>::Node"*
==2433831==   # 6: offset = 32,  size = 4,       count = 6280031, type = %"struct.std::atomic" = type { %"struct.std::__atomic_base" }
==2433831==   # 7: offset = 40,  size = 8,       count = 136405, type = %"struct.rocksdb::InlineSkipList<const rocksdb::MemTableRep::KeyComparator &>::Splice"*
==2433831==EfficiencySanitizer: total struct field access count = 6107964986

Before re-ordering
[trentxintong@devbig460.frc2 ~/fbsource/fbcode]$ fgrep readwhilewriting
without-ro.log
readwhilewriting :       0.036 micros/op 27545605 ops/sec;   26.8 MB/s
(45954 of 5000000 found)
readwhilewriting :       0.036 micros/op 28024240 ops/sec;   27.2 MB/s
(43158 of 5000000 found)
readwhilewriting :       0.037 micros/op 27345145 ops/sec;   27.1 MB/s
(46725 of 5000000 found)
readwhilewriting :       0.037 micros/op 27072588 ops/sec;   27.3 MB/s
(42605 of 5000000 found)
readwhilewriting :       0.034 micros/op 29578781 ops/sec;   28.3 MB/s
(44294 of 5000000 found)
readwhilewriting :       0.035 micros/op 28528304 ops/sec;   27.7 MB/s
(44176 of 5000000 found)
readwhilewriting :       0.037 micros/op 27075497 ops/sec;   26.5 MB/s
(43763 of 5000000 found)
readwhilewriting :       0.036 micros/op 28024117 ops/sec;   27.1 MB/s
(40622 of 5000000 found)
readwhilewriting :       0.037 micros/op 27078709 ops/sec;   27.6 MB/s
(47774 of 5000000 found)
readwhilewriting :       0.034 micros/op 29020689 ops/sec;   28.1 MB/s
(45066 of 5000000 found)
AVERAGE()=27.37 MB/s

After re-ordering
[trentxintong@devbig460.frc2 ~/fbsource/fbcode]$ fgrep readwhilewriting
ro.log
readwhilewriting :       0.036 micros/op 27542409 ops/sec;   27.7 MB/s
(46163 of 5000000 found)
readwhilewriting :       0.036 micros/op 28021148 ops/sec;   28.2 MB/s
(46155 of 5000000 found)
readwhilewriting :       0.036 micros/op 28021035 ops/sec;   27.3 MB/s
(44039 of 5000000 found)
readwhilewriting :       0.036 micros/op 27538659 ops/sec;   27.5 MB/s
(46781 of 5000000 found)
readwhilewriting :       0.036 micros/op 28028604 ops/sec;   27.6 MB/s
(44689 of 5000000 found)
readwhilewriting :       0.036 micros/op 27541452 ops/sec;   27.3 MB/s
(43156 of 5000000 found)
readwhilewriting :       0.034 micros/op 29041338 ops/sec;   28.8 MB/s
(44895 of 5000000 found)
readwhilewriting :       0.036 micros/op 27784974 ops/sec;   26.3 MB/s
(39963 of 5000000 found)
readwhilewriting :       0.036 micros/op 27538892 ops/sec;   28.1 MB/s
(46570 of 5000000 found)
readwhilewriting :       0.038 micros/op 26622473 ops/sec;   27.0 MB/s
(43236 of 5000000 found)
AVERAGE()=27.58 MB/s
Closes https://github.com/facebook/rocksdb/pull/3855

Reviewed By: siying

Differential Revision: D8048781

Pulled By: trentxintong

fbshipit-source-id: bc9807a9845e2a92cb171ce1ecb5a2c8a51f1481
1 parent fa43948
History
File Mode Size
adaptive_table_factory.cc -rw-r--r-- 4.8 KB
adaptive_table_factory.h -rw-r--r-- 1.8 KB
block.cc -rw-r--r-- 14.6 KB
block.h -rw-r--r-- 13.2 KB
block_based_filter_block.cc -rw-r--r-- 8.1 KB
block_based_filter_block.h -rw-r--r-- 4.6 KB
block_based_filter_block_test.cc -rw-r--r-- 8.0 KB
block_based_table_builder.cc -rw-r--r-- 33.8 KB
block_based_table_builder.h -rw-r--r-- 5.0 KB
block_based_table_factory.cc -rw-r--r-- 18.4 KB
block_based_table_factory.h -rw-r--r-- 6.9 KB
block_based_table_reader.cc -rw-r--r-- 102.2 KB
block_based_table_reader.h -rw-r--r-- 24.1 KB
block_builder.cc -rw-r--r-- 4.5 KB
block_builder.h -rw-r--r-- 2.1 KB
block_fetcher.cc -rw-r--r-- 7.9 KB
block_fetcher.h -rw-r--r-- 2.7 KB
block_prefix_index.cc -rw-r--r-- 7.8 KB
block_prefix_index.h -rw-r--r-- 2.2 KB
block_test.cc -rw-r--r-- 16.8 KB
bloom_block.cc -rw-r--r-- 700 bytes
bloom_block.h -rw-r--r-- 1.0 KB
cleanable_test.cc -rw-r--r-- 6.3 KB
cuckoo_table_builder.cc -rw-r--r-- 19.2 KB
cuckoo_table_builder.h -rw-r--r-- 4.6 KB
cuckoo_table_builder_test.cc -rw-r--r-- 26.5 KB
cuckoo_table_factory.cc -rw-r--r-- 2.6 KB
cuckoo_table_factory.h -rw-r--r-- 2.9 KB
cuckoo_table_reader.cc -rw-r--r-- 13.5 KB
cuckoo_table_reader.h -rw-r--r-- 2.8 KB
cuckoo_table_reader_test.cc -rw-r--r-- 19.5 KB
filter_block.h -rw-r--r-- 4.7 KB
flush_block_policy.cc -rw-r--r-- 3.1 KB
format.cc -rw-r--r-- 14.3 KB
format.h -rw-r--r-- 9.5 KB
full_filter_bits_builder.h -rw-r--r-- 2.8 KB
full_filter_block.cc -rw-r--r-- 4.8 KB
full_filter_block.h -rw-r--r-- 4.5 KB
full_filter_block_test.cc -rw-r--r-- 7.0 KB
get_context.cc -rw-r--r-- 8.4 KB
get_context.h -rw-r--r-- 3.7 KB
index_builder.cc -rw-r--r-- 6.9 KB
index_builder.h -rw-r--r-- 13.7 KB
internal_iterator.h -rw-r--r-- 4.8 KB
iter_heap.h -rw-r--r-- 1.2 KB
iterator.cc -rw-r--r-- 5.8 KB
iterator_wrapper.h -rw-r--r-- 3.2 KB
merger_test.cc -rw-r--r-- 4.5 KB
merging_iterator.cc -rw-r--r-- 13.5 KB
merging_iterator.h -rw-r--r-- 2.0 KB
meta_blocks.cc -rw-r--r-- 15.2 KB
meta_blocks.h -rw-r--r-- 5.0 KB
mock_table.cc -rw-r--r-- 4.3 KB
mock_table.h -rw-r--r-- 5.6 KB
partitioned_filter_block.cc -rw-r--r-- 11.2 KB
partitioned_filter_block.h -rw-r--r-- 4.0 KB
partitioned_filter_block_test.cc -rw-r--r-- 10.0 KB
persistent_cache_helper.cc -rw-r--r-- 4.4 KB
persistent_cache_helper.h -rw-r--r-- 1.5 KB
persistent_cache_options.h -rw-r--r-- 1.0 KB
plain_table_builder.cc -rw-r--r-- 9.4 KB
plain_table_builder.h -rw-r--r-- 4.6 KB
plain_table_factory.cc -rw-r--r-- 8.8 KB
plain_table_factory.h -rw-r--r-- 8.4 KB
plain_table_index.cc -rw-r--r-- 7.3 KB
plain_table_index.h -rw-r--r-- 7.1 KB
plain_table_key_coding.cc -rw-r--r-- 17.4 KB
plain_table_key_coding.h -rw-r--r-- 7.4 KB
plain_table_reader.cc -rw-r--r-- 24.2 KB
plain_table_reader.h -rw-r--r-- 8.0 KB
scoped_arena_iterator.h -rw-r--r-- 1.6 KB
sst_file_writer.cc -rw-r--r-- 8.8 KB
sst_file_writer_collectors.h -rw-r--r-- 2.7 KB
table_builder.h -rw-r--r-- 4.9 KB
table_properties.cc -rw-r--r-- 8.5 KB
table_properties_internal.h -rw-r--r-- 1.1 KB
table_reader.h -rw-r--r-- 4.3 KB
table_reader_bench.cc -rw-r--r-- 12.3 KB
table_test.cc -rw-r--r-- 117.1 KB
two_level_iterator.cc -rw-r--r-- 6.2 KB
two_level_iterator.h -rw-r--r-- 1.6 KB

back to top