2012-08-08 17 views
2

我有2個後端HAProxy的設置:BE1和BE2HAProxy的2個後端 - 當1個後端隊列,其他的也受影響

我基於路徑上使用ACL來路由。

當be2開始開發一個隊列時,對be1的請求會受到負面影響 - 通常需要100ms的時間需要2-3秒(就像請求將要發生的情況一樣)。

有沒有辦法讓be2排隊而不影響be1的性能?

在高峯期,我的服務時間約爲2000次/秒。

global 
    log 127.0.0.1 local0 
    log 127.0.0.1 local1 notice 
    #log loghost local0 info 
    maxconn 2000 
    #chroot /usr/share/haproxy 
    user haproxy 
    group haproxy 
    daemon 
    #debug 
    #quiet 
    ulimit-n 65535 
    stats socket /var/run/haproxy.sock 
    nopoll 

defaults 
    log global 
    mode http 
    option httplog 
    option dontlognull 
    retries 3 
    option redispatch 
    maxconn 2000 
    contimeout 5000 
    clitimeout 50000 
    srvtimeout 50000 

frontend http_in *:80 
    option httpclose 
    option forwardfor 
    acl vt path_beg /route/1 
    use_backend be2 if vt 
    default_backend be1 

backend be1 
    balance leastconn 
    option httpchk HEAD /redirect/are_you_alive HTTP/1.0 
    server 01-2C2P9HI x:80 check inter 3000 rise 2 fall 3 maxconn 500 

backend be2 
    balance leastconn 
    option httpchk HEAD /redirect/are_you_alive HTTP/1.0 
    server 01-3TPDP27 x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-3CR0FKC x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-3E9CVMP x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-211LQMA x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-3H974V3 x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-13UCFVO x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-0HPIGGT x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-2LFP88F x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-1TIQBDH x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-2GG2LBB x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-1H5231E x:80 check inter 3000 rise 2 fall 3 maxconn 250 
    server 01-0KIOVID x:80 check inter 3000 rise 2 fall 3 maxconn 250 

listen stats 0.0.0.0:7474  #Listen on all IP's on port 9000 
    mode http 
    balance 
    timeout client 5000 
    timeout connect 4000 
    timeout server 30000 
    #This is the virtual URL to access the stats page 
    stats uri /haproxy_stats   
    #Authentication realm. This can be set to anything. Escape space characters with a backslash. 
    stats realm HAProxy\ Statistics 
    #The user/pass you want to use. Change this password! 
    stats auth ge:test123 
    #This allows you to take down and bring up back end servers. 
    #This will produce an error on older versions of HAProxy. 
    stats admin if TRUE 

不知道我昨天沒有注意到這一點,但看到maxconn設置爲2000 ...所以這可能是我的問題之一?

回答

1

有兩種不同的maxconn設置。一個用於前端,另一個用於後端。前端的設置限制了傳入連接,所以即使後端可用,它也不會在前端進行排隊時收到請求。一旦請求經過前端,後端隊列就會發生。前端受到「缺省」部分中maxconn設置的影響,所以我會將其增加到4000,例如後端應該能夠處理它。

請注意,maxconn不會限制每秒請求數,而是同時連接數。您可能有一些HTTP保持活動請求處於活動狀態,可能會限制可用吞吐量。