Google Cloud Endpoints slower

可紊 提交于 2021-01-24 07:09:54

问题


We just migrated to google cloud endpoints v2 / java8 and found that latency has gone up. We see this kind of request in traces often:

https://servicecontrol.googleapis.com/v1/services/<myapi>.endpoints.<myappid>.cloud.goog:check

Which uses around 14ms. Also, somehow memory usage went up and our B2 frontends suddenly start blocking and having delays of 10s often, which could be a problem with connection pooling not done right, but was somehow not present with endpoints-v1 & java7 before. At the same time, we see 0 errors reported per instance (which is not true, it is aborting requests after around 10-30s all the time) and we cannot get any stack traces to see where a request was aborted like before.

Killing / restarting an instance will solve the 10s problem for some time, but that is naturally not a solution.

Are there any steps that have to be done to get to the promised performance improvements of v2?


回答1:


TL;DR - GCE 2.0 alone is faster and more reliable than GCE 1.0, but don't use API Management or you'll give back all those gains and then some.

I too was seeing major slowness issues when testing out GCE 2.0, and I couldn't possibly justify subjecting my users to such terrible latency drops, so I set out to determine what's going on.

Here was my methodology:

I set up a minimum viable App Engine app consisting of just one simple API call that returns a server timestamp using Endpoints 1.0, Endpoints 2.0, and Endpoints 2.0 with API Management. You can see all the code for these here: https://github.com/ubragg/cloud-endpoints-testing

I deployed each of these to a separate App Engine app and tested the API using the API Explorer at these links (so you can try for yourself):
GCE 1.0
GCE 2.0
GCE 2.0+AM

The results? Here are the results of a bunch of requests in rapid succession on each of the APIs:

             GCE 1.0    GCE 2.0    GCE 2.0+AM
average       434 ms      80 ms        482 ms
median         90 ms      81 ms        527 ms
high         2503 ms      85 ms        723 ms
low            75 ms      73 ms        150 ms

As you can see, GCE 2.0 without AM was both fast and consistent. Even GCE 1.0 usually was pretty fast, but would occasionally have some troublesome outliers. GCE 2.0 with AM was pretty much always unacceptably slow, only dipping into the "maybe acceptable" range on rare occasions.

Note that all of these times are from the client perspective reported by the API Explorer. Here are the server reported averages for the same requests from the App Engine dashboard over the same time period:

             GCE 1.0    GCE 2.0    GCE 2.0+AM
average        24 ms      14 ms        395 ms

So bottom line is, if you care about latency, API Management isn't really an option. If you're curious about how to run GCE 2.0 without API Management, simply be sure NOT to follow any of the instructions here: https://cloud.google.com/endpoints/docs/frameworks/python/adding-api-management.




回答2:


Using the base API framework without the management library (of which the 14ms calls you mentioned are a part), you should get some improved latency. There is some increased memory usage in the v2 frameworks, as it is now incorporating code that was previously a separate service. If you are not using API management, I would suggest removing the library and seeing if it helps. It should eliminate the 14ms of latency and reduce memory use a fair amount, as you won't be loading as much code or data.



来源:https://stackoverflow.com/questions/45585413/google-cloud-endpoints-slower

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