Google app engine nodejs local development

旧巷老猫 提交于 2020-07-08 13:39:14

问题


Is there a way to run my nodejs application locally so that I can simulate my application running in production App Engine without deploying it? For some reason my app behaves differently in the Google App Engine compared to my localhost.

I am getting tired of deploying my application to Google App Engine every time I make a change just to see if there's a bug.


回答1:


You'll never get exactly the same behaviour on your local system and on the real GAE infrastructure. For once simply because the infrastructure on which you're running is different: OS, hardware and network performance/capabilities, performance/capabilities of the actual vs SDK-simulated google APIs and services your app may be using, timing, etc.

A few examples (they're from the standard env GAE, it's true, but it's fundamentally the same idea):

  • FetchOptions withLimit() does not reduce query execution time (Google App Engine)
  • Datastore fetch VS fetch(keys_only=True) then get_multi
  • Why does Google Cloud SQL (using JDBC) take longer to insert records from Google App Engine than from my personal computer?
  • Ndb strong consistency and frequent writes

You should investigate the differences - you're more than welcome to ask questions about each one of them right here, on SO.

In general you'll find the differences falling in 2 categories:

  • plain performance differences, expected, but they may uncover actual problems in your code: race conditions, wrong timing assumptions, etc

  • functional differences - to find general areas where you want to perform testing on GAE rather than locally.

    For example I learned (the hard way) that the SDK datastore emulator doesn't emulate the contention logic from the real datastore - while locally my app was running fine, on GAE it was crawling miserably due to contention, I had to re-write a good portion of the logic to address it. See Contention problems in Google App Engine



来源:https://stackoverflow.com/questions/44038905/google-app-engine-nodejs-local-development

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