BUG/MEDIUM: stream-int: fix loss of CO_SFL_MSG_MORE flag in forwarding

In 2.2-dev1, a change was made by commit 46230363a ("MINOR: mux-h1: Inherit
send flags from the upper layer"). The purpose was to accurately set the
CO_SFL_MSG_MORE flag on the transport layer because previously it as only
set based on the buffer full condition, which does not accurately indicate
that there are more data to follow.

The problem is that the stream-interface never sets this flag anymore in
HTX mode due to the channel's to_forward always being set to infinity.
Because of this, HTX transfers are always performed without the MSG_MORE
flag and experience a severe performance degradation on large transfers.

This patch addresses this by making the stream-interface aware of HTX and
having it check for CF_EOI to check if more contents are expected or not.
With this change, the single-threaded forwarding performance on 10 MB
objects jumped from 29 to 40 Gbps.

No backport is needed.
This commit is contained in:
Willy Tarreau 2020-06-19 17:07:06 +02:00
parent d1d005d7f6
commit 8945bb6c05

View File

@ -697,7 +697,8 @@ int si_cs_send(struct conn_stream *cs)
if ((!(oc->flags & (CF_NEVER_WAIT|CF_SEND_DONTWAIT)) &&
((oc->to_forward && oc->to_forward != CHN_INFINITE_FORWARD) ||
(oc->flags & CF_EXPECT_MORE))) ||
(oc->flags & CF_EXPECT_MORE) ||
(IS_HTX_STRM(si_strm(si)) && !(oc->flags & CF_EOI)))) ||
((oc->flags & CF_ISRESP) &&
((oc->flags & (CF_AUTO_CLOSE|CF_SHUTW_NOW)) == (CF_AUTO_CLOSE|CF_SHUTW_NOW))))
send_flag |= CO_SFL_MSG_MORE;