Next.js Discord

Discord Forum

Extremely slow loading times when deployed on vercel

Unanswered
Boat-tailed Grackle posted this in #help-forum
Open in Discord
Boat-tailed GrackleOP
Hi there, I've been working on a web application for about a week now with constant updates and stuff. Initially, i felt extremely long load times (first accessing the site could take up to 10secs) and navigating around the site took anywhere from really fast ( i assume because some pages have been cached) to reeeeally slow, like 5secs.

Since it was my first time deploying a next.js production app, I just ignored the slow loading times. I also reasoned that maybe because the servers were in US, and being all the way across the globe, that was the reason for the slow loading times.

However, as I continued developing the app, the loading times are becoming reeally unbearable. My app isn't particularly big, and i mostly use server components as well. I have no idea whether users on my site in the US are having way faster loading times, which adds to my distress since it isn't a great user experience to have loading times between pages to be ~5secs. Additionally, I don't want my users far from US to have these loading times either.

Now my question is, how do I diagnose this problem? I'm currently on a Hobby plan, and honestly don't mind upgrading to Pro if it improves the loading times to like ~1sec, but the thing is, I don't even know if upgrading will solve this problem. How do I reduce my 5-7secs loading time when navigating pages? (for what it's worth, it's blazingly fast in development)

21 Replies

@Boat-tailed Grackle Hi there, I've been working on a web application for about a week now with constant updates and stuff. Initially, i felt extremely long load times (first accessing the site could take up to 10secs) and navigating around the site took anywhere from really fast ( i assume because some pages have been cached) to reeeeally slow, like 5secs. Since it was my first time deploying a next.js production app, I just ignored the slow loading times. I also reasoned that maybe because the servers were in US, and being all the way across the globe, that was the reason for the slow loading times. However, as I continued developing the app, the loading times are becoming reeally unbearable. My app isn't particularly big, and i mostly use server components as well. I have no idea whether users on my site in the US are having way faster loading times, which adds to my distress since it isn't a great user experience to have loading times between pages to be ~5secs. Additionally, I don't want my users far from US to have these loading times either. Now my question is, how do I diagnose this problem? I'm currently on a Hobby plan, and honestly don't mind upgrading to Pro if it improves the loading times to like ~1sec, but the thing is, I don't even know if upgrading will solve this problem. How do I reduce my 5-7secs loading time when navigating pages? (for what it's worth, it's blazingly fast in development)
are you fetcing a lot of data in server components??
Boat-tailed GrackleOP
im not sure what is considered a lot, but yes i am fetching data
where are you fetching data from?
Boat-tailed GrackleOP
mongodb
using?
Boat-tailed GrackleOP
err
mongoose?
and what is the region of your mongodb?
Boat-tailed GrackleOP
its in SEA
SEA?
Boat-tailed GrackleOP
south east asian
asia*
well ig that's the reason
maybe you're close to SEA that's why it is fast in dev
Boat-tailed GrackleOP
is there a way to make it fast world wide? i read about shards but im not too familiar with how it works, and i did a quick check in my mongo console and my cluster is sharded so i assume its being hosted around the world as well?
sorry i dont make sense as im still fairly new
if i*
Boat-tailed GrackleOP
i see
should i change it to US since thats where the server is?