-
Notifications
You must be signed in to change notification settings - Fork 217
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
Add {100,10,1}-wallet restore benchmarks #2243
Conversation
@@ -711,7 +769,7 @@ waitForNodeSync tr nw = loop 10 | |||
|
|||
data BenchmarkLog (n :: NetworkDiscriminant) | |||
= MsgNodeTipTick BlockHeader SyncProgress | |||
| MsgRestorationTick SyncProgress | |||
| MsgRestorationTick POSIXTime [SyncProgress] |
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.
Why did I add this? Might not be needed yet.
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.
well, below you don't use it in toText, so probably superflouous ;-)
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.
But why not introduce MsgRestorationTick [(POSIXTime,SyncProgress)]
to have this time for each sync progress? that would be useful probably
768675c
to
03d31a3
Compare
lib/shelley/bench/Restore.hs
Outdated
(walletSeq "0.4-percent-seq" $ mkSeqAnyState' @4 networkProxy) | ||
benchmarksSeq | ||
runBenchmarks | ||
[ benchRestoreMultipleWallets 1 |
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.
Takes 6s to reach 1%.
I suspect the extrapolated value (600s to 100%) is a bit wrong.
- Could increase the number of wallets for this test only
- Could leave it as is
- Could increase the restore-to target for this test only
- Could increase restore-to target for all {1,10,100} cases (but 100 would be really slow)
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.
Locally 1 wallet takes 276.4 s, vs 600s extrapolated, so pretty wrong, yes.
I should also note though, that when I compared 100 wallets to 1% extrapolated vs 100 wallets to 10%, they were very similar.
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.
so what's executive summary of the above?
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.
Summary:
- Should restore the 1 wallet to 10% for better extrapolation. But we can keep 10 and 100 wallets restoring to 1%, where it doesn't matter much.
- There may be some interesting slowdowns (e.g. 10%, 16%), only visible when restoring to 100% (as Piotr also suggested), but I think we can ignore that in this PR.
Based on the data:
- To 1%
- 1 wallets -> 4.015s (extrapolation is 54% higher than the to-10% value ❌)
- 10 wallets -> 24.62s (extrapolation is 0.9% higher than the to-10% value 🆗 )
- 100 wallets -> 345.0s (extrapolation is 0.8% higher than the to-10% value 🆗 )
- To 10%
- 1 wallets -> 26.13s (extrapolation is 9.3% lower than the to-100% value 🤔 )
- 10 wallets -> 244.0s (extrapolation is 14.1% lower than the to-100% value 🤔 )
- 100 wallets -> 3423s (IIRC)
- To 100% (includes the Shelley part of the chain)
- 1 wallets -> 288s
- 10 wallets -> 2842s
- 100 wallets -> 38578s
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.
Thanks!
Triggered Buildkite nightly: https://buildkite.com/input-output-hk/cardano-wallet-nightly/builds/673#cc255463-69ec-4691-80b0-25042a53eced |
void $ withNetworkConfiguration args $ \nodeConfig -> | ||
withCardanoNode (trMessageText tr) nodeConfig $ \cp -> | ||
action tr (networkConfig args) (nodeSocketFile cp) | ||
case argUseAlreadyRunningNodeSocketPath args of |
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.
👍
lib/shelley/bench/Restore.hs
Outdated
(walletRnd "0.4-percent-rnd" $ mkRndAnyState @4) | ||
[walletRnd (showPercent permillProxy <> "-percent-rnd") | ||
$ mkRndAnyState' permillProxy networkProxy] | ||
True -- Write progress to .timelog file |
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.
Is this comment correct? The one in line 235 is opposite but the value is also True
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.
Thanks, the value was supposed to be False
on line 235.
Could have added a new datatype to better represent this, but maybe I should more fundamentally refactor the bench_restoration
function instead 🤔
@@ -9,6 +9,7 @@ | |||
{-# LANGUAGE LambdaCase #-} | |||
{-# LANGUAGE MultiParamTypeClasses #-} | |||
{-# LANGUAGE NamedFieldPuns #-} | |||
{-# LANGUAGE NoMonoLocalBinds #-} |
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.
ok, will need to read about it 😅 At this moment do not understand why it is used
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.
So we have the main bench_results
function with a bunch of arguments, type parameters and constraints.
I wanted to define more descriptive helpers where I apply most of the boring arguments, e.g.:
let benchRestoreRndWithOwnership permillProxy = bench_restoration
networkProxy
(trMessageText tr)
socketFile
np
vData
[walletRnd (showPercent permillProxy <> "-percent-rnd")
$ mkRndAnyState' permillProxy networkProxy]
True -- Write progress to .timelog file
(unsafeMkPercentage 1)
benchmarksRnd
But the per-mille ownership is a type parameter, and Haskell will fix it when inferring the type of the let binding.
benchRestoreRndWithOwnership (Proxy @0) -- compiles
benchRestoreRndWithOwnership (Proxy @1) -- Expected type: Proxy 0; Actual type: Proxy 1
Moving it to a where-clause, and explicitly specifying forall (p :: Nat)
didn't seem like a good solution because the full type signature is really big and cumbersome, and I wouldn't have access to the locally bound vData
, np
, networkProxy
.
With NoMonoLocalBinds
it just works.
Looking here it seems that MonoLocalBinds
is off by default, but enabled automatically by GADTs
. Didn't know that.
The extension MonoLocalBinds is implied by TypeFamilies and GADTs. You can switch it off again with NoMonoLocalBinds but type inference becomes less predictable if you do so. (Read the papers!)
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.
Thanks!
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.
LGTM
c07e99c
to
6839b47
Compare
benchmarksSeq | ||
[ benchRestoreMultipleWallets 1 (unsafeMkPercentage 0.1) | ||
, benchRestoreMultipleWallets 10 (unsafeMkPercentage 0.01) | ||
, benchRestoreMultipleWallets 100 (unsafeMkPercentage 0.01) |
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.
Why not using the same percentage here? That will skew the benchmark a bit, wouldn't it?
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.
Why not using the same percentage here?
To make it run in a few minutes rather than more than an hour.
See #2243 (comment)
That will skew the benchmark a bit, wouldn't it?
Well, only if you interpret in the wrong way.
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.
I mean, why not:
[ benchRestoreMultipleWallets 1 (unsafeMkPercentage 0.01)
, benchRestoreMultipleWallets 10 (unsafeMkPercentage 0.01)
, benchRestoreMultipleWallets 100 (unsafeMkPercentage 0.01)
The first 0.1
looks like a typo to me ?
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.
Ah — the extrapolation from 0.01 to 0.1 is 54% off because it is so fast (imprecise start and stop times + ramping-up time, I take).
Extrapolating from 0.01 to 0.1 in the for 10 and 100 wallets saves an hour of time, but the accuracy of the extrapolation seem within 1%.
instead of hard-coding to "db"
dbd4938
to
6c9422b
Compare
|
which silences the verbose tick output to stdout.
6c9422b
to
9b22f9e
Compare
🤞 |
2243: Add {100,10,1}-wallet restore benchmarks r=Anviking a=Anviking # Issue Number ADP-469 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [x] Auxiliary: Make benchmark actually respect passing in `--node-db` - [x] Auxiliary: Add `--running-node SOCKET_PATH` for easier development - [x] Benchmark restoring 100, 10 and 1 wallet to 1% - [x] Some tweaks to helpers to support this - [x] Refactor to make the benchmark declarations more high-level and readable - [x] Make sure the plotting of the results hasn't boken # Comments - Currently we won't a get plot for these new multi-wallet benchmarks, like for the existing ones. Could consider adding in another PR. - Open to disagreement on only restoring 1% ([here](https://input-output-rnd.slack.com/archives/GBT05825V/p1602674480071800?thread_ts=1602142785.076200&cid=GBT05825V) is the old thread), but I think even 10% might be tricky to pull off in this PR. We'd need much more work for that. <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Johannes Lund <[email protected]>
Build failed:
|
bors r+ |
Build succeeded: |
Issue Number
ADP-469
Overview
--node-db
--running-node SOCKET_PATH
for easier developmentComments