【问题标题】:Is serving static files through `static_files` and `static_dir` affected by scaling正在通过受缩放影响的 `static_files` 和 `static_dir` 提供静态文件
【发布时间】:2021-06-06 20:49:13
【问题描述】:

如果我的 app.yaml 文件的一部分如下所示:

handlers:
  - url: /favicon\.ico
    static_files: favicon.ico
    upload: favicon\.ico

  - url: /static
    static_dir: public

  - url: /.*
    secure: always
    redirect_http_response_code: 301
    script: auto

automatic_scaling:
  min_idle_instances: automatic
  max_idle_instances: automatic
  min_pending_latency: automatic
  max_pending_latency: automatic
  max_concurrent_requests: 1
  min_instances: 1
  max_instances: 10

那么我的静态内容是否也受到应用缩放参数的影响?例如,它是否会在每个节点上以相同的max_concurrent_requests 限制运行?

我的假设是,服务 /static 将是一个完全不同的层,独立于在 GAE 中为您的应用运行的实例。我试图找到一个确认这种解耦的架构图(可能是一个带有 LB 运行到 GAE 应用程序实例节点的 nginx 的图)。

理想情况下,一个明确的答案将通过参考 Google Cloud 文档材料来限定。

我找到的最接近的相关文档是这个,但它没有明确回答我的问题:

【问题讨论】:

  • 您的假设是正确的,但我没有找到文档或演示文稿来证明这一点。

标签: google-app-engine google-cloud-platform yaml app.yaml


【解决方案1】:

您对静态文件服务架构的理解是正确的。 App Engine 将直接处理静态文件请求,而不让请求进入语言运行时。

因此,这些请求不会像“常规”请求那样受到缩放设置的影响。 max_concurrent_requests 就是一个很好的例子。

我已请求更新您引用的文档页面,以便在其中添加此信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-27
    • 2023-03-18
    • 2011-01-16
    • 2015-03-18
    • 2019-02-22
    • 1970-01-01
    相关资源
    最近更新 更多