vonGohren
vonGohren

Reputation: 949

How can I decrease deployment time of Node app on Google App Engine

Right now the time is around 10 minutes, but my app uses 2 minutes on npm install, which app engine does on every deploy, and then runs in about 5 seconds. Why does it take so long time, and is there any tricks that can be done to lower this?

I have heard other places that this is because of changing routes, and that docker slows things down. But I would believe a company like google could manage to atleast cut this down to 1/3 of the current speed.

There are some older questions, but I would like to have an up to date answer

Google cloud deploy so slow

why does google appengine deployment take several minutes to update service

https://groups.google.com/forum/#!topic/google-appengine/hZMEkmmObDU

Upvotes: 3

Views: 1815

Answers (1)

LundinCast
LundinCast

Reputation: 9810

At the moment, App Engine Flexible deployments are indeed quite slow but as stated in the links you provided (this still stands true), most of the deployment time needed is incurred by actions you can't act upon (load balancer and network configuration, etc...). What you CAN do to speed it up is to:

  • limit the size of the app you're deploying
  • limit the complexity of the build necessary in the Dockerfile, if present
  • ensure you have a fast and reliable internet connection during deployment

Now, there is one option to bypass most of the new setting-up overheads during development. You may specify an already existing version name as parameter during deployment and also specify --no-promote flag:

gcloud app deploy --version <existing-version-number> --no-promote

I've tried it myself and it drastically reduced the deployment time, to ~1m30 for a Hello World app. It does an in-place replacement instead of a new one. Of course, most of the saved time is due to skipped overhead and you'll have to manually direct traffic to that new version. Also, versioning clarity will obviously be impacted, that's why I wouldn't recommend it for production deployment.

Upvotes: 1

Related Questions