-
Notifications
You must be signed in to change notification settings - Fork 2
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
perf: paginate account credit debits #522
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.
this is looking good to me. are there any red flags popping up for you?
@sanderpick: no red flags but was just worrying if i am missing an edge case. where should we put the pagination batch sizes? it is currently hardcoded in this PR |
you could put in the recall_config actor. note: that will require an SDK update. there are commands to set the config. re: the tests... can you manually try and figure out what the threshholds are for these batch sizes? ie, at what point do they run out of gas. maybe there's a way to use the recall loader-cli (cc @brunocalza) to add many 1000s of accounts and an bucket and object from each? or maybe there's a theoretical way to understand, ie, how much gas each iteration takes and if it grows linearly (it should since we're using hamt/amt). that would be nice, since load testing the expiries sounds like it would take some extra custom work. |
673fadc
to
8dbf155
Compare
Here is a break down of manually testing the When walking the outer expiry AMT N times, we could go upto ~ 330 before running into block gas limit (10B). 1 account and N blobs
However, N accounts with 1 blob each (excludes expiry traversal gas)
Combining these two I have been trying account debiting with the following. It consumes ~ 9.2-9.3B gas units which almost fills the whole block but remains within the BLOCK_GAS_LIMIT
Note: we should also reduce the debit interval if we go with expiry batch size of 150 to ensure there is not much backlog |
thanks for the great rundown here! maybe, expiry batch size: 100 would be better? more conservative? i wonder also, is there a way we can not propagate the error is this system level tx fails? kind of like we did for the blob reader callback method? |
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
940a443
to
084a3d1
Compare
Signed-off-by: avichalp <[email protected]>
@sanderpick: 100 and 1000 sounds good to me! I added the error handling for debit accounts call here: 084a3d1. I had to create the return object with default values in the error case to satisfy the return type. Is this okay? Also, here are the two PRs for
I believe the Also, where do we call the |
I think so... does it work when you hit the out of gas error? ie, does the chain keep progressing? I wonder also, is there some way to know if the debiting falls behind with some logging?
👀
it's called from the SDK |
Signed-off-by: avichalp <[email protected]>
interestingly, we don't need to explicitly handle the error here. having |
ah, so the tx just fails like a normal user txn that fails? and then the chain would just try again during the next "cron" tick? |
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Updates set config events related to recallnet/ipc#522 Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
@@ -32,6 +32,10 @@ pub struct RecallConfig { | |||
pub blob_min_ttl: ChainEpoch, | |||
/// The default epoch duration a blob is stored. | |||
pub blob_default_ttl: ChainEpoch, | |||
/// Maximum number of blobs to delete in a single batch during debit. | |||
pub blob_delete_batch_size: u64, |
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.
adds two new config parameters
Ok(true) | ||
})?; | ||
let (count, next_idx) = expiries.for_each_while_ranged( | ||
self.next_idx, |
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.
Uses "next index" to continue the cursor based pagination
Ok(()) | ||
})?; | ||
|
||
let start_key = self |
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.
next key for pagination
}, | ||
)?; | ||
self.next_idx = batch_size.and(next_idx); | ||
log::info!( |
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.
logs next index and current epoch so we can get a sense of backlog
sorry for delay here... will look asap |
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.
looks great! this is a big improvement 👍
for_each_ranged
method. Store the next address process in the current debit cycle in the state.closes #478