From 8945bb6c05e83e008f05cf70a9f740a8bb26d7e5 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 19 Jun 2020 17:07:06 +0200 Subject: [PATCH] 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. --- src/stream_interface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stream_interface.c b/src/stream_interface.c index 59cce13ac1..8b84703406 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -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; -- 2.39.5