Hi All, I'm using HAProxy as load balancer for load balancing websites and tomcat servers. I'm currently testing the performance with Apache Benchmark and I get the following result:
$ ab -n 500 -c 100 https://domain.tld/instance/ ... Document Length: 2950 bytes Concurrency Level: 100 Time taken for tests: 18.723 seconds Complete requests: 500 Failed requests: 247 (Connect: 0, Receive: 0, Length: 247, Exceptions: 0) Non-2xx responses: 500 Total transferred: 1709018 bytes HTML transferred: 1473518 bytes Requests per second: 26.70 [#/sec] (mean) Time per request: 3744.689 [ms] (mean) Time per request: 37.447 [ms] (mean, across all concurrent requests) Transfer rate: 89.14 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 483 2564 886.7 2647 5032 Processing: 78 974 711.0 785 3233 Waiting: 36 824 653.3 709 3225 Total: 1190 3537 921.2 3343 6370 Percentage of the requests served within a certain time (ms) 50% 3343 66% 3601 75% 3662 80% 4458 90% 4464 95% 5357 98% 6111 99% 6230 100% 6370 (longest request) As you may see I'm receiving a lot of failed request: Failed requests: 247 (Connect: 0, Receive: 0, Length: 247, Exceptions: 0) Non-2xx responses: 500 These failed requests only appear when having more than 1 tomcat server configured in haproxy.cfg. HAProxy.cfg has the following configuration for the tomcat servers: backend tomcat_servers # Enable HTTP connection closing on the server side option http-server-close # This value will be checked in incoming requests, and the first operational # server possessing the same value will be selected. cookie JSESSIONID prefix # Servers server tomcat1 192.168.1.1:8080 cookie tomcat1 check server tomcat2 192.168.1.2:8080 cookie tomcat2 check I've done some testing and I'm also seeing a big differences in "Requests per second" when running AB via HAProxy (25.58 [#/sec]) or directly to the server (466.68 [#/sec]). The HAProxy uses less than 50 percent CPU when running AB. Hope someone can help me figuring out what is causing this "issue". Thanks! Martin

