Geetanshu Gulati
Geetanshu Gulati

Reputation: 782

Failed Deployment in App Engine Google Cloud

I am deploying my nodejs application in google cloud app engine but it is giving error This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application. -- when making request.

I had also saw some stackoverflow answers, but they didn't worked for me.

my app.yaml have this config

runtime: nodejs10

Can anyone help me out

Upvotes: 1

Views: 762

Answers (2)

marian.vladoi
marian.vladoi

Reputation: 8074

The "request caused a new process to be started" notification usually occurred when there is no warm up request present in your application.

Can you try to implement a health check handler that only returns a ready status when the application is warmed up. This will allow your service to not receive traffic until it is ready.

Warning: Legacy health checks using the /_ah/health path are now deprecated, and you should migrate to use split health checks.

Here you can find Split health checks for Nodejs

Liveness checks

Liveness checks confirm that the VM and the Docker container are running. Instances that are deemed unhealthy are restarted.

  path: "/liveness_check"
  check_interval_sec: 30
  timeout_sec: 4
  failure_threshold: 2
  success_threshold: 2

Readiness checks

Readiness checks confirm that an instance can accept incoming requests. Instances that don't pass the readiness check are not added to the pool of available instances.

  path: "/readiness_check"
  check_interval_sec: 5
  timeout_sec: 4
  failure_threshold: 2
  success_threshold: 2
  app_start_timeout_sec: 300

Edit

For App Engine Standard, which doesn't afford you that flexibility, hardware and software failures that cause early termination or frequent restarts can occur without prior warning. link

App Engine attempts to keep manual and basic scaling instances running indefinitely. However, at this time there is no guaranteed uptime for manual and basic scaling instances. Hardware and software failures that cause early termination or frequent restarts can occur without prior warning and can take considerable time to resolve; thus, you should construct your application in a way that tolerates these failures.

Here are some good strategies for avoiding downtime due to instance restarts:

Reduce the amount of time it takes for your instances restart or for new ones to start.

For long-running computations, periodically create checkpoints so that you can resume from that state.

Your app should be "stateless" so that nothing is stored on the instance.

Use queues for performing asynchronous task execution.

If you configure your instances to manual scaling: Use load balancing across > multiple instances. Configure more instances than required to handle normal traffic. Write fall-back logic that uses cached results when a manual scaling instance is unavailable.

Instance Uptime

Upvotes: 1

Cloudkollektiv
Cloudkollektiv

Reputation: 14749

You could add the following to your app.yaml:

inbound_services:
- warmup

And then implement a handler that will catch all warmup requests, so that your application doesn't get the full load. The full explanation is given here. Another detailed post about this topic can be found here.

Additionally you can also add automatic scaling options. You can play a bit with those to find the optimum for your application. Especially the latency related variables are important. Good to note that they can be set in a standard GAE environment.

automatic_scaling:
  min_idle_instances: automatic
  max_idle_instances: automatic
  min_pending_latency: automatic
  max_pending_latency: automatic

More scaling options can be found here.

Upvotes: 1

Related Questions