<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" 修改超時時間后只發一次