【问题标题】:Limit GCP App Engine to use only 1 unit of app engine flex core将 GCP App Engine 限制为仅使用 1 个单元的 app engine flex core
【发布时间】:2021-01-22 17:54:06
【问题描述】:

我是 GCP 应用引擎的新手——我有一个 node.js 应用在应用引擎 flex 上运行。目前,Google 每月向我收取超过 3500 小时的弹性实例核心小时数。他们告诉我我正在使用多个实例,这就是为什么需要大量时间。但是,我已将 app.yaml 文件中的实例数限制为 1——但似乎它不起作用。这是我的 app.yaml 文件,并使用gcloud app deploy 来部署应用程序。

#Copyright 2017, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gae_quickstart_yaml]
runtime: nodejs
env: flex

network:
  session_affinity: true

# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml

manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10
# [END gae_quickstart_yaml]

【问题讨论】:

  • 您是否还有其他 App Engine 版本仍在与当前版本同时运行?
  • 附带问题:您为什么使用 App Engine flex?您有什么要求?
  • @guillaumeblaquiere -- 我使用 App Engine flex,因为我的 node.js 应用程序需要 socket.io 支持。
  • @JohnMichaelG - 我不相信我有任何其他 App Engine 版本同时运行。应该只运行一个版本。我只是使用gcloud app deploy 进行部署——我认为这将杀死以前的版本并部署一个新版本。
  • 感谢您的更新。我认为Cloud Run现在可以兼容了,它支持双向流,并且请求超时现在限制为60分钟!所以,这不是主题。 @JohnMichaelG 的想法是正确的!如果你没有其他服务,也没有其他活动版本(实例数量为 1),我不知道这些额外费用从何而来!

标签: google-app-engine google-cloud-platform app-engine-flexible google-appengine-node


【解决方案1】:

要回答这个问题,您的 每月 3500 小时的 flex 实例核心小时数来自于部署的 App Engine Flex 旧版本。因为 App Engine Flex 在虚拟机上运行,​​每当您使用命令 gcloud app deploy 部署新版本时,即使没有流量,旧版本仍在运行。要使用新部署替换旧版本,请使用gcloud 命令:

  • gcloud app deploy --version=VERSION

还可以删除/停止版本,您可以在 Google Cloud Console(App Engine > 版本)中执行此操作,然后检查您要删除/停止的所有版本或通过gcloud 命令:

  • gcloud app versions delete VERSIONS
  • gcloud app versions stop VERSIONS

如果联系 Google 计费部门仍然无法解释费用的来源,我相信联系 Google Cloud 技术支持可能会对此提供更多解释。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-11
    • 1970-01-01
    • 2011-07-02
    • 1970-01-01
    • 2019-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多