Search code examples
google-app-enginegoogle-cloud-platformautoscaling

(Basic Scaling) Will App Engine shut down an app that's still busy handling a request if the idle timeout is reached?


Google describes basic scaling like this:

enter image description here

I don't really have any other choice, as I'm using a B1 instance, so automatic scaling is not allowed.

That raises the question though, if I have an endpoint that takes a variable amount of time (could be minutes, could be hours), and I basically have to set an idle_timeout, will App Engine calculate idle_timeout from the time the request was made in the first place or when the app is done handling the request?

If the former is right, then it feels a bit unfair to have to guess how long requests will take when thread activity is a usable indicator of whether or not to initiate shutdown of an app.


Solution

  • Here you are mixing up two different terms.

    idle_timeout is the time that the instance will wait before shutting down after receiving its last request

    Request timeout is the amount of time that App Engine will wait for the return of a request from your app

    As per the documentation:

    Requests can run for up to 24 hours. A manually-scaled instance can choose to handle /_ah/start and execute a program or script for many hours without returning an HTTP response code. Task queue tasks can run up to 24 hours.