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

会有一股神秘感。 提交于 2021-01-04 06:57:43

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/51533528/how-can-i-decrease-deployment-time-of-node-app-on-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!