HAProxy 调整恢复服务器的权重/连接数

HAProxy 调整恢复服务器的权重/连接数

我想限制连接数,或者在 DOWN->UP 转换之后的一定时间内限制服务器的权重。

在那段时间之后,假设服务器仍然运行,我希望它恢复到标准的连接数/权重。

实际上,我试图复制“慢启动”功能在 Citrix Netscaler 中。

这是为了阻止对刚刚重启并且还未完全预热的服务器进行淹没。

答案1

有一个参数可以设置支持它的后端算法的预热过程持续多长时间。

https://www.haproxy.org/download/1.6/doc/configuration.txt

slowstart <start_time_in_ms>
  The "slowstart" parameter for a server accepts a value in milliseconds which
  indicates after how long a server which has just come back up will run at
  full speed. Just as with every other time-based parameter, it can be entered
  in any other explicit unit among { us, ms, s, m, h, d }. The speed grows
  linearly from 0 to 100% during this time. The limitation applies to two
  parameters :

  - maxconn: the number of connections accepted by the server will grow from 1
    to 100% of the usual dynamic limit defined by (minconn,maxconn,fullconn).

  - weight: when the backend uses a dynamic weighted algorithm, the weight
    grows linearly from 1 to 100%. In this case, the weight is updated at every
    health-check. For this reason, it is important that the "inter" parameter
    is smaller than the "slowstart", in order to maximize the number of steps.

  The slowstart never applies when haproxy starts, otherwise it would cause
  trouble to running servers. It only applies when a server has been previously
  seen as failed.

  Supported in default-server: Yes

相关内容