Fast on local slow on Vercel
Answered
Macao paper wasp posted this in #help-forum
Macao paper waspOP
Hi, I have this project that I built using next 15, the problem is that on my local build, it renders fast and fetches fast, however, upon deploying it on Vercel, it reaches around 2 secs of fetch time as well as the time it goes to other page. What would be the problem here?
Answered by Asian black bear
You need to check where your Vercel deployment is hosted. If it's at the other end of the world the requests between your functions and AWS will take ages, yes.
6 Replies
Asian black bear
You need to investigate your data fetching most likely. When an app runs locally on the same machine as the database my queries take sub 10ms. When deployed on Vercel you need to take round trip time into consideration when communicating with your external database. This is just an example of what the cause could be.
Time your functions, write debug logs and check the output to find the bottleneck unless you use proper instrumentation already.
Macao paper waspOP
my database runs on AWS which is on Singapore server, does it matter?
Asian black bear
You need to check where your Vercel deployment is hosted. If it's at the other end of the world the requests between your functions and AWS will take ages, yes.
Answer
Macao paper waspOP
I suddenly clicked something into my Vercel right now and found out that I have my server set on NA, it's good now. Thank you! Have a great day!
@Macao paper wasp I suddenly clicked something into my Vercel right now and found out that I have my server set on NA, it's good now. Thank you! Have a great day!
Asian black bear
You changed the deployment region of your functions, yes.