nbanik
1
Use haproxy version is 2.3.1-bdd7178
Here is my config:
global
log /dev/log local0
log localhost local1 notice
maxconn 2000
daemon
defaults
log global
mode http
option httplog
option dontlognull
retries 3
timeout connect 5000
timeout client 50000
timeout server 50000
http-reuse always
timeout http-keep-alive 4500
frontend http-in
bind *:80
mode http
default_backend webservers
backend webservers
stats enable
stats auth admin:admin
stats uri /haproxy?stats
balance roundrobin
option forwardfor
option http-server-close
option http-keep-alive
http-reuse always
timeout http-keep-alive 4500
server apache1 {APACHE_1_IP}:{APACHE_EXPOSED_PORT} check
server apache2 {APACHE_2_IP}:{APACHE_EXPOSED_PORT} check
I want to see http request on same tcp connections. But observed every time new tcp connection is created. Did i miss any thing? Please help me…
First of all you need to remove:
option http-server-close
--> this disables keep-alives
Then you should add option prefer-last-server
, so that a client sticks to a backend session.
nbanik
3
Thanks lukastribus.
I tried with below config:
defaults
log global
mode http
option httplog
option dontlognull
retries 3
timeout connect 5000
timeout client 50000
timeout server 50000
http-reuse always
timeout http-keep-alive 4500
frontend http-in
bind *:80
mode http
default_backend webservers
backend webservers
stats enable
stats auth admin:admin
stats uri /haproxy?stats
balance roundrobin
option forwardfor
#option http-server-close
option http-keep-alive
option prefer-last-server
http-reuse always
timeout http-keep-alive 4500
server apache1 {APACHE_1_IP}:{APACHE_EXPOSED_PORT} check
server apache2 {APACHE_2_IP}:{APACHE_EXPOSED_PORT} check
Result is same. Observed new tcp stream for every http request.
I generate request with below commands:
ab -n 1000 -c 30 http://192.168.1.2/
However, If generate request with keep alive request like below:
ab -k -n 1000 -c 30 http://192.168.1.2/
see many http request with with one tcp stream.