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

Gateway: too many CoreAPI.ResolvePath calls #233

Closed
Jorropo opened this issue Mar 29, 2023 · 2 comments
Closed

Gateway: too many CoreAPI.ResolvePath calls #233

Jorropo opened this issue Mar 29, 2023 · 2 comments
Assignees

Comments

@Jorropo
Copy link
Contributor

Jorropo commented Mar 29, 2023

Here is a trace I captured from loading dist.ipfs.io's favicon (on v0.8.0-rc2):
Capture d’écran du 2023-03-29 05-52-07

You can see that it loads the same ressource over and over, there is no point to restarting from /ipns/dist.ipfs.io all the time.
Ideally once we resolve a path component we followup all future resolution from this path component or better.

They all endup calling into namesys.
Capture d’écran du 2023-03-29 05-58-33

It doesn't look like the latency impact is very bad because all but the first call to ResolvePath and first call to BlockAPI.Get are very fast, so they are probably hitting a cache, it looks like a low hanging fruit that would reduce allocations and CPU usage a bit tho.

@Jorropo Jorropo added the need/triage Needs initial labeling and prioritization label Mar 29, 2023
@Jorropo
Copy link
Contributor Author

Jorropo commented Mar 29, 2023

This looks like it could be the cullprit (if anything it at least expose the same bug):

resolvedPath, err := i.api.ResolvePath(r.Context(), parsed404Path)

This code should shift the last match into a variable while iteratively traversing the folders.

I'll wait on #176 before doing anything.

@hacdias hacdias changed the title Gateway do to much calls to CoreAPI.ResolvePath Gateway: too many CoreAPI.ResolvePath calls Jun 6, 2023
@hacdias hacdias removed the need/triage Needs initial labeling and prioritization label Jun 6, 2023
@hacdias hacdias self-assigned this Jun 6, 2023
@hacdias
Copy link
Member

hacdias commented Jan 16, 2024

@Jorropo I think this has been solved in the meanwhile through the successive refactors. It seems like we only hit Namesys once now. I tried with a few different pages and only see a single call.

image

Feel free to re-open if you still see many calls.

@hacdias hacdias closed this as completed Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

No branches or pull requests

2 participants