-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Faster gateway directory listings #8178
Comments
I believe this will be unblocked and ready to work on after go-ipfs 0.13/14 ships with alternative response formats. Loose idea is to return listing without sizes fast, and then fetch them on-demand (if needed):
|
quick thought on a band-aid for this:
|
@schomatis would you be interested in doing the band-aid described above, so we could ship it in go-ipfs 0.13? It would solve some perf problems on gateways. Let's go with N=5000 for now. |
Assigning. If this is time sensitive I'm probably not the best person though, but will give you an update on this this week. |
Sorry, just now reading the band-aid alternative: yes, seems like a quick fix I can implement to help alleviate this. |
@lidel Need some clarifications: A. On the objective of this issue, I'm not clear which is the performance downgrade we're trying to fix. From the OP:
From what I see in the code we don't fetch the type information but guess it from file name extension (which is something we already have available in the directory node itself). B. Guessing about any other potential performance issues, the only potential other fetch is to get the hash of the file in the path resolver. We have that available in the directory but it's not exposed in the C. On the band-aid, assuming there is some performance hit somewhere, we don't know upfront how many entries a directory has (at least for the HAMT case, which is probably the type of big directory this issue has in mind). We can't limit upfront by its size since this is being continually streamed (is maybe this the performance issue we're trying to address in the first place?). In any case, what we could do is add a timer and if the directory hasn't been fully iterated stop there and add the warning proposed. |
Reading the original issue that spawned this one, #7495, I now see we're conflating two different listing mechanisms:
We need to clearly distinguish between the two, possibly having independent issues (since each mechanism has its independent code; the gateway is not just calling |
(Marking as blocked until we clarify all this.) |
This should unblock you:
|
🙏 This would be super useful - folks are uploading NFT drops with directories of 10k+ items to NFT.Storage and are getting confused when trying to view them on the gateway - it times out and they assume their upload did not complete successfully. |
@alanshaw check #8853 (review) – I've tested it with |
Update 11/4(@schomatis): We need to refactor the gateway code to use
UnixfsAPI.Ls()
instead ofGet
.Instead of resolving file types up-front in the gateway, we can take advantage of streaming HTML rendering (most browsers support this) by:
That way the directory listing appears immediately, and icons for file-types will be filled in as new
<style>
elements get sent back to the browser.Alternatively, we could do this with some javascript. But I'd like to avoid that if possible.
The text was updated successfully, but these errors were encountered: