模拟 AKS 中的应用程序与 Azure 中的 PostgreSQL 服务器之间的网络延迟

Simulate network latency between application in AKS and PostgreSQL server in Azure

我需要测试一个场景以了解我的应用如何处理延迟。我的应用程序在 Azure (AKS) 上的 K8S 中,它连接到 Azure 中的 Postgres 数据库。任何人都知道有哪些好的工具实施起来不太棘手吗?

pgbench 是最简单的使用方法,网上有很多关于使用此命令的信息。

对于简单的 Ping 和延迟检查,您可以使用正常的 docker 图像 Busybox 并检查整个网络的延迟。

也可以使用Prometheus来监控,赞

pg_stat_activity_max_tx_duration is one metrics type. 

您可以在 here

阅读更多内容

检查 POD 网络通信:https://docs.projectcalico.org/getting-started/kubernetes/hardway/test-networking

您还可以查看像 datadog 这样的工具,它会显示延迟和性能指标等良好的细节。

额外 :

如果您的团队面临延迟问题,请不要忘记检查 Pgbouncer

我最终创建了一个 haproxy VM 并通过它引导我的数据库流量。然后在haproxy上我用网络模拟器linux工具来延迟流量。效果很好

https://wiki.linuxfoundation.org/networking/netem