Skip to content
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

Better read-ahead when walking. #53

Open
Stebalien opened this issue Aug 21, 2019 · 0 comments
Open

Better read-ahead when walking. #53

Stebalien opened this issue Aug 21, 2019 · 0 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature

Comments

@Stebalien
Copy link
Member

When walking an IPLD dag, the DagWalker prefetches the next 5-15 siblings of each node it fetches. Unfortunately, this means we don't always look ahead as much as we can.

For example, consider the following tree:

    o
   /|\
  o o o
 /| | |\
o o o o o

The current walker will fetch as follows:

  1. Fetch the first layer:
    ?
   /|\
  o o o
 /| | |\
o o o o o
  1. When we get the root, fetch it's first 10 children in parallel:
    x
   /|\
  ? ? ?
 /| | |\
o o o o o
  1. When we get the first block, fetch it's first 10 children in parallel.
    x
   /|\
  x ? ?
 /| | |\
? ? o o o

However, given this graph, we're now pre-fetching at most 4 blocks. Worse, once we fetch the first two leaf nodes, we'll end up in the following state:

    x
   /|\
  x x ?
 /| | |\
x x o o o

At this point, we haven't started pre-fetching the next node. That means we'll have to pause before we can continue.


What should we be doing? At a minimum, we should be prefetching at least 10 nodes at each layer. Ideally, we'd prefetch 10 nodes at each layer at a time until we've prefetched N nodes total (DFS order), where N is configurable.

@Stebalien Stebalien added the kind/enhancement A net-new feature or improvement to an existing feature label Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant