Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What are the criteria for "light sleep"? #189

Closed
backflip opened this issue Dec 29, 2016 · 8 comments

Comments

@backflip
Copy link

commented Dec 29, 2016

When does the light sleep mode kick in? And how does it work exactly (i.e. what's the usual time it takes to restart a typical express.js application)?

@OlliV

This comment has been minimized.

Copy link
Contributor

commented Dec 29, 2016

Currently we are mainly monitoring whether you have incoming traffic. If you do not have any traffic for some time (the exact time and metrics is subject to change) then your deployment will be frozen. When there is any incoming traffic the deployment is up again in a matter of seconds + the time it takes to initialize your application.

You can measure the exact time yourself by deploying something and then leaving the deployment untouched for a day. Generally the goal is to make it so fast the user won't notice anything odd. At least currently we don't ever snapshot the process state, so it also requires that your application is somewhat optimized to accept requests early as possible.

@OlliV OlliV self-assigned this Dec 29, 2016
@jamo jamo closed this Jan 2, 2017
@backflip

This comment has been minimized.

Copy link
Author

commented Apr 11, 2017

Hey @OlliV, a next.js application I just created takes about 20s to start. However, it might be waiting for another instance providing the API.

The app is based on https://github.com/zeit/next.js/tree/master/examples/ssr-caching and uses static async getInitialProps to query another now.sh instance proxying the contentful API. Any chance I could speed this up?

@OlliV

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2017

I have no idea off the top of my head. You could ask someone on the slack https://zeit.chat/
or DM me there and we can try to look into it together.

@leo

This comment has been minimized.

Copy link
Member

commented Apr 11, 2017

If it's a big app, the building part is probably the one that takes the most time. We're working on improving the performance of Next.js!

@backflip

This comment has been minimized.

Copy link
Author

commented Apr 11, 2017

Sounds good! Anything I can do in the meantime? I fear that the 20s could negatively influence the Google pagerank, e.g., if the crawler has to wait for the machine to wake up. Would it be okay if I implement some kind of (outside) polling mechanism preventing it from going to sleep?

@OlliV, thanks a lot for the offer! I'll try to properly prepare/document everything and provide you with links to the code.

@leo

This comment has been minimized.

Copy link
Member

commented Apr 11, 2017

Oh - what? I don't think we're building on start. Sorry, I think I got that wrong.

@rlindskog

This comment has been minimized.

Copy link

commented Sep 12, 2017

@OlliV Does path aliasing help mitigate this issue if aliasing other NOW instances?

@jamo

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2017

Similarly to other aliases; you may control the sleep with now scale
Otherwise, we use multiple factors including traffic patterns for putting deployments to light sleep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.