Why API call take 80 ms latency to reach controller (in Google App Engine)?

北城以北 提交于 2019-11-30 19:04:55

问题


For every Api call to reach controller, it is taking 80ms latency, i have tried all the instance classes, result is same, i have not found any solution for this. As show in the image, RPC call starts at 80th ms, remaining time spending out side of my code.


回答1:


Well, there may be a lot of GAE infra code executing for every request before your app code is invoked - it's the nature of PaaS: it gives you the convenience of simpler app code by taking a portion of the stuff that needs to be executed and performing it for you.

Similarly there will be time spent in the framework(s) and libraries you use to simplify your app code. Even if it's not literally your code it's still your app's code.

You can get a glimpse (not necessarily quantitative) of that by checking some real full strack traces seen on GAE. At least in my (python) app's case a stack trace often shows several times more calls outside my code than calls from my code.




回答2:


Check your App Engine logs for the request that initiated this trace. Do you see a message stating:

"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."

If so, the latency is likely due to low demand on your app and with increased demand the latency would be infrequent.

Otherwise, you should probably post your code that is being executed to dive into what could be taking longer.



来源:https://stackoverflow.com/questions/40903777/why-api-call-take-80-ms-latency-to-reach-controller-in-google-app-engine

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