-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(reth-bench): substract block fetch waiting time from benchmark duration #14299
Conversation
let fetch_start = Instant::now(); | ||
|
||
let block_res = | ||
block_provider.get_block_by_number(next_block.into(), true.into()).await; | ||
let fetch_duration = fetch_start.elapsed(); | ||
let block = block_res.unwrap().unwrap(); | ||
let block = from_any_rpc_block(block); | ||
|
||
next_block += 1; | ||
sender.send(block).await.unwrap(); | ||
sender.send((block, fetch_duration)).await.unwrap(); | ||
} | ||
}); | ||
|
||
// put results in a summary vec so they can be printed at the end | ||
let mut results = Vec::new(); | ||
let total_benchmark_duration = Instant::now(); | ||
|
||
while let Some(block) = receiver.recv().await { | ||
let mut total_fetch_duration = Duration::ZERO; | ||
while let Some((block, fetch_duration)) = receiver.recv().await { | ||
// just put gas used here | ||
let gas_used = block.gas_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.
given this is happening in a separate task, is this accurate? it seems like we might subtract too much
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.
can you pls elaborate? happens in a separate task but we record and return the Duration
that the fetch operations per block took, in the other task we aggregate these durations and subtract them from the total benchmark time so far, is this correct?
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.
oh i see what you mean, the channel size is 1000, the block downloader task can progress without blocking the engine interaction task, it is not that easy to know if the block downloads are actually affecting the engine interactions
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 block downloader task can progress without blocking the engine interaction task, it is not that easy to know if the block downloads are actually affecting the engine interactions
Yeah exactly, I think we would instead want to subtract any blocking that occurs in the main task, which currently happens in the loop condition (await
ing on the recv
)
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.
yep that's it, pushed the changes PTAL
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.
Nice, lgtm
Currently we are including the potential time spent waiting for blocks in the total benchmark duration, with these changes we record any waiting time and subtract it when we store the current benchmark duration for each block.