-->

How does Google App Engine Autoscaling work?

2020-02-11 04:11发布

问题:

This question is about Google App Engine quotas and instances.

I deployed a GAE app without specifying any specific scaling algo. From their docs, it seems like the default is auto-scaling.

So when do they scale the app to another instance, i.e. when exactly does a new instance spawn? What request/s causes the second instance to get started and traffic to be split?

回答1:

Actually it is fairly well explained.

From Scaling dynamic instances:

The App Engine scheduler decides whether to serve each new request with an existing instance (either one that is idle or accepts concurrent requests), put the request in a pending request queue, or start a new instance for that request. The decision takes into account the number of available instances, how quickly your application has been serving requests (its latency), and how long it takes to spin up a new instance.

Each instance has its own queue for incoming requests. App Engine monitors the number of requests waiting in each instance's queue. If App Engine detects that queues for an application are getting too long due to increased load, it automatically creates a new instance of the application to handle that load.

It is possible to tune the parameters for autoscaling, see Change auto scaling performance settings and Scaling elements

If you really want to put a hard limit on the number of instances you'll probably have to use basic scaling with a max_instances config or manual scaling.