Search code examples
google-app-enginegoogle-cloud-platformyamlapp.yaml

Is serving static files through `static_files` and `static_dir` affected by scaling


If part of my app.yaml file looks like this:

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

Then is my static content also affected by the scaling parameters for the app? Example, it would run with the same max_concurrent_requests restriction per node, or not?

My assumption is that serving /static would be a completely different layer independent from the instances running for your app in GAE. I was trying to find an architecture diagram confirming this kind of decoupling (maybe a diagram with nginx running with a LB to the GAE Application Instance nodes).

Ideally, a clear answer would be qualified with a reference to Google Cloud documentation material.

Closest related doc I found was this, but it does not clearly answer my question:


Solution

  • Your understanding of the static file serving architecture is correct. App Engine will handle the static file request directly without letting the requests get to the language runtime.

    Because of that, these requests will not be affected by the scaling settings the same way as the "regular" requests would. The max_concurrent_requests is a good example of that.

    I have requested an update to the documentation page you referenced to add this information there.