Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RangeDelAggregator microbenchmarks #4363

Closed
wants to merge 3 commits into from

Conversation

abhimadan
Copy link
Contributor

@abhimadan abhimadan commented Sep 13, 2018

To measure the results of upcoming DeleteRange v2 work, this commit adds
simple benchmarks for RangeDelAggregator. It measures the average time
for AddTombstones and ShouldDelete calls.

Using this to compare the results before #4014 and on the latest master (using the default arguments) produces the following results:

Before #4014:

=======================
Results:
=======================
AddTombstones:          1356.28 us
ShouldDelete:           0.401732 us

Latest master:

=======================
Results:
=======================
AddTombstones:          740.82 us
ShouldDelete:           0.383271 us

To measure the results of upcoming DeleteRange v2 work, this commit adds
simple benchmarks for RangeDelAggregator. It measures the average time
for AddTombstones and ShouldDelete calls.
Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Great job finding all the right internal APIs to use.

Let's add "db/range_del_aggregator_bench.cc" to MAIN_SOURCES in "src.mk". That'll cause our Makefile to generate a "db/range_del_aggregator_bench.cc.d" file containing the header dependencies, which allows make to automatically rebuild your object file when those header changes. That avoids cases where we sometimes encounter confusing errors that require make clean && make ... to fix.

We can also consider adding the benchmark to BENCHMARKS in "CMakeLists.txt" for cmake build, and also to "TARGETS" file for internal buck build (sorry our build system is really fragmented :/).

As we discussed in person, a future PR could call AddTombstones multiple times per run. Our design for RangeDelAggregator behaves differently in that case, and that is the way RangeDelAggregator is used in real DBs.

db/range_del_aggregator_bench.cc Outdated Show resolved Hide resolved
db/range_del_aggregator_bench.cc Outdated Show resolved Hide resolved
db/range_del_aggregator_bench.cc Outdated Show resolved Hide resolved
rocksdb::RangeDelAggregator range_del_agg(icmp, {} /* snapshots */,
FLAGS_use_collapsed);

for (int j = 0; j < FLAGS_num_range_tombstones; j++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to think about in the future. We might be getting artificially good cache perf by creating the tombstones right before they're added. While in practice, the range tombstone meta-block will often be cold when AddTombstones() is called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at least some of the range tombstones (primarily the ones in the memtable and L0) will be warm if the user issues lots of reads, because those range tombstones will be read for each of those calls. Also, even disregarding cache perf, I think the relative benchmark changes would still be useful to measure performance improvements, since the cache hit rate should be the same before and after the changes. Regardless, this probably requires some more thought, so I left a TODO to look at this more carefully later.

db/range_del_aggregator_bench.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abhimadan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abhimadan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@abhimadan abhimadan deleted the range-del-agg-bench branch September 17, 2018 21:59
@@ -919,6 +919,11 @@ ROCKS_TESTS = [
"db/range_del_aggregator_test.cc",
"serial",
],
[
"range_del_aggregator_bench",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a benchmark, should we exclude it from the list of tests that will run in sandcastle?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm removing it in #4426. Please let me know if I shouldn't do it. Thanks.

facebook-github-bot pushed a commit that referenced this pull request Sep 25, 2018
Summary:
Update template of TARGETS file according to recent changes in #4371 , #4363 and dbf44c3.
Pull Request resolved: #4426

Differential Revision: D10025053

Pulled By: yiwu-arbug

fbshipit-source-id: e6a0a702bfd401fc1af240ee446f5690f0bcd85d
riversand963 pushed a commit to riversand963/rocksdb that referenced this pull request Sep 26, 2018
Summary:
Update template of TARGETS file according to recent changes in facebook#4371 , facebook#4363 and facebook@dbf44c3.
Pull Request resolved: facebook#4426

Differential Revision: D10025053

Pulled By: yiwu-arbug

fbshipit-source-id: e6a0a702bfd401fc1af240ee446f5690f0bcd85d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants