proxy - 从池中获取连接 - Envoy
问题描述
我需要从池中获取连接以连接到上游,但偶尔会遇到 503 问题。我想知道这个的根本原因
https://github.com/envoyproxy/envoy/blob/master/source/common/router/router.cc
Http::ConnectionPool::Instance* conn_pool = getConnPool();
if (!conn_pool) {
sendNoHealthyUpstreamResponse();
return Http::FilterHeadersStatus::StopIteration;
}
这是导致 503 的代码部分。我尝试使用 while 循环重试固定次数,但仍然面临错误。有人可以指导找到根本原因或我该如何处理吗?
编辑:我怀疑的一个可能原因是特使方面经常发生排水。那么有没有办法可以控制发生排水的持续时间的drain_type?
我已按照此文档(https://www.envoyproxy.io/docs/envoy/latest/api-v1/listeners/listeners.html?highlight=draining%20modify_only)将drain_type从默认更改为modify_only。
但是面对这个错误:
error initializing configuration '/etc/envoy-config.json': JSON at lines 3-57 does not conform to schema.
Invalid schema: #
Schema violation: additionalProperties
Offending document key: #/drain_type
解决方案
我尝试的一种解决方案是将 drain_timeout 增加到更大的值,例如 20 秒,而不是使用设置为 5 秒的默认值。这大大减少了我现在击中的 503 的数量,减少了 2 倍。另一方面,仍然未知.. 这种设置可能产生的副作用是什么仍有待探索,尽管它正在解决目前的目的。欢迎任何建议/意见/解决方案:)
推荐阅读
- delphi - 外部延迟它在多线程中工作吗?
- swift - 使用 EarlGrey 2 在 UITableViewCell 中声明标签
- mysql - MySQL SELECT 从 2 个表中获取最新记录
- python - 使用 Swift 5.2 调用 REST API
- javascript - 使用那里已经存在的链接将属性添加到 ahref 按钮
- sql - SQL 窗口函数,用于获取存在超过 1 个唯一姓氏的地址(雪花)
- python - 从字符串中提取数字和浮点数
- php - 无法将隐藏值传递给 laravel 中的数据库
- javascript - 从 Python BeautifulSoup 中的 javascript 源中提取值
- javascript - 如果复选框为真,我如何使用 asyncstorage 存储?