Leadaxe:考虑用连续拨号错误触发负载均衡节点健康复查

Leadaxe 说明,当前节点只在健康检查失败后退出池,单次拨号错误不改变状态,以免把目标站故障误判成节点故障;sticky 映射可能持续使用已失效但未复查的节点。作者提出连续若干错误后提前健康检查,仍由检查决定移出,并列出错误类型、阈值、限流和 sticky 迁移等待讨论点;这不是已决定的修改。

作者原文

An idea to think over, not a decided change. Comes from Leadaxe/LxBox#191.

What the user saw

A load-balance group with a pool of 2+ slots, sticky keys on, health-check interval 10 minutes. One node is killed by hand. Until the next scheduled check the balancer does not know the node is dead: the slot still counts as alive, and sticky keys keep sending new connections to it. They fail. Worst case — almost a full interval of failing connections for part of the traffic.

Current behaviour (as designed)

  • A slot leaves the pool only when its node fails a health check.
  • A dial error does not touch the pool: one failed connection cannot tell a dead node from a destination that did not answer.
  • The only lever the user has is a shorter check interval.

The idea

A middle ground between "ignore dial errors" and "evict on a dial error": N dial errors in a row on one slot (no successful dial in between) trigger an immediate health check of that slot instead of waiting for the timer. The check, not the dial errors, decides whether the slot leaves the pool — so a destination that does not answer cannot evict a healthy node.

Open questions

  • Which errors count: only errors of reaching the node itself (handshake, timeout to the proxy), or anything returned by the dial? Errors about the destination should not count.
  • The value of N and whether it is configurable.
  • Rate limit: at most one early check per slot per some window, so a broken destination hammered by an app does not turn into a check storm.
  • Does the same apply to failover / urltest groups, or only to the balancer.
  • Interaction with sticky keys: after the slot is dropped, existing sticky mappings to it must move.