]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stream-int: make si_connect() return an established state when possible
authorWilly Tarreau <w@1wt.eu>
Tue, 31 Dec 2013 22:32:12 +0000 (23:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Dec 2013 22:32:12 +0000 (23:32 +0100)
commit9e5a3aacf42204cc55ac819f127c37a56fba132d
treeae108f792a5071a101f053eb5cfce0b71183e088
parentb44c873d61138c70cede03dbee2170b4c45e7511
MEDIUM: stream-int: make si_connect() return an established state when possible

si_connect() used to only return SI_ST_CON. But it already detect the
connection reuse and is the function which avoids calling connect().
So it already knows the connection is valid and reuse. Thus we make it
return SI_ST_EST when a connection is reused. This means that
connect_server() can return this state and sess_update_stream_int()
as well.

Thanks to this change, we don't need to leave process_session() in
SI_ST_CON state to immediately enter it again to switch to SI_ST_EST.
Implementing this removes one call to process_session() per request
in keep-alive mode. We're now at 2 calls per request, which is the
minimum (one for the request and another one for the response). The
number of calls to http_wait_for_response() has also dropped from 2
to one.

Tests indicate a performance gain of about 2.6% in request rate in
keep-alive mode. There should be no gain in http-server-close() since
we don't use this faster path.
include/proto/stream_interface.h
src/session.c