Hi Willy, Baptiste, Apologies for the delay in reproducing this issue and in responding.
I am using HAProxy 1.6.2 and am still finding that connection reuse is not happening in my setup. Attaching the configuration file, command line arguments, and the tcpdump (80 packets in all), in case it helps. HAProxy is configured with a single backend. The same client makes two requests, one a telnet with a GET request for a 128 byte file, and the second 'ab -k' command to retrieve the same file. 172.20.97.36: Client 10.34.73.174: HAProxy 10.32.121.94: Server Telnet from client with GET: GET /128 HTTP/1.1 Host: www.example.com User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1) Followed immediately with: ab -k -n 10 -c 1 http://10.34.73.174/1K Packets #1-7: Telnet to haproxy, and a GET request made Packets #8-9: HAProxy opens connection to single backend Packets #10-15: Response from server, relays data back to the client, connection from Client->HAProxy and HAProxy->server is kept open. Packets #16-19 (5 seconds later): Same client, run 'ab -k' Packet #20-72: New connection to same backend, and data transfer. Packet #73: 'ab' closes connection to HAProxy Packet #74: HAProxy closes connection to 'ab'. Packet #75: HAProxy closes connection to backend. Packets #77-81: Telnet closes connection Configuration file: -------------------------- global daemon maxconn 10000 defaults mode http option http-keep-alive balance leastconn option splice-response option clitcpka option srvtcpka option tcp-smart-accept option tcp-smart-connect option contstats timeout http-keep-alive 1800s timeout http-request 1800s timeout connect 60s timeout client 1800s timeout server 1800s frontend private-frontend mode http maxconn 10000 bind 10.34.73.174:80 default_backend private-backend backend private-backend http-reuse always server 10.32.121.94 10.32.121.94:80 maxconn 10000 >From the above, it is seen that HAProxy opens a second connection to the server on same GET request from the client. Can you please take a look and suggest what needs to be done to get reuse working? $ haproxy -vv HA-Proxy version 1.6.2 2015/11/03 Copyright 2000-2015 Willy Tarreau <wi...@haproxy.org> Build options : TARGET = linux2628 CPU = generic CC = gcc CFLAGS = -O3 -g -fno-strict-aliasing -Wdeclaration-after-statement OPTIONS = USE_ZLIB=1 USE_OPENSSL=1 USE_PCRE=1 Default settings : maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200 Encrypted password support via crypt(3): yes Built with zlib version : 1.2.8 Compression algorithms supported : identity("identity"), deflate("deflate"), raw-deflate("deflate"), gzip("gzip") Built with OpenSSL version : OpenSSL 1.0.1f 6 Jan 2014 Running on OpenSSL version : OpenSSL 1.0.1f 6 Jan 2014 OpenSSL library supports TLS extensions : yes OpenSSL library supports SNI : yes OpenSSL library supports prefer-server-ciphers : yes Built with PCRE version : 8.35 2014-04-04 PCRE library supports JIT : no (USE_PCRE_JIT not set) Built without Lua support Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND Available polling systems : epoll : pref=300, test result OK poll : pref=200, test result OK select : pref=150, test result OK Total: 3 (3 usable), will use epoll. Thanks, - Krishna Kumar On Thu, Nov 12, 2015 at 12:50 PM, Willy Tarreau <w...@1wt.eu> wrote: > Hi Krishna, > > On Wed, Nov 11, 2015 at 03:22:54PM +0530, Krishna Kumar (Engineering) > wrote: > > I just tested with 128K byte file (run 4 wgets > > in parallel each retrieving 128K). Here, I see 4 connections being > opened, and > > lots of data packets in the middle, finally followed by 4 connections > > being closed. I > > can test with "ab -k" option to simulate a browser, I guess, will try > that. > > In my tests, ab -k definitely works. > > > > Is wget advertising HTTP/1.1 in the request ? If not that could > > > > Yes, tcpdump shows HTTP/1.1 in the GET request. > > OK. > > > > - proxy protocol used to the server > > > - SNI sent to the server > > > - source IP binding to client's IP address > > > - source IP binding to anything dynamic (eg: header) > > > - 401/407 received on a server connection. > > > > I am not doing any of these specifically. Its a very simple setup where > the > > client@ip1 connects to haproxy@ip2 and requests 128 byte file, which > > is handled by server@ip3. > > OK. I don't see any reason for this not to work then. > > > I was doing this in telnet: > > > > GET /128 HTTP/1.1 > > Host: www.example.com > > User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1) > > Looks fine as well. Very strange. I have no idea what would not at the > moment, I suspect this is something stupid and obvious but am failing > to spot it :-/ > > Willy > >
packets.pcap
Description: application/vnd.tcpdump.pcap