-
Notifications
You must be signed in to change notification settings - Fork 159
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
[Feature] Unordered parallel graph walk V3 #3474
Conversation
|
Co-authored-by: Josh Jones <[email protected]>
src/ipld/util.rs
Outdated
@@ -437,3 +438,259 @@ impl<DB: Blockstore, T: Iterator<Item = Tipset> + Unpin> Stream for ChainStream< | |||
} | |||
} | |||
} | |||
|
|||
enum UnorderedTask { |
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.
Any reason to use an enum
here?
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.
It's a leftover, will remove it for good. Thanks for spotting this.
src/ipld/util.rs
Outdated
tipset_iter: T, | ||
stateroot_limit: ChainEpoch, | ||
) -> UnorderedChainStream<DB, T> { | ||
let (sender, receiver) = kanal::bounded(2048); |
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.
Wondering how did you pick this 2048
value? Does the value has any impact on performances or memory usage?
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.
It's somewhat arbitrary, 2048 worked well on my machine and memory usage for 2048 items is negligible. I'll introduce a constant to be more transparent.
task::spawn(async move { | ||
let mut handles = JoinSet::new(); | ||
|
||
for _ in 0..num_cpus::get() { |
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.
Should I observe some speedup/slowdown if I increase/decrease the number of cores here? For example testing on a calibnet
snapshot, I don't see a big difference in performances. Or should I run the benchmark command on a mainnet
snapshot maybe?
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.
Calibnet is too small of a snapshot, yeah. I have tested this and this setup worked better than others.
src/ipld/util.rs
Outdated
} | ||
} | ||
|
||
// // Process block messages. |
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 remove comment here.
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Work on #3314
Other information and links
Change checklist