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

Slow API fetch, both in dev and prod #280

Open
crnls opened this issue Feb 26, 2024 · 3 comments
Open

Slow API fetch, both in dev and prod #280

crnls opened this issue Feb 26, 2024 · 3 comments

Comments

@crnls
Copy link

crnls commented Feb 26, 2024

The last few days I have been trying to fix extremely slow API fetch issues with my Medusa store. I have tried many obvious solutions, but so far without success. Screenshots below with logs, there are no console errors. Add to cart often takes +6 seconds, simple product pages 2-4 seconds.

Notes:

  • Locally, with external DB, API is also slow
  • Admin API is fast
  • Backend at Heroku (https://dev.wantsandneeds.nl/)
  • Admin & Storefront hosted at Vercel (Vercel functions now build at Frankfurt server) (https://admin.wantsandneeds.nl/ & https://wantsandneeds.nl/)
  • Database at Supabase (Frankfurt, closest to traffic (Netherlands))
  • Tested everything also in clean install, also slow fetch there.
  • Tested several DB providers (AWS RDS, multiple Supabase servers etc)
  • Cart interactions are especially slow

Screenshots:
Scherm­afbeelding 2024-02-26 om 14 11 07
Scherm­afbeelding 2024-02-26 om 14 05 45
Scherm­afbeelding 2024-02-26 om 14 05 35
Scherm­afbeelding 2024-02-26 om 14 05 02

@bqst
Copy link

bqst commented Mar 11, 2024

Since the switch to the new starter pack and server actions, I've been facing the same issue. The actions, especially the 'add to cart' one, now take a significantly longer time (~2 sec) with the same backend.

@VariableVic
Copy link
Collaborator

Is it just as bad when you interact with the server directly? E.g.

curl -X POST '{backend_url}/store/carts/{id}/line-items' \
-H 'Content-Type: application/json' \
--data-raw '{
    "variant_id": "{variant_id}",
    "quantity": 1
}'

I'm running the same setup for next.medusajs.com. The only difference is that I host Redis and Postgres on Heroku instead of Supabase. So that might be the bottleneck here.

Still weird, since you tried several DB providers. Really hard to tell what's causing this bad performance.

@crnls
Copy link
Author

crnls commented Mar 14, 2024 via email

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

No branches or pull requests

3 participants