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

pingpong: improve transaction scheduling #3478

Merged
merged 2 commits into from
Jun 1, 2022

Conversation

tolikzinovyev
Copy link
Contributor

Summary

Currently the transaction scheduling logic in pingpong is lots of complicated sleep calls. Some sleeps were definitely extra and were hurting tps; this PR deprecates them. The whole scheduling logic is replaced with a much simpler one. Let timestamp sequence {t}_{i >= 0} = {currenttime + 1 / tps * i}. Then transaction i is sent at time t_i with best effort.

In my tests ./pingpong run --tps 115 --rest 0 --refresh 1800 --numaccounts 500 produced 440 txns per block. Now ./pingpong run --tps 115 --refresh 1800 --numaccounts 500 produces 475 txns per block. (--rest was deprecated)

Related to https://github.com/algorand/go-algorand-internal/issues/1833.

Test Plan

I ran it.

@cce cce requested a review from brianolson May 24, 2022 17:33
Copy link
Contributor

@brianolson brianolson left a comment

Choose a reason for hiding this comment

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

the schedule() abstraction looks good and cleans up a bunch of code. One tweak suggestion.

}

*nextSendTime = nextSendTime.Add(
time.Duration((1.0 / float64(tps)) * float64(time.Second)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
time.Duration((1.0 / float64(tps)) * float64(time.Second)))
time.Duration(float64(time.Second) / float64(tps)))

Copy link
Contributor

Choose a reason for hiding this comment

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

or better yet, at startup, calculate period := Second/tps then later nextSendTime.Add(period)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #3478 (7cd4550) into master (2df7468) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3478      +/-   ##
==========================================
- Coverage   54.48%   54.46%   -0.02%     
==========================================
  Files         390      390              
  Lines       48608    48608              
==========================================
- Hits        26482    26473       -9     
- Misses      19902    19910       +8     
- Partials     2224     2225       +1     
Impacted Files Coverage Δ
ledger/blockqueue.go 82.18% <0.00%> (-2.88%) ⬇️
network/wsPeer.go 67.67% <0.00%> (-2.74%) ⬇️
ledger/tracker.go 74.45% <0.00%> (-0.87%) ⬇️
cmd/tealdbg/debugger.go 72.69% <0.00%> (-0.81%) ⬇️
network/wsNetwork.go 64.79% <0.00%> (-0.20%) ⬇️
catchup/service.go 68.88% <0.00%> (+0.74%) ⬆️
data/abi/abi_type.go 88.62% <0.00%> (+0.94%) ⬆️
catchup/peerSelector.go 100.00% <0.00%> (+1.04%) ⬆️
agreement/cryptoVerifier.go 69.71% <0.00%> (+2.11%) ⬆️
cmd/algoh/blockWatcher.go 80.95% <0.00%> (+3.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2df7468...7cd4550. Read the comment docs.

@tolikzinovyev tolikzinovyev added tech debt Things that need re-work for simplification / sanitization to reduce implementation overhead Enhancement labels May 31, 2022
@tolikzinovyev tolikzinovyev changed the title Improve transaction scheduling in pingpong. pingpong: improve transaction scheduling May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Team Carbon-11 tech debt Things that need re-work for simplification / sanitization to reduce implementation overhead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants