0

I've deployed a Node.js application on Google App Engine (standard environment).

I've noticed that after 10 minutes of inactivity, the app is undeployed and the number of instances goes to 0.

So the first request I make takes 4-5 seconds to reply.

This is my app.yaml

runtime: nodejs10
service: backend
automatic_scaling:
  min_instances: 1

I added also min_idle_instances, but the issue seems not solved:

enter image description here

user2010955
  • 3,871
  • 7
  • 34
  • 53

2 Answers2

0

You can use ‘min_idle_instances’ instead of ‘min_instances’.

When using ‘min_instances’, you define how many instances you would like spun up when your app receives traffic.

When you use ‘min_idle_instances’, you define how many instances you want to keep alive. These instances are kept idle and running in the background in order to receive traffic.

Do note that it may increase your monthly invoice as those instances are live, whether or not they are receiving traffic.

maniSidhu98
  • 527
  • 2
  • 9
  • I tried adding min_instances and min_idle_istances to 4, I still have to test it a bit, sometimes i see few active instances in the google console... – user2010955 Oct 08 '19 at 09:44
  • When you [define ‘min_idle_instances’](https://medium.com/google-cloud/app-engine-resident-instances-and-the-startup-time-problem-8c6587040a80), they still exist even when your app has scaled down to zero. --- You could also use the [Flexible environment](https://cloud.google.com/appengine/docs/the-appengine-environments#cloud-site) to guarantee that you always have one instance up as it does not scale down to zero. --- I saw you added a comment about your choice to use the App Engine flexible. – maniSidhu98 Oct 08 '19 at 21:19
0

I switched from standard to flexible environment, and it seems really better

user2010955
  • 3,871
  • 7
  • 34
  • 53