2013-10-09 3 views
3

우리는 고객으로부터 오는 요청에 대한 haproxy에 대한 최선의 조정 옵션을 찾으려고 노력하고 있습니다 (사용자는 웹 유형의 거래를 탐색하지 않습니다).성능 향상을위한 하프 록 튜닝?

서버에 대한 5 건의 호출, 1 건의 사용자 등록 및 몇 건의 업데이트 호출로 구성된 30k 스레드로 jmeter 테스트를 실행합니다. 이것들은 파이프 라인을 통해 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 라인에서 얻는 최대 conn을 얻으시겠습니까?

아무튼이 작업을 수행하면 누구나 몇 가지 팁이나 조언을 제공 할 수 있습니다.

답변

3

글쎄, 첫 번째 것은 haproxy의 여러 프로세스를 실행해야하는 것처럼 보이지 않는다는 것입니다. 전형적으로 당신은 그것을하고 싶지 않을 것입니다, 특히 당신이 바쁜 테스트와 maxconn을보기 위해 노력하고 있기 때문에. 단일 코어에서 haproxy는 여러분이 가지고있는 maxconn 설정을 능가 할 수 있습니다.

나는 Snapt의 sysctl 's를 거쳤으며, 당신은 대부분을 가지고있다;

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

, leastconn 내가 라운드 로빈을 제안 가치가 될 수 없습니다 - 나는 이러한 추가하는 것났습니다. 많은 소규모 요청으로 구성된 HTTP 트래픽을 수행하고 있기 때문에 (솔직히 말해서 달라집니다). 그런 사소한 일이 있습니다.