Summary: To reduce contention for atomics when HistogramStats are shared across threads, this diff makes them thread-specific so updates are faster. This comes at the expense of slower reads (much less frequent), which now require merging all histograms. In this diff, - Thread-specific HistogramImpl is created upon the thread's first measureTime() - Thread-specific HistogramImpl are merged and deleted upon thread termination or ThreadLocalPtr destruction, whichever comes first - getHistogramString() and histogramData() merge all histograms, both thread-specific and previously merged ones Test Plan: unit tests, ran db_bench and verified histograms look similar before: $ TEST_TMPDIR=/dev/shm/ perf record -g ./db_bench --benchmarks=readwhilewriting --statistics --num=1000000 --use_existing_db --threads=64 --cache_size=250000000 --compression_type=lz4 ... + 7.63% db_bench db_bench [.] rocksdb::HistogramStat::Add after: $ TEST_TMPDIR=/dev/shm/ perf record -g ./db_bench --benchmarks=readwhilewriting --statistics --num=1000000 --use_existing_db --threads=64 --cache_size=250000000 --compression_type=lz4 ... + 0.98% db_bench db_bench [.] rocksdb::HistogramStat::Add Reviewers: sdong, MarkCallaghan, kradhakrishnan, IslamAbdelRahman Reviewed By: IslamAbdelRahman Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D62649main
parent
6a14d55bd9
commit
1613fa9490
Loading…
Reference in new issue