GAE shutdown or restart all the active instances of a service/app

后端 未结 2 442
Happy的楠姐
Happy的楠姐 2020-12-11 22:16

In my app (Google App Engine Standard Python 2.7) I have some flags in global variables that are initialized (read values from memcache/Datastore) when the instance start (a

2条回答
  •  [愿得一人]
    2020-12-11 23:04

    One possible solution (actually more of a workaround), inspired by your comment on the related post, is to obtain a restart of all instances by re-deployment of the same version of the app code.

    Automated deployments are also possible using the Google App Engine Admin API, see Deploying Your Apps with the Admin API:

    To deploy a version of your app with the Admin API:

    1. Upload your app's resources to Google Cloud Storage.
    2. Create a configuration file that defines your deployment.
    3. Create and send the HTTP request for deploying your app.

    It should be noted that (re)deploying an app version which handles 100% of the traffic can cause errors and traffic loss due to:

    • overwriting the app files actually being in use (see note in Deploying an app)
    • not giving GAE enough time to spin up sufficient instances fast enough to handle high income traffic rates (more details here)

    Using different app versions for the deployments and gradually migrating traffic to the newly deployed apps can completely eliminate such loss. This might not be relevant in your particular case, since the old app version is already impaired.

    Automating traffic migration is also possible, see Migrating and Splitting Traffic with the Admin API.

提交回复
热议问题