Reputation: 83
This is the app.yaml I define
runtime: nodejs16 env: flex service: default env_variables:
MONGO_USER: 'xxxxxx' MONGO_PASS: 'xxxxxxxxxx' automatic_scaling: min_num_instances: 3
This is the final configuration ,ignoring my config after deploying
runtime: nodejs api_version: '1.0' env: flexible threadsafe: true env_variables: MONGO_PASS: xxxxxx MONGO_USER: xxxxxx automatic_scaling: cool_down_period: 120s min_num_instances: 2
max_num_instances: 20 cpu_utilization: target_utilization: 0.5 liveness_check: initial_delay_sec: '300' check_interval_sec: '30' timeout_sec: '4' failure_threshold: 4
success_threshold: 2 readiness_check: check_interval_sec: '5'
timeout_sec: '4' failure_threshold: 2 success_threshold: 2
app_start_timeout_sec: '300'
I am trying to host a simple api server (nodejs,express,typescript) but after a while the endpoint automatically becomes inactive when I ping from postman. Once I open the app engine dashboard and click on the instance, and make the api call again it works.
I tried this with both standard and flexible environment
I tried adding min_idle_instances:1 yet, it doesn't appear in the final config. (maybe it's only for standard env)
The docs say I should handle warmup request (for standard env), but I couldn't find a boilerplate on how to hanlde a warmup request
Upvotes: 0
Views: 114
Reputation: 3029
To enable warmup requests, add the warmup element under the inbound_services directive in your app.yaml file as mentioned in this document.
To handle the warm up request call to /_ah/warmup
to return a 200 response.As described in this document You can also respond to warmup requests by using one of the following methods
Using a servlet The easiest way to provide warmup logic is to mark your own servlets as in the web.xml configuration file.
Using a ServletContextListener Al lows you to run custom logic before any of your servlets is first invoked either through a warmup request or a loading request.
Using a custom warmup servlet Using a custom warmup servlet invokes the servlet's service method only during a warmup request rather than during loading requests.
You may also check this similar thread
Upvotes: 0