Haproxy调整性能?

时间:2013-10-09 20:54:07

标签: performance centos haproxy

我们正在努力为haproxy找到来自客户端的get和post请求的最佳调优选项(不是用户浏览网络类型的交易)。

使用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上的sysctl

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
任何人都会指出他们可以从头顶看到的任何明显问题。不幸的是,我没有haproxy的专业知识,所以寻求社区的帮助。

我还需要弄清楚的是如何找到盒子可以处理的最大连接,它在1 gig网络上,所有后端也在一个演出中。这是haproxy管理员http://grab.by/r12c的屏幕截图,请注意我们运行它有多个核心,所以这是一个核心的快照..因为我可以告诉网络管理员不能显示所有内容..任何想法如何获得haproxy从cmd线获得的最大conn?

无论如何只是努力工作,并希望任何人都可以给出一些提示或指示。

1 个答案:

答案 0 :(得分:3)

首先,你似乎不应该运行多个haproxy进程。通常你不会这样做,特别是因为你正忙着测试并试图看到maxconn的。在单核上haproxy可以超越你所拥有的maxconn设置。

我经历了Snapt的系统,你拥有大部分的;我注意到它也添加了这些 -

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

另外,minimalconn不值得我建议roundrobin。因为您正在进行HTTP流量,其中包含许多小请求(我猜这本身就是诚实的)。这些都是很小的事情。

相关问题