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

performance issues when browsing core docs #2619

Open
emillon opened this issue Jul 30, 2024 · 2 comments
Open

performance issues when browsing core docs #2619

emillon opened this issue Jul 30, 2024 · 2 comments

Comments

@emillon
Copy link
Contributor

emillon commented Jul 30, 2024

Hi,

Loading pages such as https://ocaml.org/p/core/v0.17.1/doc/index.html is very slow, more than 10s.

I investigated and the server is GET'ing https://docs-data.ocaml.org/live/p/core/v0.17.1/index.js which is a massive file.

This is the search index. Disabling by stubbing Ocamlorg_package.search_index will make the problem go away.

Now, for a proper fix, I had a look at how this function is used in the source code (more precisely, in Handler):

  • in most cases, it's only hashed.
  • in package_search_index, it's served as a response.

For the first one, I suggest adding a new endpoint on docs-data to query just the hash. This will already cut the time in 3 or 4 (several resources on the page consume the hash).

The second one is trickier. Querying directly from the browser will allow efficient caching (docs-data.ocaml.org seems to reply with meaningful cache headers), but will hit into same origin policy. This can be solved by setting CORS headers on docs-data.ocaml.org, but has security implications.

@emillon
Copy link
Contributor Author

emillon commented Jul 30, 2024

(this could also be solved by keeping the proxy and adding a HTTP cache on ocaml.org's side, but this doesn't seem like the end solution)

@sabine
Copy link
Collaborator

sabine commented Jul 30, 2024

I'll do a quick fix by caching the package search index hash, however, this hash should be generated by the docs pipeline when it builds the search indexes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants