]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Lazily initialize RangeDelAggregator's map and pinning manager
authorAndrew Kryczka <andrewkr@fb.com>
Sat, 19 Nov 2016 00:54:09 +0000 (16:54 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Sat, 19 Nov 2016 01:09:11 +0000 (17:09 -0800)
commit3f622152102075c3973697da8c562c423b45cd81
tree6229514023794c51f043a4b13e3949ffd9370b78
parent41e77b8390264c2c20dd8d1a71909c5630b74f9f
Lazily initialize RangeDelAggregator's map and pinning manager

Summary:
Since a RangeDelAggregator is created for each read request, these heap-allocating member variables were consuming significant CPU (~3% total) which slowed down request throughput. The map and pinning manager are only necessary when range deletions exist, so we can defer their initialization until the first range deletion is encountered. Currently lazy initialization is done for reads only since reads pass us a single snapshot, which is easier to store on the stack for later insertion into the map than the vector passed to us by flush or compaction.

Note the Arena member variable is still expensive, I will figure out what to do with it in a subsequent diff. It cannot be lazily initialized because we currently use this arena even to allocate empty iterators, which is necessary even when no range deletions exist.
Closes https://github.com/facebook/rocksdb/pull/1539

Differential Revision: D4203488

Pulled By: ajkr

fbshipit-source-id: 3b36279
db/db_impl.cc
db/db_impl_readonly.cc
db/db_iter.cc
db/range_del_aggregator.cc
db/range_del_aggregator.h
db/table_cache.cc