What does setting the automatic_scaling max_idle_instances to zero (0) do?
automatic_scaling:
max_idle_instances: 0
min_idle_instances: 0
Does it cause an active instance to shutdown immediately once it has finished processing it's current requests?
Technically you can't even set max_idle_instances
it to 0
, you'll see this error at deployment time:
Error 400: --- begin server output ---
automatic_scaling.max_idle_instances (0), must be in the range [1,1000].
--- end server output ---
Deploying a version with a lower number than the one already deployed might not (immediately) shut down idle instances already running that exceed the newly configured number - the limit is not a "hard" one, in some cases it can be exceeded. For example, from the automatic_scaling
row in the Scaling elements table:
Note: When settling back to normal levels after a load spike, the number of idle instances can temporarily exceed your specified maximum. However, you will not be charged for more instances than the maximum number you've specified.
You should also keep in mind that this config applies to the idle instances, not to the dynamic/active instances (which are the ones handling most of the traffic). Lowering the max_idle_instances
config won't affect the dynamic instances.
The idle instances only serve transient overflowing traffic - requests that the currently running dynamic instances can't handle with acceptable latency during sudden rises of the incoming traffic, while GAE spins up additional dynamic instances.
From the same doc referenced above:
Because App Engine keeps idle instances in reserve, it is unlikely that requests will enter the pending queue except in exceptionally high load spikes. You will need to test your application and expected traffic volume to determine the ideal number of instances to keep in reserve.
来源:https://stackoverflow.com/questions/47482850/what-does-setting-the-automatic-scaling-max-idle-instances-to-zero-0-do