Google Cloud Endpoints变慢 [英] Google Cloud Endpoints slower

查看:78
本文介绍了Google Cloud Endpoints变慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们刚刚迁移到Google Cloud Endpoints v2/java8,发现延迟增加了.我们经常在跟踪中看到这种请求:

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

使用大约14毫秒的时间.同样,内存使用率以某种方式上升,而我们的B2前端突然开始阻塞并且经常有10s的延迟,这可能是连接池处理不正确的问题,但是在端点-v1&java7之前.同时,我们看到每个实例报告了0个错误(这是不正确的,它总是在大约10-30秒后中止请求),并且我们无法获得任何堆栈跟踪来查看请求在何处被中止.>

杀死/重启实例将在一段时间内解决10s问题,但这自然不是解决方案.

要实现v2承诺的性能改进,是否需要采取任何步骤?

解决方案

TL; DR-仅GCE 2.0 比GCE 1.0更快,更可靠,但不要使用API​​管理否则您将把所有获得的收益都还给其他人.

在测试GCE 2.0时,我也看到了严重的运行缓慢问题,我无法证明让用户遭受如此可怕的延迟下降是有道理的,所以我着手确定正在发生的事情.

这是我的方法:

我设置了一个最小可行的App Engine应用程序,该应用程序仅包含一个简单的API调用,该调用使用Endpoints 1.0,Endpoints 2.0和带有API Management的Endpoints 2.0返回服务器时间戳.您可以在此处查看所有代码: https://github.com/ubragg/cloud-端点测试

我将它们分别部署到单独的App Engine应用中,并在这些链接处使用API​​ Explorer测试了API(以便您可以自己尝试):
GCE 1.0
GCE 2.0
GCE 2.0 + AM

结果?以下是对每个API的一系列快速请求的结果:

  GCE 1.0 GCE 2.0 GCE 2.0 + AM平均434毫秒80毫秒482毫秒中位数90毫秒81毫秒527毫秒高2503 ms 85 ms 723 ms低75毫秒73毫秒150毫秒 

如您所见,不带AM的GCE 2.0既快速又一致.即使GCE 1.0通常也相当快,但偶尔也会有一些麻烦的离群值.带有AM的GCE 2.0总是慢得令人无法接受,只有在极少数情况下才进入也许可以接受"的范围.

请注意,所有这些时间都是从API Explorer报告的客户端角度来看的.以下是在同一时间段内来自App Engine仪表板的相同请求的 server 报告平均值:

  GCE 1.0 GCE 2.0 GCE 2.0 + AM平均24毫秒14毫秒395毫秒 

因此,最重要的是,如果您关心延迟,那么"API管理"并不是一个真正的选择.如果您对如何在没有API管理的情况下运行GCE 2.0感到好奇,只需确保 NOT 遵循此处的任何说明即可: 解决方案

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.

这篇关于Google Cloud Endpoints变慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆