CloudFoundry 中的GoRouter效能測試

來源:互聯網
上載者:User

標籤:style   class   http   com   使用   檔案   

      之前一直感覺CloudFoundry的GoRouter的效能不靠譜,或者我們的CloudFoundry 部署架構存在問題,想著進行一些壓力測試,但是一直苦於沒有壓力測試的工具。上一周,部門需要出一個測試報告,剛好藉此機會。進行一個比較好的測試。

      測試的時候,是使用的兩個gorouter+nginx,測試使用的應用是一個比較簡單的應用,使用LoadRunner進行壓力測試,使用LoadRunner的1000個使用者進行,測試效果非常差。和QQ群裡的同學交流,他們也出現了類似的問題,使用F5或者HaProxy 都很正常,但是使用nginx 出現很多問題,表現出來的效能非常差。所以也嘗試改用haproxy做負載平衡。

    haproxy的部署方式就不描述了,使用haproxy的預設配置,效能也是很差,開始進行調優。一開始以為是應用、gorouter的問題,但是定位了很久,發現這些目前看來都沒有什麼問題。最後,對haproxy的設定檔進行了最佳化,目前我的haproxy設定檔:

      global
    log 127.0.0.1   syslog info
    daemon
    maxconn 300000
    spread-checks 4
    nbproc 8

defaults
    log global
    timeout connect 30000ms
    timeout client 300000ms
    timeout server 300000ms
    # maxconn 320000
   # option http-pretend-keepalive
    option dontlognull
    option forwardfor
    option redispatch
    option abortonclose
listen admin_stats
       bind 0.0.0.0:1080   
        mode http            
        option httplog
        maxconn 10
        stats refresh 30s
        stats uri /stats
        stats realm XingCloud\ Haproxy
        stats auth admin:admin        
        stats hide-version             
frontend http-in
    mode tcp
    bind *:80
    reqadd X-Forwarded-Proto:\ http
    default_backend tcp-routers

backend tcp-routers
    mode tcp
    balance source
         server node1 10.106.1.46:80  weight 10  inter 2000 rise 2 fall 5 maxconn 10000
        server node2 10.106.1.57:80  weight 10 inter 2000 rise 2 fall 5 maxconn 10000

還需要修改 作業系統的配置 /etc/sysctl.conf

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096        87380   4194304
net.ipv4.tcp_wmem = 4096        16384   4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024    65000
net.nf_conntrack_max = 1024000

    修改該設定檔,主要是為了增加機器可以開啟的TCP串連數,還需要設定ulimit,設定的應該比較大一些。我使用的作業系統是Ubuntu10.04 ,需要載入模組 modprobe ip_conntrack

最終的測試結果:

 

 

之前使用nginx的時候,才300TPS。。。哎。。現在終於好多了。目前使用的機器都是虛擬機器(4core /10G/ )如果使用更好的機器,不知道結果會不會好一些。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.