问题
I am hosting an app on GAE and want to enable auto-scaling down to 0 instances when there is no traffic. I thought that specifying min_instances: 0
would allow that to happen. I also included the warmup
process recommended in the docs.
I sent a single request to the app in the morning and didn't touch it again but it still racked up 10+ instance hours.
Can anyone tell me how to enable scale-down to 0 instance on the standard environment?
I'll also note that I''m using a few other GCP services, including pubsub and secretmanager. Do those accumulate F-class instance hours?
service: default
runtime: python37
instance_class: F4_1G
automatic_scaling:
target_cpu_utilization: 0.80
min_instances: 0 # should enables aut-scaling down to 0 instances when no traffic
max_instances: 2
max_pending_latency: 2000ms
min_pending_latency: 30ms # default
entrypoint: python -m api.app
handlers:
- url: /home
script: auto
inbound_services:
- warmup # sends GET request to application's /_ah/warmup endpoint
回答1:
As mentioned on the docs
App Engine can automatically create and shut down instances as traffic fluctuates, or you can specify a number of instances to run regardless of the amount of traffic.
This means that if an instance does not work in a log time, it will be shut down or in the case that you have configured min_idle_instances this instances will kept running and ready to serve traffic.
On the App Engine Dashboard, select the instances menu, then on the Summary drop-down select Instances, there you will be able to see if your instance is active.
If there are active instances this will probably mean your instance is still doing some work, a background task or maybe there is something stuck.
if there are idle instances this will be thanks to your app.yaml config file, where you setup the minimum idle instances and there are not working but ready to serve, however you will be billed for this instances too.
来源:https://stackoverflow.com/questions/61001834/how-to-scale-google-app-engine-instances-down-to-0-when-there-is-no-traffic