rocksdb/db
Lei Jin 51af7c326c CuckooTable: add one option to allow identity function for the first hash function
Summary:
MurmurHash becomes expensive when we do millions Get() a second in one
thread. Add this option to allow the first hash function to use identity
function as hash function. It results in QPS increase from 3.7M/s to
~4.3M/s. I did not observe improvement for end to end RocksDB
performance. This may be caused by other bottlenecks that I will address
in a separate diff.

Test Plan:
```
[ljin@dev1964 rocksdb] ./cuckoo_table_reader_test --enable_perf --file_dir=/dev/shm --write --identity_as_first_hash=0
==== Test CuckooReaderTest.WhenKeyExists
==== Test CuckooReaderTest.WhenKeyExistsWithUint64Comparator
==== Test CuckooReaderTest.CheckIterator
==== Test CuckooReaderTest.CheckIteratorUint64
==== Test CuckooReaderTest.WhenKeyNotFound
==== Test CuckooReaderTest.TestReadPerformance
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.272us (3.7 Mqps) with batch size of 0, # of found keys 125829120
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.138us (7.2 Mqps) with batch size of 10, # of found keys 125829120
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.142us (7.1 Mqps) with batch size of 25, # of found keys 125829120
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.142us (7.0 Mqps) with batch size of 50, # of found keys 125829120
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.144us (6.9 Mqps) with batch size of 100, # of found keys 125829120

With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.201us (5.0 Mqps) with batch size of 0, # of found keys 104857600
With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.121us (8.3 Mqps) with batch size of 10, # of found keys 104857600
With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.123us (8.1 Mqps) with batch size of 25, # of found keys 104857600
With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.121us (8.3 Mqps) with batch size of 50, # of found keys 104857600
With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.112us (8.9 Mqps) with batch size of 100, # of found keys 104857600

With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.251us (4.0 Mqps) with batch size of 0, # of found keys 83886080
With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.107us (9.4 Mqps) with batch size of 10, # of found keys 83886080
With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.099us (10.1 Mqps) with batch size of 25, # of found keys 83886080
With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.100us (10.0 Mqps) with batch size of 50, # of found keys 83886080
With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.116us (8.6 Mqps) with batch size of 100, # of found keys 83886080

With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.189us (5.3 Mqps) with batch size of 0, # of found keys 73400320
With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.095us (10.5 Mqps) with batch size of 10, # of found keys 73400320
With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.096us (10.4 Mqps) with batch size of 25, # of found keys 73400320
With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.098us (10.2 Mqps) with batch size of 50, # of found keys 73400320
With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.105us (9.5 Mqps) with batch size of 100, # of found keys 73400320

[ljin@dev1964 rocksdb] ./cuckoo_table_reader_test --enable_perf --file_dir=/dev/shm --write --identity_as_first_hash=1
==== Test CuckooReaderTest.WhenKeyExists
==== Test CuckooReaderTest.WhenKeyExistsWithUint64Comparator
==== Test CuckooReaderTest.CheckIterator
==== Test CuckooReaderTest.CheckIteratorUint64
==== Test CuckooReaderTest.WhenKeyNotFound
==== Test CuckooReaderTest.TestReadPerformance
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.230us (4.3 Mqps) with batch size of 0, # of found keys 125829120
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.086us (11.7 Mqps) with batch size of 10, # of found keys 125829120
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.088us (11.3 Mqps) with batch size of 25, # of found keys 125829120
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.083us (12.1 Mqps) with batch size of 50, # of found keys 125829120
With 125829120 items, utilization is 93.75%, number of hash functions: 2.
Time taken per op is 0.083us (12.1 Mqps) with batch size of 100, # of found keys 125829120

With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.159us (6.3 Mqps) with batch size of 0, # of found keys 104857600
With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.078us (12.8 Mqps) with batch size of 10, # of found keys 104857600
With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.080us (12.6 Mqps) with batch size of 25, # of found keys 104857600
With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.080us (12.5 Mqps) with batch size of 50, # of found keys 104857600
With 104857600 items, utilization is 78.12%, number of hash functions: 2.
Time taken per op is 0.082us (12.2 Mqps) with batch size of 100, # of found keys 104857600

With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.154us (6.5 Mqps) with batch size of 0, # of found keys 83886080
With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.077us (13.0 Mqps) with batch size of 10, # of found keys 83886080
With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.077us (12.9 Mqps) with batch size of 25, # of found keys 83886080
With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.078us (12.8 Mqps) with batch size of 50, # of found keys 83886080
With 83886080 items, utilization is 62.50%, number of hash functions: 2.
Time taken per op is 0.079us (12.6 Mqps) with batch size of 100, # of found keys 83886080

With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.218us (4.6 Mqps) with batch size of 0, # of found keys 73400320
With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.083us (12.0 Mqps) with batch size of 10, # of found keys 73400320
With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.085us (11.7 Mqps) with batch size of 25, # of found keys 73400320
With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.086us (11.6 Mqps) with batch size of 50, # of found keys 73400320
With 73400320 items, utilization is 54.69%, number of hash functions: 2.
Time taken per op is 0.078us (12.8 Mqps) with batch size of 100, # of found keys 73400320
```

Reviewers: sdong, igor, yhchiang

Reviewed By: igor

Subscribers: leveldb

Differential Revision: https://reviews.facebook.net/D23451
2014-09-18 11:00:48 -07:00
..
builder.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
builder.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
c.cc Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
c_test.c fix valgrind error in c_test caused by BlockBasedTableOptions 2014-08-26 09:57:25 -07:00
column_family.cc SetOptions() for memtable related options 2014-09-17 12:49:13 -07:00
column_family.h SetOptions() for memtable related options 2014-09-17 12:49:13 -07:00
column_family_test.cc Ignore missing column families 2014-09-02 13:29:05 -07:00
compaction.cc reduce references to cfd->options() in DBImpl 2014-09-08 15:04:34 -07:00
compaction.h Changes to support unity build: 2014-08-11 13:22:47 -04:00
compaction_picker.cc Fix comments and typos 2014-09-09 15:20:49 -07:00
compaction_picker.h Changes to support unity build: 2014-08-11 13:22:47 -04:00
corruption_test.cc move block based table related options BlockBasedTableOptions 2014-08-25 14:22:05 -07:00
cuckoo_table_db_test.cc Fix compaction bug in Cuckoo Table Builder. Use kvs_.size() instead of num_entries in FileSize() method. 2014-09-05 11:18:01 -07:00
db_bench.cc CuckooTable: add one option to allow identity function for the first hash function 2014-09-18 11:00:48 -07:00
db_filesnapshot.cc rename options_ to db_options_ in DBImpl to avoid confusion 2014-09-05 11:48:17 -07:00
db_impl.cc Fix syncronization issues 2014-09-18 10:42:54 -07:00
db_impl.h SetOptions() for memtable related options 2014-09-17 12:49:13 -07:00
db_impl_debug.cc WriteThread 2014-09-12 16:23:58 -07:00
db_impl_readonly.cc Always pass MergeContext as pointer, not reference 2014-09-09 11:37:32 -07:00
db_impl_readonly.h Fix ios compile 2014-08-28 12:46:05 -04:00
db_iter.cc reduce references to cfd->options() in DBImpl 2014-09-08 15:04:34 -07:00
db_iter.h reduce references to cfd->options() in DBImpl 2014-09-08 15:04:34 -07:00
db_iter_test.cc reduce references to cfd->options() in DBImpl 2014-09-08 15:04:34 -07:00
db_test.cc Test use_mmap_reads 2014-09-17 12:31:53 -07:00
dbformat.cc remove_internal_filter_policy 2014-08-28 17:06:29 -07:00
dbformat.h fix a few compile warnings 2014-09-04 23:06:23 +08:00
dbformat_test.cc Use IterKey instead of string in Block::Iter to reduce malloc 2014-07-23 12:31:11 -07:00
deletefile_test.cc
file_indexer.cc Allow user to specify DB path of output file of manual compaction 2014-07-21 19:06:00 -07:00
file_indexer.h Allow user to specify DB path of output file of manual compaction 2014-07-21 19:06:00 -07:00
file_indexer_test.cc Allow user to specify DB path of output file of manual compaction 2014-07-21 19:06:00 -07:00
filename.cc fix more compile warnings 2014-09-05 14:14:37 +08:00
filename.h Support purging logs from separate log directory 2014-08-14 13:22:50 -07:00
filename_test.cc Support purging logs from separate log directory 2014-08-14 13:22:50 -07:00
flush_scheduler.cc Push model for flushing memtables 2014-09-10 18:46:09 -07:00
flush_scheduler.h Push model for flushing memtables 2014-09-10 18:46:09 -07:00
forward_iterator.cc Remove path with arena==nullptr from NewInternalIterator 2014-09-04 17:40:41 -07:00
forward_iterator.h Remove path with arena==nullptr from NewInternalIterator 2014-09-04 17:40:41 -07:00
internal_stats.cc fix more compile warnings 2014-09-05 14:14:37 +08:00
internal_stats.h Add is-file-deletions-enabled property 2014-08-26 16:26:29 -07:00
log_and_apply_bench.cc Push model for flushing memtables 2014-09-10 18:46:09 -07:00
log_format.h
log_reader.cc
log_reader.h
log_test.cc
log_writer.cc
log_writer.h
memtable.cc SetOptions() for memtable related options 2014-09-17 12:49:13 -07:00
memtable.h SetOptions() for memtable related options 2014-09-17 12:49:13 -07:00
memtable_list.cc Always pass MergeContext as pointer, not reference 2014-09-09 11:37:32 -07:00
memtable_list.h Always pass MergeContext as pointer, not reference 2014-09-09 11:37:32 -07:00
merge_context.h
merge_helper.cc Fixed the crash when merge_operator is not properly set after reopen. 2014-07-30 17:24:36 -07:00
merge_helper.h Fixed the crash when merge_operator is not properly set after reopen. 2014-07-30 17:24:36 -07:00
merge_operator.cc
merge_test.cc Temporary remove the last test in merge_test 2014-07-31 11:20:49 -07:00
perf_context_test.cc
plain_table_db_test.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
prefix_test.cc
repair.cc SetOptions() for memtable related options 2014-09-17 12:49:13 -07:00
simple_table_db_test.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
skiplist.h
skiplist_test.cc
snapshot.h fix a few compile warnings 2014-09-04 23:06:23 +08:00
table_cache.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
table_cache.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
table_properties_collector.cc
table_properties_collector.h
table_properties_collector_test.cc fix asan check 2014-09-05 09:53:04 -07:00
transaction_log_impl.cc
transaction_log_impl.h
version_edit.cc
version_edit.h Fix swapped variable names to accurately reflect usage 2014-09-04 20:09:45 -07:00
version_edit_test.cc
version_set.cc SetOptions() for memtable related options 2014-09-17 12:49:13 -07:00
version_set.h rename version_set options_ to db_options_ to avoid confusion 2014-09-08 15:25:01 -07:00
version_set_test.cc
write_batch.cc Push model for flushing memtables 2014-09-10 18:46:09 -07:00
write_batch_internal.h Push model for flushing memtables 2014-09-10 18:46:09 -07:00
write_batch_test.cc SetOptions() for memtable related options 2014-09-17 12:49:13 -07:00
write_controller.cc Push- instead of pull-model for managing Write stalls 2014-09-08 11:20:25 -07:00
write_controller.h Fix #284 2014-09-13 14:14:10 -07:00
write_controller_test.cc Push- instead of pull-model for managing Write stalls 2014-09-08 11:20:25 -07:00
write_thread.cc WriteThread 2014-09-12 16:23:58 -07:00
write_thread.h WriteThread 2014-09-12 16:23:58 -07:00