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

Fetching featured versions for some projects is incredibly slow #3144

Open
2 tasks done
JustAlittleWolf opened this issue Jan 12, 2025 · 0 comments
Open
2 tasks done
Labels
backend Relates to Modrinth Backend or API bug Something isn't working

Comments

@JustAlittleWolf
Copy link

JustAlittleWolf commented Jan 12, 2025

Please confirm the following.

Describe the bug

An api call to projects with lots of versions is still generally fast. For example requesting all versions of the viaversion project (648 versions at the time of writing) only takes about 0.8s:

time curl https://api.modrinth.com/v3/project/viaversion/version &> /dev/null

real    0m0.810s
user    0m0.023s
sys     0m0.000s

However, when fetching the featured versions, it takes more than 6 seconds!

time curl https://api.modrinth.com/v3/project/viaversion/version?featured=true &> /dev/null

real    0m6.825s
user    0m0.013s
sys     0m0.007s

This is especially annoying, since the featured versions are fetched for each project page load as seen here, which causes the viaversion project page to take over 6 seconds to load every time (and they aren't even displayed!).

At this point it would be faster to fetch all versions with https://api.modrinth.com/v3/project/viaversion/version and then filter them by featured versions client-side.

Interestingly, the same thing does not occur with the project fabric-api, which has even more (882 at the time of writing) versions:

time curl https://api.modrinth.com/v3/project/fabric-api/version &> /dev/null

real    0m0.586s
user    0m0.022s
sys     0m0.000s
time curl https://api.modrinth.com/v3/project/fabric-api/version?featured=true &> /dev/null

real    0m0.546s
user    0m0.018s
sys     0m0.000s

This leads me to believe, that the large amout of listed compatible game_versions in the case of viaversion slows down the code here.

Steps to reproduce

  1. run time curl https://api.modrinth.com/v3/project/viaversion/version &> /dev/null
  2. then run time curl https://api.modrinth.com/v3/project/viaversion/version?featured=true &> /dev/null

the second request takes more than 8x to complete

Expected behavior

fetching the featured versions should be roughly as fast as fetching all versions.

Additional context

No response

@JustAlittleWolf JustAlittleWolf added backend Relates to Modrinth Backend or API bug Something isn't working labels Jan 12, 2025
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 bug Something isn't working
Development

No branches or pull requests

1 participant