Skip to content

Conversation

@instagibbs
Copy link
Member

@instagibbs instagibbs commented Feb 1, 2023

Took the existing benchmark and made is something more exhaustive, targeting eviction of 2500 transactions of different shapes. of dependencies.

Magic number comes from: 100 children being RBF'd, each bumping 24 parents = 2500 transactions

Turns out the benchmark ComplexMemPool already does something similar, so if we don't want to expand it, maybe just remove it in favor of the existing better benchmark?

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 1, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

@maflcko maflcko changed the title Expand eviction benchmarking bench: Expand eviction benchmarking Feb 2, 2023
@DrahtBot DrahtBot added the Tests label Feb 2, 2023
Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

Thanks for beefing up this bench! Basically lgtm, a few nits. Would like a bit clearer docs so future people can easily understand what the test is doing.

@jonatack
Copy link
Member

Sorry for the drive-by suggestion: from the title, I thought this PR might be about the peer eviction benchmarks. Maybe update the title to s/eviction/mempool eviction/.

@instagibbs instagibbs changed the title bench: Expand eviction benchmarking bench: Expand mempool eviction benchmarking Mar 21, 2023
@instagibbs
Copy link
Member Author

@jonatack good point, updated

@instagibbs
Copy link
Member Author

fixups included, squashed

CMutableTransaction tx = CMutableTransaction();
tx.vin.resize(num_puts);
tx.vout.resize(num_puts);
for (size_t put_index=0; put_index<num_puts; put_index++) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you apply the changes to the other loops too? i.e.

Suggested change
for (size_t put_index=0; put_index<num_puts; put_index++) {
for (size_t put_index{0}; put_index < num_puts; ++put_index) {

if (put_index < txn_index) {
// We spend put_index's txn's in the next available slot for each previous transaction
assert(put_index + txn_index >= 1);
tx.vin[put_index].prevout = COutPoint(txns[put_index]->GetHash(), put_index + txn_index - 1);
Copy link
Member

Choose a reason for hiding this comment

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

Wait, if you're using txns[put_index] and you're using the same txns reference each time you call add_parents_child, aren't you having all subsequent packages spend outputs from txns[0:24] too? That means all these packages conflict with each other.

You could fix this by adding set_num * package_size or something to the index. But what would probably make a better interface is if add_parents_child returns the list of transactions it creates, and you append them to your larger list of packages.

Copy link
Member Author

@instagibbs instagibbs Mar 22, 2023

Choose a reason for hiding this comment

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

Hmmm, traced out a package size of 4, looks like I'm referencing non-existent outputs, not re-using them(maybe both :) ).

Clearly this is confusing and broken either way.

To take a step back, after doing this draft I realized https://github.com/bitcoin/bitcoin/blob/master/src/bench/mempool_stress.cpp exists. I'm fine if this doesn't get merged if it doesn't add anything new? Helped me learn about the benchmarks if nothing else. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

Ah true, I suppose ComplexMemPool is already benching eviction of packages. Fine with closing. The effort is appreciated 🙏

Copy link
Member Author

Choose a reason for hiding this comment

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

I could change the PR to remove this silly bench.. :P

@instagibbs instagibbs closed this Mar 22, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants