2013-10-09 55 views
3

我們正在嘗試爲來自客戶端的獲取和發佈請求(而不是用戶瀏覽網絡類型的交易)找到haproxy的最佳調整選項。Haproxy調整性能?

使用30k線程運行jmeter測試,其中包含對服務器的5個調用,1個用戶註冊表和一些更新調用。這些通過管道推送json數據。

這裏我們我們目前配置的HAProxy的

global 
     log /dev/log local0 #notice 
     maxconn 14000 
     tune.bufsize 128000 
     user netcom 
     group netcom 
     pidfile /tmp/haproxy.pid 
     daemon 
     nbproc 7 
     #debug 
     #quiet 

defaults 
     log global 
     mode http 
     ### Options ### 
     option httplog 
     #option logasap 
     option dontlog-normal 
     #option dontlognull 
     option redispatch 
     option httpchk GET /?method=echo HTTP/1.1 
     option tcp-smart-accept 
     option tcp-smart-connect 
     option http-server-close 
     #option httpclose 
     #option forceclose 
     ### load balance strategy ### 
     balance leastconn 
     #balance roundrobin 
     ### Other ### 
     retries 5 
     maxconn 14000 
     backlog 100000 
     ### Timeouts ### 
     #timeout client   25s 
     timeout client   60s 
     #timeout connect   5s 
     timeout connect   60s 
     #timeout server   25s 
     timeout server   60s 
     timeout tunnel  3600s 
     timeout http-keep-alive 1s 
     #timeout http-request 15s 
     timeout http-request 60s 
     #timeout queue   30s 
     timeout queue   30s 
     timeout tarpit   60s 

listen stats *:1212 
     stats enable 
     stats show-node 
     stats show-desc xxxxProxy 
     stats realm xxxxProxy\ Statistics 
     stats auth xxxx:xxxx 
     stats refresh 5s 
     stats uri/

frontend http-in 
     bind *:1111 
     bind *:2222 ssl crt /home/netcom/nas/haproxy/xxxx.co.pem verify optional 
     acl user_request url_reg method=user.register 
     use_backend user_group if user_request 
     default_backend other_group 

backend user_group 
     server n15 xxxx:8080 maxconn 3500 check port 8097 inter 2000 
     server n2 xxxx:8080 maxconn 3500 check port 8097 inter 2000 
     server n9 xxxx:8080 maxconn 3500 check port 8097 inter 2000 
     server n14 xxxx:8080 maxconn 3500 check port 8097 inter 2000 
     server n22 xxxx:8080 maxconn 3500 check port 8097 inter 2000 
     server n24 xxxx:8080 maxconn 3500 check port 8097 inter 2000 
     server n25 xxxx:8080 maxconn 3500 check port 8097 inter 2000 

和我們在CentOS 6

net.ipv4.tcp_syncookies = 1 
net.ipv4.tcp_synack_retries = 2 
net.ipv4.ip_local_port_range = 1024 65535 
net.ipv4.tcp_tw_recycle = 1 
net.core.wmem_max = 12582912 
net.core.rmem_max = 12582912 
net.ipv4.tcp_rmem = 20480 174760 25165824 
net.ipv4.tcp_wmem = 20480 174760 25165824 
net.ipv4.tcp_window_scaling = 1 
net.ipv4.tcp_timestamps = 1 
net.ipv4.tcp_sack = 1 
net.ipv4.tcp_no_metrics_save = 1 
net.core.netdev_max_backlog = 10000 
# Syn flood 
net.ipv4.tcp_max_syn_backlog = 8096 
net.core.somaxconn = 8096 

sysctl的人指出任何高音的問題,他們可以看到了你的頭頂。不幸的是,我沒有haproxy的專業知識,所以尋求社區的幫助。

我還需要弄清楚的是如何找到盒子可以處理的最大連接數,它在1個演出網絡上,所有後端都在一個演出中。這裏是haproxy admin http://grab.by/r12c的屏幕截圖,注意我們使用多個核心運行它,所以這是一個核心的快照..因爲網絡管理員,據我可以告訴不能顯示一切..任何想法如何獲取haproxy從cmd行獲取的最大連接數?

無論如何只是工作,並希望任何人都可以提供一些提示或指針。

回答

3

那麼首先,它似乎並不像你應該運行haproxy的多個進程。通常情況下你不會這麼做,尤其是因爲你正在測試並試圖查看maxconn的。在一個單一的核心haproxy可以勝過maxconn設置,無論如何。

我經歷了Snapt的sysctl,你有大部分的;我注意到它也加入了這些 -

net.ipv4.tcp_tw_reuse = 1 
    net.ipv4.tcp_fin_timeout = 30 

此外,leastconn不會是值得的我會建議roundrobin。因爲你正在做HTTP流量,其中包含很多小的請求(我認爲這要看老實說)。儘管如此,這些都是小事。