Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
330 stars 56 forks source link

nextjs ssr experiencing cold start ( > 5 sec) #1144

Closed doorman02 closed 8 months ago

doorman02 commented 1 year ago

Describe the bug

I am deploying a NextJs app with ssr and the first call to getServerSideProps takes > 5 seconds even after removing all logic from it. After the inital call it loads much faster. But if idle for some time it will trigger another cold start. Is this related to the cold start of the ssr server? If this is the case, would it possible to configure it to be always on or to keep it warm?

To Reproduce Steps to reproduce the behavior: Create NextJs app with ssr.

Expected behavior The app should load faster on the inital call to getServerSideProps

Device info (if applicable):

thomasgauvin commented 1 year ago

Hi @doorman02, we hear your feedback. We're actually tracking all feedback related to NextJS here, you'll see that cold starts is also reported by others: https://github.com/Azure/static-web-apps/discussions/1066

We've been working to improve our support for NextJS and reduce cold starts. We'll be providing updates in that thread when they come along.

thomasgauvin commented 8 months ago

Hi @doorman02, we've shipped significant improvements to our Next.js support on Static Web Apps, here's the announcement: https://github.com/Azure/static-web-apps/discussions/1428

Notably, cold starts are drastically reduced! Closing this thread, try out our improved Next.js support and let us know how it goes in #1428!

doorman02 commented 8 months ago

Hi @thomasgauvin thanks for the update. Do you know what was the cause for the cold start issue?

KMDgit commented 1 month ago

This issue is still present. I'm getting sometimes +5 s to load a simple page of 46B.

Screenshot 2024-09-16 at 10 43 56 AM
KMDgit commented 1 month ago

You have to reopen this issue @thomasgauvin. It's really annoying.