Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Merged by Bors] - Basic adaptive batching for parallel query iteration #4777
[Merged by Bors] - Basic adaptive batching for parallel query iteration #4777
Changes from 16 commits
65bd41f
b110039
cf10758
076db46
12eefa1
3c76af9
332e851
186fd50
88044d1
704cf61
cedd756
1f94913
5b3a730
8b365f4
21d95cb
92af1f4
2309ab7
f788a7a
6fd0cf1
10904c1
ac4c524
0b8c1eb
3674f10
08bf88b
3674e19
619bdb9
65a6c9a
8959c2d
9a8e5fd
03ffbe8
b89d878
d3b997b
c5df0d6
d5a5993
606635f
5f6a290
ce10028
ec9a481
d74a318
2381ba2
d025d03
4132b60
34ae6ba
1eaee67
f3eef7f
4ab1465
7bd1617
8bc37a0
bc2c649
b57d547
5556377
a82ff07
fd8fefa
a751055
9111a00
266bfce
2cfcb16
73e5dfc
acf2f5b
015e201
c6363ea
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 we use the new
ExactSizeIterator
APIs here? Do we want to?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.
Unfortunately
ExactSizeIterator
computes the sum of all table/archetype sizes, this computes the max of them instead.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 think max / thread_count is too coarse. Consider the case where we have one archetype, if for any reason we don't get all the threads, the task will take twice as long to complete. This is because one of the threads will have to do 2 batches instead of just one. We probably want some type of multiplier on the thread count so we get like 4 or 5 batches per a thread. Probably needs some testing to know what that number is.
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.
Set one up at a default of 4 per thread for now. Ultimately it comes down to how much of a cost the overhead of scheduling a new task onto a thread is. If that overhead is small, we can afford to be much more granular with how we schedule each one.
As I proposed on Discord, it might be a good idea to schedule one task per thread, and just push the archetypes/batches through a SPMC channel. It'd be likely be lighter weight than scheduling a new task per archetype or batch.