没有流量时,如何将Google App Engine实例缩小为0? [英] How to scale Google App Engine instances down to 0 when there is no traffic?

查看:64
本文介绍了没有流量时,如何将Google App Engine实例缩小为0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在GAE上托管一个应用程序,并希望在无流量时启用自动缩放至0个实例.我认为指定 min_instances:0 将允许这种情况发生.我还包括了文档中建议的 warmup 流程.

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.

我在早上向该应用发送了一个请求,但没有再碰到它,但仍然耗费了10多个实例小时.

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.

谁能告诉我如何在标准环境中启用缩小到0的实例?

Can anyone tell me how to enable scale-down to 0 instance on the standard environment?

我还要注意,我正在使用其他一些GCP服务,包括pubsub和secretmanager.那些人累积了F级实例小时吗?

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

推荐答案

App Engine可以自动创建和关闭实例作为流量波动,或者您可以指定要运行的实例数,无论的流量.

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.

在App Engine仪表板上,选择实例"菜单,然后在摘要"下拉列表中选择实例",在那里您将能够查看您的实例是否处于活动状态.

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.

如果有空闲实例,这要感谢您的应用.yaml配置文件,您可以在其中设置最少的空闲实例,这些实例不工作但可以提供服务,但是您也需要为此实例付费.

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.

这篇关于没有流量时,如何将Google App Engine实例缩小为0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆