Is it possible to detect when a Google App Engine Instance starts (via a method, API, or some call or event to monitor)

172 views
Skip to first unread message

NP

unread,
Jan 5, 2019, 11:24:22 AM1/5/19
to Google App Engine
Hello,

When my application (instance) starts, I'd like to check the datastore and seed some values if they do not exist. I'd like to make this check only when the application (instance) starts. Is there a way to know when an instance is started/restarted?

Thanks

Vitaly Bogomolov

unread,
Jan 5, 2019, 2:09:27 PM1/5/19
to Google App Engine
Hi, NP.

You can use warmup requests for this task:

WBR, Vitaly.

NP

unread,
Jan 5, 2019, 3:14:17 PM1/5/19
to Google App Engine
Thanks for the suggestion. I'll keep this to use as a worst case scenario because there are limitations to using warm-up requests - the link you sent me has this

.....
Note that warmup requests are not guaranteed to be called. In some situations loading requests are sent instead: for example, if the instance is the first one being started up, or if there is a steep ramp-up in traffic.


As a result, you might encounter loading requests, even if warmup requests are enabled in your app. For example, if your app is serving no traffic, the first request to the app will always be a loading request, not a warmup request.
.....

Nicolas (Google Cloud Platform Support)

unread,
Jan 8, 2019, 8:00:49 PM1/8/19
to Google App Engine

Hi,


There are a couple of ways to check if an instance of App Engine is up and running however they are all external to the app itself. Based on my research, it seems that what you are looking for is not available on App Engine at the moment and due to that I would recommend that you file a feature request via this page.


Please provide more information about the use case and the end result that you are trying to achieve. This will help our App Engine engineering team narrow down exactly how the feature should be implemented.


One of the ways to check externally if an instance  is running, would be to use the LIST and GET methods of the apps.services.versions.instances REST resource of the App Engine Admin API.


The idea here would be to fetch the name of the instance via LIST and then use GET to obtain the Availability status of the instance. If the status is “Resident” or “Dynamic” it would mean that the instance is currently running. You could then use this to trigger an action in Cloud Datastore.


Reply all
Reply to author
Forward
0 new messages