【问题标题】:HAproxy with tomcat - not enough connections带有tomcat的HAproxy - 没有足够的连接
【发布时间】:2014-05-10 20:46:55
【问题描述】:

我们有一个在 tomcat 7 上运行的 Web 应用程序,我们也有 haproxy 来对所有请求进行负载平衡。 我们进行了一些负载测试,并使用模仿真实用户的 httprequest 对 haproxy(服务器)进行了测试。

当我们尝试将同时用户数增加到 200 时,一些请求会收到一个

503 Service Unavailable

我们尝试将我在 tomcat 上的最大连接数设置为 1000

当我们进入管理器应用程序以在负载测试时实时查看服务器状态时,我看到以下行:

Max threads: 1000 Current thread count: 60 Current thread busy: 35

由于某种原因当前线程不超过60,当前线程busy不超过35!

当我们删除 haproxy 并直接调用 tomcat - 它可以工作!!!(意味着不再出现错误 503 并且繁忙的线程 # 根据负载上升) .

那当然意味着我们的haproxy配置不对。

这里是:

global
    daemon
    maxconn 2000
 debug

defaults
    mode http
    timeout connect 5000ms
    timeout client 120000ms
    timeout server 120000ms


listen X-TEST 0.0.0.0:8188   
mode http
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
stats auth xxx:xxx
stats refresh 5s
option httpclose
option forwardfor
balance roundrobin


cookie JSESSIONID prefix
server x_SERVER1 10.0.110.44:8080 cookie JSESSIONID_SERVER_1 check    
server x_SERVER2 10.0.110.45:8080 cookie JSESSIONID_SERVER_2 check

【问题讨论】:

    标签: java spring tomcat load haproxy


    【解决方案1】:

    好的,我们重新配置了 HAproxy,它现在可以工作了, 这是新的配置文件:

    global
    debug
    
    defaults
    mode http
    timeout connect 5s
    timeout queue   300s
    timeout client  300s
    timeout server  300s
    
    
    frontend http-in
    bind *:8080
    default_backend xx
    
    backend xx
    cookie JSESSIONID prefix
    server xx_SERVER1 10.0.110.44:8080 cookie JSESSIONID_SERVER_1 check maxconn 500
    server xx_SERVER2 10.0.110.45:8080 cookie JSESSIONID_SERVER_2 check maxconn 500
    option httpclose
    option forwardfor
    balance roundrobin
    option redispatch
    retries 15
    
    
    listen admin
    bind *:8081
    stats enable
    stats refresh 1s
    

    【讨论】:

      猜你喜欢
      • 2013-03-22
      • 2013-01-14
      • 2011-02-09
      • 2016-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-13
      • 1970-01-01
      相关资源
      最近更新 更多