Add throttling to node prefetchers #1030
Merged
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.
This PR introduces two improvements to the parallel visit code:
throttling of node pre-fetchers: workers stop prefetching nodes beyond a configurable threshold of prefetched nodes; however, since at the time workers are throttled not all needed nodes may have been fetched, the main thread is extended to contribute to the prefetching as needed, this puts a constant upper limit on the memory usage of the
visitAll
operation;lockstep prefetching of workers: workers will synchronize their activities to avoid prefetching large shares of far-future nodes and thereby exceeding the throttling limit for a long time. By synchronizing prefetch workers to load nodes in blocks, the focus of what is to be prefetched is forced to remain on the near future window.
For the latter, a
barrier
utility was introduced facilitating the synchronization of workers.