-
Notifications
You must be signed in to change notification settings - Fork 493
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
Conversation
There was a problem hiding this 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.
shared/pingpong/pingpong.go
Outdated
} | ||
|
||
*nextSendTime = nextSendTime.Add( | ||
time.Duration((1.0 / float64(tps)) * float64(time.Second))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time.Duration((1.0 / float64(tps)) * float64(time.Second))) | |
time.Duration(float64(time.Second) / float64(tps))) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
fb64629
to
7cd4550
Compare
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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 transactioni
is sent at timet_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.