Next.js Discord

Discord Forum

slow initial request, then fast requests for 5 minutes

Answered
Golden-cheeked Warbler posted this in #help-forum
Open in Discord
Golden-cheeked WarblerOP
I'm kind of new to using next and wonder why the initial request to a route handler takes significally longer than the requests after that. The requests are "normal" for 5 minutes after the last request. So If I wait 5 minutes without doing any request the times will be slow like the initial request once again.

The same issue occurs between page navigation, if I switch page the initial request it will take way long than "normal", and for 5 minutes after the last request all other page switches feels "normal".

Just wonder where in the docs I can read about the phenomena.
Answered by American black bear
"5 minutes" seems to match your issue
View full answer

7 Replies

American black bear
is this in dev mode or a prod build?
Golden-cheeked WarblerOP
prod build on vercel
American black bear
Golden-cheeked WarblerOP
might be actually, ill see if doing anything from my phone affects it

edit: yeah, it was the cold start
American black bear
"5 minutes" seems to match your issue
Answer
Golden-cheeked WarblerOP
yeah, it's probobaly that. Thanks for the help!