[nginx] QUIC: optimized ACK delay.

Roman Arutyunyan arut at nginx.com
Mon Aug 14 14:01:02 UTC 2023


details:   https://hg.nginx.org/nginx/rev/a90f79792b5d
branches:  
changeset: 9138:a90f79792b5d
user:      Roman Arutyunyan <arut at nginx.com>
date:      Thu Jul 27 16:37:17 2023 +0400
description:
QUIC: optimized ACK delay.

Previously ACK was not generated if max_ack_delay was not yet expired and the
number of unacknowledged ack-eliciting packets was less than two, as allowed by
RFC 9000 13.2.1-13.2.2.  However this only makes sense to avoid sending ACK-only
packets, as explained by the RFC:

  On the other hand, reducing the frequency of packets that carry only
  acknowledgments reduces packet transmission and processing cost at both
  endpoints.

Now ACK is delayed only if output frame queue is empty.  Otherwise ACK is sent
immediately, which significantly improves QUIC performance with certain tests.

diffstat:

 src/event/quic/ngx_event_quic_ack.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r 0ba26c99b3a1 -r a90f79792b5d src/event/quic/ngx_event_quic_ack.c
--- a/src/event/quic/ngx_event_quic_ack.c	Wed Jun 21 01:29:53 2023 +0300
+++ b/src/event/quic/ngx_event_quic_ack.c	Thu Jul 27 16:37:17 2023 +0400
@@ -1171,7 +1171,8 @@ ngx_quic_generate_ack(ngx_connection_t *
         delay = ngx_current_msec - ctx->ack_delay_start;
         qc = ngx_quic_get_connection(c);
 
-        if (ctx->send_ack < NGX_QUIC_MAX_ACK_GAP
+        if (ngx_queue_empty(&ctx->frames)
+            && ctx->send_ack < NGX_QUIC_MAX_ACK_GAP
             && delay < qc->tp.max_ack_delay)
         {
             if (!qc->push.timer_set && !qc->closing) {


More information about the nginx-devel mailing list