haproxy 超時機制
阿新 • • 發佈:2018-12-19
<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 30stimeout 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 30sApr 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 500sApr 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"修改超時時間後只發一次