Page MenuHomePhabricator

Bench: Add mempool eviction benchmark for chained tx's
ClosedPublic

Authored by Fabien on Feb 6 2023, 19:34.

Details

Reviewers
sdulfari
Group Reviewers
Restricted Project
Commits
rABC7440dab3de61: Bench: Add mempool eviction benchmark for chained tx's
Summary
This is from my work in my mempool branch. By popular demand, I am
porting it over to here.

This benchmark is specifically for benchmarking chained_tx eviction
(regular eviction is already being benchmarked in a file called
`mempool_eviction.cpp`).

Notes:

To really test pathological eviction in `CTxMemPool` you need to do it with
a full mempool (100k+ tx's) of sets of chained tx's (this bench uses sets of
50-tx chains, 2000 of them!). The philosophy behind this bench is that we must
design for the worst case when benchmarking here.

This benchmark is very heavy in terms of setup cost -- it actually takes a long
time to run the setup in order to be able to *properly* bench `CTxMemPool`'s
eviction under mempool-pressure circumstances.

Most of the time the benchmark is setting up the mempool(s) it will use.
The actual iteration code (which is what gets timed) is very minor as
compared to the setup. This is because mempool accept is terribly slow
in `CTxMemPool` for unconfirmed chains.

Port of bchn#1098.

Depends on D13106.

Test Plan
ninja bench-bitcoin

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Feb 6 2023, 19:34
sdulfari added a subscriber: sdulfari.

One nit to match the port

src/bench/chained_tx.cpp
175 ↗(On Diff #37831)

missing const

This revision is now accepted and ready to land.Feb 7 2023, 00:37
src/bench/chained_tx.cpp
175 ↗(On Diff #37831)

It's moved just below, making it const causes a copy

This revision was landed with ongoing or failed builds.Feb 7 2023, 19:08
This revision was automatically updated to reflect the committed changes.