gpt4 book ai didi

tcp - Envoy 的逻辑 DNS 连接管理

转载 作者:行者123 更新时间:2023-12-04 14:21:26 24 4
gpt4 key购买 nike

在其用于逻辑 DNS 服务发现的文档 ( https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/service_discovery#logical-dns ) 中,Envoy 说:

"only uses the first IP address returned when a new connection needs to be initiated"

Envoy 如何决定何时需要启动新的上游连接?

它还说:

"Connections are never drained"

如果上游主机变得不可访问,旧连接会怎样?健康检查是否适用于当前已建立连接的所有上游主机,还是它们仅监控具有当前“第一个 IP 地址”的主机?如果是后者,我是否可以假设 Envoy 仅在尝试写入它并且对等 ACK 超时后才会删除失败的上游连接(并因此停止尝试向这些主机发送流量)?如果是这样,是否可以配置超时时间?

最佳答案

在查看代码并进行一些测试后,这就是我所看到的:

How does envoy decide when a new upstream connection needs to be initiated?

  • 对于连接建立,在 TCP 代理(我使用的过滤器)的情况下,下游和上游连接之间存在 1:1 的映射,因此在建立新的下游连接时也会建立新的上游连接。

What happens to old connections if an upstream host becomes unreachable?

  • 这取决于连接是否正常终止(发送 TCP RST 数据包)。如果是,则连接将被破坏(连同下游连接),如果不是,则在 TCP 连接超时之前什么也不会发生(我相信是由于 TCP_USER_TIMEOUTtcp_retries2 重试 - 在我的本地机器上花费了超过 15 分钟)。

Do health-checks apply to all the upstream hosts that currently have established connections or are they only monitoring the host with the current "first IP address"?

  • 它们仅适用于当前的“第一个 IP 地址”。

If the latter, am I right to assume that Envoy will only remove the failed upstream connection (and consequently stop trying to send traffic to those hosts) once it tries to write to it and the peer ACK times out?

  • 是的。通常情况下,下游客户端超时将首先启动并破坏连接。

If so, is it possible to configure the timeout duration?

  • 我找不到在 envoy 中设置套接字的 TCP_USER_TIMEOUT 的选项。更改操作系统 tcp_retries2 可能会有所帮助,但根据文档,总时间还受 TCP 连接的平滑往返时间的影响,因此更改为 tcp_retries2将无法定义绝对超时值。

关于tcp - Envoy 的逻辑 DNS 连接管理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54307815/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com