简体   繁体   English

意外延迟问题 AWS-API 网关

[英]Unexpected latency issues AWS-API Gateway

I need help to troubleshoot AWS API gateway latency issues.我需要帮助来解决 AWS API 网关延迟问题。 We have same configuration and even data everything same but facing high latency issues in Non Prod.我们有相同的配置,甚至数据都相同,但在非生产环境中面临高延迟问题。 Actually we are using Nlb and VPC link for API Gateway.实际上,我们正在为 API 网关使用 Nlb 和 VPC 链接。 Please find same values here below.请在下面找到相同的值。

We have copied the data from dev mongo to test environment to make sure the same volume of data is present in both the places.我们已将数据从 dev mongo 复制到测试环境,以确保两个地方都存在相同数量的数据。 We hit /test/16 from both the environment, but experiencing very high latency in dev as compared to sandbox.我们从两个环境中都命中了 /test/16,但与沙箱相比,在开发中遇到了非常高的延迟。

Test: Request:/test/16测试:请求:/test/16

Status:200状态:200

Latency:213ms延迟:213ms

Dev:开发:

Request:/test/16请求:/测试/16

Status:200状态:200

Latency:4896ms延迟:4896ms

Have you checked your VPC logs to see the flow paths for the requests?您是否检查过您的 VPC 日志以查看请求的流路径? If not, I suggest starting there.如果没有,我建议从那里开始。

As FYI, you can learn about VPC flow logs at https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html#working-with-flow-logs .仅供参考,您可以在https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html#working-with-flow-logs了解 VPC 流日志。

What is behind the load balancer?负载均衡器的背后是什么? Anything you are reaching for with DNS names or just IPs?您要使用 DNS 名称或仅使用 IP 获取什么?

We had a similar problem at one point, looking in the monitoring of the load balancer(ELB) we found that the problem was downstreams.我们曾经遇到过类似的问题,查看负载均衡器(ELB)的监控我们发现问题出在下游。

The monitoring even showed that we got 504s in the load balancer.监控甚至显示我们在负载均衡器中收到 504s。

In our case it was DNS caching that caused it, the target instances had been replaced and the DNS in some nginx instances, on the network path to the target, had not been updated.在我们的案例中,是 DNS 缓存导致了它,目标实例已被替换,并且某些 nginx 实例中的 DNS,在目标的网络路径上,尚未更新。

The nginx instances had to be updated with dynamic DNS resolving. nginx 实例必须使用动态 DNS 解析进行更新。 Since nginx default only resolved the target on startup.由于 nginx 默认仅在启动时解析目标。

With out knowing your architecture however, hard to say what can cause your problems.但是,在不了解您的体系结构的情况下,很难说是什么导致了您的问题。 Here is another DNS story, with some debugging examples: https://srvaroa.github.io/kubernetes/migration/latency/dns/java/aws/microservices/2019/10/22/kubernetes-added-a-0-to-my-latency.html这是另一个 DNS 故事,带有一些调试示例: https ://srvaroa.github.io/kubernetes/migration/latency/dns/java/aws/microservices/2019/10/22/kubernetes-added-a-0-to -我的延迟.html

Good luck.祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM