]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: cli: yield between each pipelined command
authorWilly Tarreau <w@1wt.eu>
Wed, 19 Jan 2022 16:11:36 +0000 (17:11 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 19 Jan 2022 18:16:47 +0000 (19:16 +0100)
commitfa7b4f6691646dc6bdebdb0d11c9cdf0382aeccb
treeb33f021f000e53e23bdaf801d993e84bdeb5251e
parent9998a33d3a027ff6863eab71bcc2f2d7158319b4
MEDIUM: cli: yield between each pipelined command

Pipelining commands on the CLI is sometimes needed for batched operations
such as map deletion etc, but it causes two problems:
  - some possibly long-running commands will be run in series without
    yielding, possibly causing extremely long latencies that will affect
    quality of service and even trigger the watchdog, as seen in github
    issue #1515.

  - short commands that end on a buffer size boundary, when not run in
    interactive mode, will often cause the socket to be closed when
    the last command is parsed, because the buffer is empty.

This patch proposes a small change to this: by yielding in the CLI applet
after processing a command when there are data left, we significantly
reduce the latency, since only one command is executed per call, and
we leave an opportunity for the I/O layers to refill the request buffer
with more commands, hence to execute all of them much more often.

With this change there's no more watchdog triggered on long series of
"del map" on large map files, and the operations are much less disturbed.
It would be desirable to backport this patch to stable versions after some
period of observation in recent versions.
src/cli.c