medusajs/nextjs-starter-medusa

GET requests very slow when adding product to a cart

Saadchr opened this issue · 2 comments

Hello,

2024-02-02 10 15 44

GET requests are very slow when adding product to a cart.
The experience in next.medusajs.com is very snappy compared to my local environment (even in development , using npm run start for both the front end and admin, + using redis cache and events)

I wonder if it's because of my supabase free tier.

What is the stack used next.medusajs.com?
How can I do to make it as fast?

Thanks

Hey @Saadchr,

Have you tried running everything locally (Next.js server, Medusa server with npx medusa develop, redis-server, postgres db)? Generally speaking, this should result in faster performance the your are showing in your video, depending on your machine ofc.

I have no experience working with Supabase, so I don't know if that could be the bottleneck.

The demo stack is:

  • Storefront: Vercel (pro plan)
  • Medusa Server: Heroku (Basic dyno)(incl Postgres Standard-0 and Redis Premium-0)

On a side note, the middleware.ts in the current version is a bit buggy. I'm working on a better version and some cache improvements, which might benefit your case. But even then, the performance in your video is slower than what it should be.

Hello,

I've subscribed to a supabase pro plan and the issue is still the same.
I've compared to a postgresql instance on railway and I've come to the conclusion that Supabase is actually the bottleneck as the experience with postgresql turns out to be significantly better
I've contacted the supabase team to find the origin of the issue.

Thanks