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

Improve performance of servePretty404IfPresent in absence of a pretty 404 #9067

Open
3 tasks done
iand opened this issue Jun 28, 2022 · 1 comment
Open
3 tasks done
Labels
kind/enhancement A net-new feature or improvement to an existing feature topic/gateway Topic gateway

Comments

@iand
Copy link
Contributor

iand commented Jun 28, 2022

Checklist

  • My issue is specific & actionable.
  • I am not suggesting a protocol enhancement.
  • I have searched on the issue tracker for my issue.

Description

The function servePretty404IfPresent recurses a UnixFS looking for a file named ipfs-404.html at each level.

When the file does not exist, the function walks up the DAG looking for the file at each level. The default timeout (from go-path) is 1 minute for each traversal.

As an example, fetching the following request failed after 5m since it failed to fetch QmZFP53gibtpCjJAMmhAf7ugPS8hvhQiZ8b8ttMkhdqWGY/1/6/6/1661/1661-h.zip
after 1m and then spent a further 1m for each of:

  • /ipfs/QmZFP53gibtpCjJAMmhAf7ugPS8hvhQiZ8b8ttMkhdqWGY/1/6/6/1661/1661-h.zip/ipfs-404.html
  • /ipfs/QmZFP53gibtpCjJAMmhAf7ugPS8hvhQiZ8b8ttMkhdqWGY/1/6/6/1661/ipfs-404.html
  • /ipfs/QmZFP53gibtpCjJAMmhAf7ugPS8hvhQiZ8b8ttMkhdqWGY/1/6/6/ipfs-404.html
  • /ipfs/QmZFP53gibtpCjJAMmhAf7ugPS8hvhQiZ8b8ttMkhdqWGY/1/6/ipfs-404.html

All failed trying to get block QmSpnerMwvUS4ZxZGw2Dx66E63amgYAKgehxnAP8rc7fLE. But the following failed fast because (presumably) the relevant blocks were present in the local blockstore:

  • /ipfs/QmZFP53gibtpCjJAMmhAf7ugPS8hvhQiZ8b8ttMkhdqWGY/1/ipfs-404.html
  • /ipfs/QmZFP53gibtpCjJAMmhAf7ugPS8hvhQiZ8b8ttMkhdqWGY/ipfs-404.html

servePretty404IfPresent should remember that a block was unreachable and not include that in the recursion and should set an overall timeout for the entire traversal, not for each lookup.

@iand iand added the kind/enhancement A net-new feature or improvement to an existing feature label Jun 28, 2022
@lidel lidel added the topic/gateway Topic gateway label Jul 19, 2022
@lidel
Copy link
Member

lidel commented Jul 19, 2022

We should revisit this after #8890 lands.

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 topic/gateway Topic gateway
Projects
None yet
Development

No branches or pull requests

2 participants