#Add to cart very slow.

46 messages · Page 1 of 1 (latest)

compact fiber
#

My add to cart is very slow, does anyone know how I can fix this? The whole cart flow feels slow too selecting shipping, payment methods and what not.

lethal storm
#

Not sure but for me was slower and sluggish in development but fast when deployed 🤷🏽‍♂️

compact fiber
#

that is also true for me but still not as fast as I would like. I mean its slower then every other website I feel

safe quartz
#

I agree with that - the cart is very slow and has a very high consumption of queries in DB. However I still need to upgrade to Medusa 1.8+ versions that might help. @compact fiber which version of medusa are you running ?

visual crane
#

Cart is fast for me and i'm not even on 1.8 yet

#

Cart speed has been fixed like a year ago

#

I'm on 1.7.something

#

1.7.14?

#

whatever the latest at 1.7

visual crane
#

Anyway I still advise to use React Query or medusa-react queries and leverage the loading state. Have spinners, loading states whenever the adding-to-cart (adding, modifying, deleting) request is happening. This will make the store speed perception feel faster.

safe quartz
#

Hi @visual crane - yes I remember last year it was really slow and a fix was done that improved a lot the speed. But since few months my add to cart is slow again. It's since I am using tax product override I think.

I got these DB queries that are taking ages when in the checkout process

duration: 2568.129 ms

[DATABASE] [12-1] sql_error_code = 00000 time_ms = "2023-07-03 10:33:18.951 UTC" pid="1282253" proc_start_time="2023-07-03 10:32:42 UTC" session_id="64a2a3ca.1390cd" vtid="22/361401" tid="0" log_line="4" database="" connection_source="176.34.212.68(46238)" user="" application_name="[unknown]" LOG: duration: 2568.129 ms execute <unnamed>: SELECT "Cart"."id" AS "Cart_id", "Cart__region"."id" AS "Cart__region_id", "Cart__region"."created_at" AS "Cart__region_created_at", "Cart__region"."updated_at" AS "Cart__region_updated_at", "Cart__region"."deleted_at" AS "Cart__region_deleted_at", "Cart__region"."name" AS "Cart__region_name", "Cart__region"."currency_code" AS "Cart__region_currency_code", "Cart__region"."tax_rate" AS "Cart__region_tax_rate", "Cart__region"."tax_code" AS "Cart__region_tax_code", "Cart__region"."gift_cards_taxable" AS "Cart__region_gift_cards_taxable",

visual crane
#

You can file an issue for that but I know the first answer will be to update to latest 🙂

compact fiber
#

@safe quartz I am onn

#

on* 1.11

visual crane
#

Altought no

#

it takes 3-4 seconds.

compact fiber
#

is that fast or slow? to you? it feels slow to me still the whole chain, add to cart fetch cart so on

#

is it slower then your site?

visual crane
#

No, it was the preflight that took 227ms. Indeed adding to cart takies 3-4 seconds

#

Something is messed up

compact fiber
#

ok cool well at least that, that means it can be fixed

#

could it be my server hosting?

visual crane
#

Is it fast when you build it locally?

#

If yes, then it might be your server

compact fiber
#

umm no it all feels about the same

#

good thinking on that

visual crane
#

And what custom code have you added?

compact fiber
#

ummmm for default add to cart no custom code.
I have a custom route for adding multiple items to cart.
but I havent messed with any cart code other then that. I mean there is lots of custom code all over the place but its mostly in products and such

visual crane
#

Even a simple https://backend.boardsource.xyz/store/products takes a lot of time for me

#

Something is wrong with your deployment

compact fiber
#

oh thats great news where should I look you think? am using digitalocean app platform setup off the docs for that.

visual crane
#

200 OK
32.48 s

#

It took 32 seconds for that fetch

#

in Postman

#

I have no clue 🙂

compact fiber
#

lol >.< ok im going to poke around thank you very much for your help. Do you have a medusa site I can look to feel your speeds?

compact fiber
#

Do you think think could be from very large metadata in products?

safe quartz
#

I've always had large metadata in variants and it was not an issue

mint delta
#

@compact fiber did you end up solving your issue?

compact fiber
#

haha yes I did database config problem

forest dawn
#

@compact fiber Do you mind sharing what the solution was?

compact fiber
fossil spear
#

Have you got all your redis and a search provider set up I use algolia self hosted on the same server and its really fast. I would recomend Digital Ocean Apps . Also is your postgres database on the same server I had similar issues unitill I hosted the backend and front end all on Digital ocean

fervent heart