haproxy的timout参数

简介:

第一个参数:timeout queue <timeout>

  Set the maximum time to wait in the queue for a connection slot to be free

 设置一个连接位置在一个队列中等待被释放的最大时间。

  When a server's maxconn is reached, connections are left pending in a queue

  which may be server-specific or global to the backend. In order not to wait

  indefinitely, a timeout is applied to requests pending in the queue. If the

  timeout is reached, it is considered that the request will almost never be

  served, so it is dropped and a 503 error is returned to the client.

当一个服务器的最大连接到达时,连接会被放在队列中,它可能是具体的服务器或者全局对于后台。为了不无限期的等待,在一个队列中超时会被用到请求挂起。如果达到超时,被认为请求几乎不被服务,因此请求会被丢掉并且返回503到客户端。

  The "timeout queue" statement allows to fix the maximum time for a request to

  be left pending in a queue. If unspecified, the same value as the backend's

  connection timeout ("timeout connect") is used, for backwards compatibility

  with older versions with no "timeout queue" parameter.

"timeout queue"这个语句允许固定请求在队列中挂起的最大时间。如果是没有指定,那么和后台连接超时"timeout connect"的值相同。


第二个参数:

timeout server <timeout>

  Set the maximum inactivity time on the server side.

设置在服务器一侧的最大非活动时间。


  The inactivity timeout applies when the server is expected to acknowledge or

  send data. In HTTP mode, this timeout is particularly important to consider

  during the first phase of the server's response, when it has to send the

  headers, as it directly represents the server's processing time for the

  request. To find out what value to put there, it's often good to start with

  what would be considered as unacceptable response times, then check the logs

  to observe the response time distribution, and adjust the value accordingly.

当服务器希望接收或者发送数据的时候,非活动超时会被应用。

它直接代表服务器的处理请求时间。

为了弄清楚应该放什么值,最好是从不可接受的响应时间着手,并相应的调整该值。


 In TCP mode (and to a lesser extent更小来说, in HTTP mode), it is highly

  recommended that the client timeout remains equal to the server timeout in

  order to avoid complex situations to debug. Whatever the expected server

  response times, it is a good practice to cover at least one or several TCP

  packet losses by specifying timeouts that are slightly above multiples of 3

  seconds (eg: 4 or 5 seconds minimum). If some long-lived sessions are mixed

  with short-lived sessions (eg: WebSocket and HTTP), it's worth considering

  "timeout tunnel", which overrides "timeout client" and "timeout server" for

  tunnels.通过制定超时略微高于3秒的倍数(最小是4秒或者5秒)来解决至少一个或者多个tcp包的丢失。

如果是一些长会话混合了一些短会话,最好考虑"timeout tunnel"。


  This parameter is specific to backends, but can be specified once for all in

  "defaults" sections. 可以在“defaults”区域一次性指定。

This is in fact one of the easiest solutions not to

  forget about it. An unspecified timeout results in an infinite timeout, which

  is not recommended. Such a usage is accepted and works but reports a warning

  during startup because it may results in accumulation of expired sessions in

  the system if the system's timeouts are not configured either.


  This parameter replaces the old, deprecated "srvtimeout". It is recommended

  to use it to write new configurations. The form "timeout srvtimeout" is

  provided only by backwards compatibility but its use is strongly discouraged.



第三个参数:

timeout client <timeout>

timeout clitimeout <timeout> (deprecated)

  Set the maximum inactivity time on the client side.

 设置客户端侧的最大非活动时间。


  The inactivity timeout applies when the client is expected to acknowledge or

  send data. In HTTP mode, this timeout is particularly important to consider

  during the first phase, when the client sends the request, and during the

  response while it is reading data sent by the server. That said, for the

  first phase, it is preferable to set the "timeout http-request" to better

  protect HAProxy from Slowloris like attacks. 

It is a good practice to cover one or several TCP packet

  losses by specifying timeouts that are slightly above multiples of 3 seconds

  (eg: 4 or 5 seconds). If some long-lived sessions are mixed with short-lived

  sessions (eg: WebSocket and HTTP), it's worth considering "timeout tunnel",

  which overrides "timeout client" and "timeout server" for tunnels, as well as

  "timeout client-fin" for half-closed connections.


  This parameter is specific to frontends, but can be specified once for all in

  "defaults" sections. This is in fact one of the easiest solutions not to

  forget about it. An unspecified timeout results in an infinite timeout, which

  is not recommended. Such a usage is accepted and works but reports a warning

  during startup because it may results in accumulation of expired sessions in

  the system if the system's timeouts are not configured either.

















本文转自chenzudao51CTO博客,原文链接:http://blog.51cto.com/victor2016/1906570 ,如需转载请自行联系原作者


相关文章
|
Java 数据库连接 Spring
“探索Spring与MyBatis集成的最佳实践与技巧“(上)
“探索Spring与MyBatis集成的最佳实践与技巧“
392 0
|
Kubernetes Linux Docker
kubelet 压力驱逐 - The node had condition:[DiskPressure]
kubelet 压力驱逐 - The node had condition:[DiskPressure]
1786 0
|
缓存 Linux 开发工具
CentOS 7- 配置阿里镜像源
阿里镜像官方地址http://mirrors.aliyun.com/ 1、点击官方提供的相应系统的帮助 :2、查看不同版本的系统操作: 下载源1、安装wget yum install -y wget2、下载CentOS 7的repo文件wget -O /etc/yum.
261278 0
|
Ubuntu 开发工具 Python
Ubuntu apt-get和pip国内源更换
Ubuntu apt-get和pip源更换 更新数据源为国内,是为了加速安装包的增加速度。 更换apt-get数据源 输入:sudo -s切换为root超级管理员; 执行命令:vim /etc/apt/sources.
13694 0
|
Java Linux
手把手教你Linux系统下的Java环境配置,简单到不行!
手把手教你Linux系统下的Java环境配置,简单到不行!
664 1
|
存储 前端开发 物联网
在魔搭使用ComfyUI,玩转AIGC
ComfyUI是一个功能强大、模块化程度高的AIGC图形和视频生成的用户界面和后台。
|
开发者
找到一个软件著作权源代码材料格式文档生成辅助工具(完全私密,没有代码泄露风险)
截至2023年5月,一款工具已获一万次下载,用户反馈良好。该工具帮助开发者轻松整理软著申请所需的60页源代码,支持多种编程语言,自动处理页眉、页码和格式,减少因格式问题导致的补正。提供《文档鉴别材料》模板和简单两步操作的源代码文档生成器,加快软著注册流程。下载链接包括百度网盘和阿里云盘。
找到一个软件著作权源代码材料格式文档生成辅助工具(完全私密,没有代码泄露风险)
|
编解码 计算机视觉 Windows
会声会影最新版2023新增功能及配置要求
可能大家已经看到网络上关于会声会影2023新版的一些消息,甚至还有人放出了安装包,这里提醒一下各位粉丝不要心急,今天coco玛奇朵在这里分享2023新版公布信息及下载。会声会影2023中文版功能非常强大的视频编辑软件,非常专业的使用效果,会声会影2023中文版可以针对剪辑电影进行使用,非常强大的色彩校正方式,无论什么光线下进行拍摄,都可以通过后期进行调整,并且里面超多不同的专场设置,能够让你的视频变得更加自然,不会出现非常生硬的专场,强大的编辑器可以下载免费使用。
649 0
|
SQL XML 关系型数据库
MyBatis-14MyBatis动态SQL之【foreach】
MyBatis-14MyBatis动态SQL之【foreach】
365 0
|
供应链
MECE 法则在职场中的常见用法
MECE法则,是麦肯锡咨询顾问芭芭拉·明托在《金字塔原理》中提出的一个思考工具,它的英文缩写是Mutually Exclusive Collectively Exhaustive,意思是“相互独立,完全穷尽”,也就是不重不漏的意思。
706 0
MECE 法则在职场中的常见用法