Google App Engine strange delay

只谈情不闲聊 提交于 2019-12-04 06:52:53

Usually the unaccounted for "hole" in the middle of appstats is your code executing.
Appstats records every rpc entry and exits and the areas he cannot record are your actual code running.

Do you have logs for the time in which the application was between those two calls?

Huge, 'unexplained' latency is almost always warmup requests gobbling up resources. Inspect your appengine logs to see how much api_ms and cpu_ms are being used on warmups.

You can avoid warmups by increasing your maximum pending latency in appengine control panel. Allowing higher latency means requests will wait longer before firing a new instance. This could make each request a little slower, but you will avoid heavyweight loading requests.

To help with warmup requests, make sure your appengine-web.xml has:

<warmup-requests-enabled>true</warmup-requests-enabled>  

This will cause the appengine dispatcher to preemptively fire up new instances when the current ones are being overloaded {i.e. it starts loading before a request goes to the new instance}.

then, in the affected slow servlets, make sure you put load-on-startup in your web.xml:

<servlet>
  <servlet-name>my-servlet</servlet-name>
  <servlet-class>com.company.MyServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>

load-on-startup merely ensures that your high-priority servlets are always ready to go as soon as the warmup request finishes.

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