1

The GCP infra hits your app on '/_ah/health' to determine that it is still alive. My app is a 'Flex' type, and it is being hit a lot on that URL:

enter image description here

It is making the logs hard to navigate, apart from anything else :(

How do I dial back the frequency of GCP testing the health end-point?

paul_h
  • 1,859
  • 3
  • 19
  • 27
  • Update your YAML file to include a customized health check option. Putting health checks in app.yaml: https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml#health_checks Regarding logs: You can easily filter logs to not include any health checks. – Vikram Tiwari Jun 24 '17 at 19:08
  • Possible duplicate of [Google App Engine health checks spamming app](https://stackoverflow.com/questions/42841697/google-app-engine-health-checks-spamming-app) – Dan Cornilescu Jun 25 '17 at 13:57

2 Answers2

2

You can configure how App Engine performs health checks against your VM instances hosting your apps as part of the health_check: configuration in your app.yaml.

Health checks

Periodic health check requests are used to confirm that a VM instance has been successfully deployed, and to check that a running instance maintains a healthy status. Each health check must be answered within a specified time interval. An instance is unhealthy when it fails to respond to a specified number of consecutive health check requests. An unhealthy instance will not receive any client requests, but health checks will still be sent. If an unhealthy instance continues to fail to respond to a predetermined number of consecutive health checks, it will be restarted.

Health check requests are enabled by default, with default threshold values. You can customize VM health checking by adding an optional health check section to your configuration file:

health_check:
  enable_health_check: True
  check_interval_sec: 5
  timeout_sec: 4
  unhealthy_threshold: 2
  healthy_threshold: 2

You can use the following options with health checks:

enable_health_check - Enable/disable health checks. Health checks are enabled by default. To disable health checking, set to False. Default: True

check_interval_sec - Time interval between checks. Default: 1 second

timeout_sec - Health check timeout interval. Default: 1 second

unhealthy_threshold - An instance is unhealthy after failing this number of consecutive checks. Default: 1 check

healthy_threshold - An unhealthy instance becomes healthy again after successfully responding to this number of consecutive checks. Default: 1 check

restart_threshold - When the number of failed consecutive health checks exceeds this threshold, the instance is restarted. Default: 300 checks

By default the health checks are turned on and it is recommended not to turn off health checking just to ensure App Engine does not send requests to a VM which is not responding. Instead you can control the check_interval_sec to adjust how often you want your VM health checked.

You can always filter out information from the logs when viewing the logs. Check out the information on Advanced Log filtering UI and syntax.

Tuxdude
  • 47,485
  • 15
  • 109
  • 110
1

As others have mentioned there's an app.yaml config page

As of date of posting, it doesn't say what the default is.

Here's what's super weird for the check_interval_sec var - My deployments are blocked by the GCP deployer, for certain settings values.

A setting of 200 for 'check_interval_sec', caused the deployment to fail with the following message:

"Invalid value for field 'resource.checkIntervalSec': '6000'. 
 Must be less than or equal to 300"

A setting of 20, caused the deployment to fail with the following message:

"Invalid value for field 'resource.checkIntervalSec': '600'. 
 Must be less than or equal to 300"

A setting of 10 worked, and it is indeed ten seconds in the console (though a bunch of threads his the JVM at the same moment for some reason).

TL;DR: seconds are not seconds in 'check_interval_sec' - at least for 'flex' apps.

paul_h
  • 1,859
  • 3
  • 19
  • 27
  • That parameter field seems to be on drugs. I found experimentally that a value of 60 just caused deployment to fail with message "ERROR: (gcloud.app.deploy) Error Response: [13] App Engine Flex failed to configure resources", but a value of 5 was ok. They could do better on the error reporting. – Darren Feb 15 '18 at 18:10