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

Add caching to /statistics endpoint #2544

Open
Erb3 opened this issue Aug 4, 2024 · 1 comment · May be fixed by modrinth/labrinth#949
Open

Add caching to /statistics endpoint #2544

Erb3 opened this issue Aug 4, 2024 · 1 comment · May be fixed by modrinth/labrinth#949
Labels
backend Relates to Modrinth Backend or API

Comments

@Erb3
Copy link
Contributor

Erb3 commented Aug 4, 2024

This endpoint is significantly slower than a lot of others, due to doing large database queries. It takes multiple seconds on production, and makes graphing hard since I don't want to downgrade performance. Caching this endpoint in redis would improve the response times, and reduce DDoS risk. An alternative approach would be to keep count in-memory, then increase this number when X happens. This is even more performant, but less reliable.

Erb3 referenced this issue in Erb3-forked/labrinth Aug 12, 2024
@Erb3 Erb3 linked a pull request Aug 12, 2024 that will close this issue
@Prospector Prospector transferred this issue from modrinth/labrinth Oct 19, 2024
@Prospector Prospector added the backend Relates to Modrinth Backend or API label Oct 19, 2024
@Erb3
Copy link
Contributor Author

Erb3 commented Oct 20, 2024

I had an open PR on the labrinth repo for this, however I have decided to not re-create it in the monorepo. This is primarily because the code was too repetitive, and I think there's likely a better way to do it. I still think it's a valid issue however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Relates to Modrinth Backend or API
Development

Successfully merging a pull request may close this issue.

2 participants