haproxy 超时机制

 

<pre name="code" class="python">option  redispatch  option redispatch   是否允许重新分配在session 失败后  
      
option abortonclose 丢弃由于客户端等待时间过长而关闭连接但仍在haproxy等待队列中的请求  
  
  
    option abortonclose  
  
    #当服务器负载很高的时候,自动结束掉当前队列处理比较久的链接    
  
defaults  
        log     global  
        mode    http  
        option  httplog  
        option  dontlognull  
        retries 3  
        option  redispatch  
        option  abortonclose  
        maxconn 65535  
        timeout connect 5000  
        timeout client  50000  
        timeout server 50000  
  
        timeout check   5s  
        stats   refresh 30s  
  
  
timeout http request :在客户端建立连接但不请求数据时,关闭客户端连接  
timeout queue :等待最大时长  
timeout connect: 定义haproxy将客户端请求转发至后端服务器所等待的超时时长  
timeout client:客户端非活动状态的超时时长  
timeout server:客户端与服务器端建立连接后,等待服务器端的超时时长,  
timeout http-keep-alive :定义保持连接的超时时长  
timeout check:健康状态监测时的超时时间,过短会误判,过长资源消耗  
  
  
  
client_timeout 是 app 连接 haproxy的时间  
server_timeout 是haproxy 连接后端的时间.  
  
目前发现 超时后,前台一个点击 haproxy 会收到两个相同的请求,原因待查明。  
  
  
  
  
  
  
设置 5秒超时时:  
     timeout connect 5000  
        timeout client  50000  
        timeout server 50000  
  
        timeout check   5s  
        stats   refresh 30s  
  
  
  
  
  
  
  
Apr 13 17:29:23 localhost haproxy[31428]: 192.168.33.29:53793 [13/Apr/2016:17:29:20.210] www zlserver_8081/zlhost01_8081 0/0/0/2975/2975 200 325 - - ---- 7/7/0/1/0 0/0 "POST /web/fileUpload   
  
HTTP/1.1"  
  
  
  
  
  
  
  
  
  
Apr 13 17:30:17 localhost haproxy[31428]: 192.168.33.29:53793 [13/Apr/2016:17:29:23.185] www zlserver_8081/zlhost01_8081 3965/0/0/-1/53966 -1 0 - - cD-- 9/9/0/0/0 0/0 "GET /web/adminauth?  
  
fileNames=201604131728504d4a55c40faf4717b428ea0cd04eeebb.txt&method=%2Fwze%2Fsettlement%2Fsubmit HTTP/1.1"  
  
  
  
  
  
  
  
  
  
Apr 13 17:31:07 localhost haproxy[31428]: 192.168.33.29:53822 [13/Apr/2016:17:30:17.153] www zlserver_8081/zlhost01_8081 0/0/1/-1/50002 504 194 - - sH-- 3/3/0/0/0 0/0 "GET /web/adminauth?  
  
fileNames=201604131728504d4a55c40faf4717b428ea0cd04eeebb.txt&method=%2Fwze%2Fsettlement%2Fsubmit HTTP/1.1"  
  
  
相同请求发了2次  
  
设置  
  
        timeout connect 500000  
        timeout client  500000  
        timeout server 500000  
  
        timeout check   500s  
  
Apr 13 17:34:50 localhost haproxy[31579]: 192.168.33.29:53958 [13/Apr/2016:17:34:46.969] www zlserver_8081/zlhost01_8081 0/0/1/3100/3101 200 325 - - ---- 8/8/0/1/0 0/0 "POST /web/fileUpload   
  
HTTP/1.1"  
  
  
  
  
  
  
  
Apr 13 17:35:01 localhost haproxy[30096]: 192.168.33.29:53932 [13/Apr/2016:17:34:09.780] www zlserver_8081/zlhost01_8081 1581/0/0/-1/51583 -1 0 - - cD-- 8/8/0/0/0 0/0 "GET /web/adminauth?  
  
fileNames=20160413173337310c4e58eb244e6aa4855064ee439f24.txt&method=%2Fwze%2Fsettlement%2Fsubmit HTTP/1.1"  
  
  
修改超时时间后只发一次  

 

posted on 2018-06-12 09:52  林肯公园  阅读(4628)  评论(0编辑  收藏  举报

导航