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

Ensure that uncommitted transactions are always removed from QoS #32285

Merged

Conversation

buffalu
Copy link
Contributor

@buffalu buffalu commented Jun 26, 2023

Problem

When feature apply_cost_tracker_during_replay is applied, transactions that are added to QoS but aren't executed or committed will never get removed. This will result in an overestimation of actual compute units used, resulting in smaller blocks.

Summary of Changes

Uncommitted or unrecorded transaction costs always remove costs. Costs are only updated if apply_cost_tracker_during_replay is applied

Copy link
Contributor

@apfitzge apfitzge left a comment

Choose a reason for hiding this comment

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

Implementation itself looks good to me. Some nit-picking (as always!) on a comment.

core/src/banking_stage/consumer.rs Outdated Show resolved Hide resolved
@apfitzge apfitzge requested a review from tao-stones June 26, 2023 23:02
Copy link
Contributor

@apfitzge apfitzge left a comment

Choose a reason for hiding this comment

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

I'm happy with these changes as is, but requested a review from @taozhu-chicago as well. Since this is primarily related to his feature-gate for not updating costs, I will defer final approval to him.

Copy link
Contributor

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

Change looks good to me. Just few nit & comments

core/src/banking_stage/consumer.rs Show resolved Hide resolved
core/src/banking_stage/consumer.rs Outdated Show resolved Hide resolved
core/src/banking_stage/consumer.rs Show resolved Hide resolved
core/src/banking_stage/qos_service.rs Show resolved Hide resolved
@buffalu
Copy link
Contributor Author

buffalu commented Jun 27, 2023

@taozhu-chicago some benchmarks below on consumer. overall seems the same

server: c2-standard-30 sitting idle
command: ./cargo nightly bench -p solana-core --bench consumer

commit a9239f1

test bench_process_and_record_transactions_full_batch                        ... bench:     997,244 ns/iter (+/- 22,707)
test bench_process_and_record_transactions_full_batch_disable_tx_cost_update ... bench:   1,021,068 ns/iter (+/- 38,027)
test bench_process_and_record_transactions_half_batch                        ... bench:     484,428 ns/iter (+/- 24,964)
test bench_process_and_record_transactions_half_batch_disable_tx_cost_update ... bench:     485,397 ns/iter (+/- 15,520)
test bench_process_and_record_transactions_unbatched                         ... bench:      34,607 ns/iter (+/- 1,616)
test bench_process_and_record_transactions_unbatched_disable_tx_cost_update  ... bench:      34,742 ns/iter (+/- 1,796)

commit 1b2b825 (commit this PR started on with modified core/benches/consumer.rs matching a92..)

test bench_process_and_record_transactions_full_batch                        ... bench:   1,000,160 ns/iter (+/- 26,487)
test bench_process_and_record_transactions_full_batch_disable_tx_cost_update ... bench:   1,002,358 ns/iter (+/- 43,635)
test bench_process_and_record_transactions_half_batch                        ... bench:     484,916 ns/iter (+/- 22,816)
test bench_process_and_record_transactions_half_batch_disable_tx_cost_update ... bench:     483,655 ns/iter (+/- 9,251)
test bench_process_and_record_transactions_unbatched                         ... bench:      35,777 ns/iter (+/- 769)
test bench_process_and_record_transactions_unbatched_disable_tx_cost_update  ... bench:      35,607 ns/iter (+/- 612)

tao-stones
tao-stones previously approved these changes Jun 27, 2023
Copy link
Contributor

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

lgtm - thanks for benching too

@buffalu
Copy link
Contributor Author

buffalu commented Jun 28, 2023

@taozhu-chicago or @t-nelson can you add CI label to kick off CI

@tao-stones tao-stones added the CI Pull Request is ready to enter CI label Jun 28, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Jun 28, 2023
core/benches/consumer.rs Outdated Show resolved Hide resolved
@@ -155,15 +166,30 @@ fn bench_process_and_record_transactions(bencher: &mut Bencher, batch_size: usiz

#[bench]
Copy link
Contributor

Choose a reason for hiding this comment

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

this makes me wish there was a test_case-like crate for benches 😢
I guess these will only live until the feature is activated everywhere

@apfitzge
Copy link
Contributor

Looks like we got a broken test. I think bank_process_and_record_transactions_cost_tracker needs to be updated to calculate the expected block cost with the uncommitted tx's cost removed.

@buffalu
Copy link
Contributor Author

buffalu commented Jun 28, 2023

Looks like we got a broken test. I think bank_process_and_record_transactions_cost_tracker needs to be updated to calculate the expected block cost with the uncommitted tx's cost removed.

working on it now, will push up soon :)

@buffalu
Copy link
Contributor Author

buffalu commented Jun 28, 2023

@t-nelson hi i'd like a wendy's daves triple combo, a small chocolate frosty, and permission to trigger CI on my builds going into the solana labs repos :)

@apfitzge apfitzge added the CI Pull Request is ready to enter CI label Jun 28, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Jun 28, 2023
Copy link
Contributor

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

tiny nit

core/src/banking_stage/qos_service.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #32285 (cc1c8b4) into master (9fb105c) will decrease coverage by 0.1%.
The diff coverage is 98.3%.

@@            Coverage Diff            @@
##           master   #32285     +/-   ##
=========================================
- Coverage    82.0%    82.0%   -0.1%     
=========================================
  Files         772      772             
  Lines      209538   209570     +32     
=========================================
+ Hits       171973   171984     +11     
- Misses      37565    37586     +21     

@buffalu
Copy link
Contributor Author

buffalu commented Jun 28, 2023

plz kick CI one more time, last build passed :)

Copy link
Contributor

@apfitzge apfitzge left a comment

Choose a reason for hiding this comment

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

lgtm

@apfitzge apfitzge added the CI Pull Request is ready to enter CI label Jun 28, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Jun 28, 2023
@buffalu
Copy link
Contributor Author

buffalu commented Jun 28, 2023

🎊

@buffalu
Copy link
Contributor Author

buffalu commented Jun 28, 2023

build passing, plz merge if happy

@apfitzge apfitzge merged commit 5dee2e4 into solana-labs:master Jun 28, 2023
@tao-stones tao-stones added the v1.16 PRs that should be backported to v1.16 label Jun 28, 2023
mergify bot pushed a commit that referenced this pull request Jun 28, 2023
tao-stones pushed a commit that referenced this pull request Jun 28, 2023
…oS (backport of #32285) (#32320)

Ensure that uncommitted transactions are always removed from QoS (#32285)

Co-authored-by: Tao Zhu <[email protected]>
(cherry picked from commit 5dee2e4)

Co-authored-by: buffalu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution need:merge-assist v1.16 PRs that should be backported to v1.16
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants