Question

We have a web application that runs on a tomcat 7 , we have haproxy as well to load balance all requests. we did some load testing and raining the haproxy (server) with httprequests that imitate real users.

When we tried to increase the number of simultanious users to 200 some of the requests recieve a

503 Service Unavailable

We tried to set my max connection on the tomcat to 1000

when we enter the manager app to see the server status on real time while load testing i see the following line:

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

The current thread is not exceeding 60 for some reason and the current thread busy is not exceeding 35!

When we removed the haproxy and calls directly the tomcat - it works!!! (meanning no more error 503 and the busy threads # rises according the the load).

that of course means that our haproxy configuration is not right.

here it is:

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
Was it helpful?

Solution

OK, we re configured HAproxy and it now works, here is the new config file:

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top