From 385abf10f7b114cda65c35210d1cce886a2c5153 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 10 Feb 2022 19:45:30 +0900 Subject: [PATCH] nghttpx: Add support QUIC BBR2 --- src/shrpx.cc | 9 ++++++--- src/shrpx_config.cc | 4 +++- src/shrpx_http3_upstream.cc | 6 +++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/shrpx.cc b/src/shrpx.cc index f81add5d..9bdcb34c 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -3369,12 +3369,15 @@ HTTP/3 and QUIC: NEW_TOKEN frame in the previous connection. --frontend-quic-congestion-controller= Specify a congestion controller algorithm for a frontend - QUIC connection. should be either "cubic" or - "bbr". + QUIC connection. should be one of "cubic", "bbr", + and "bbr2". Default: )" << (config->quic.upstream.congestion_controller == NGTCP2_CC_ALGO_CUBIC ? "cubic" - : "bbr") + : (config->quic.upstream.congestion_controller == + NGTCP2_CC_ALGO_BBR + ? "bbr" + : "bbr2")) << R"( --frontend-quic-secret-file= Path to file that contains secure random data to be used diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index e158ba6d..19c34180 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -4111,8 +4111,10 @@ int parse_config(Config *config, int optid, const StringRef &opt, config->quic.upstream.congestion_controller = NGTCP2_CC_ALGO_CUBIC; } else if (util::strieq_l("bbr", optarg)) { config->quic.upstream.congestion_controller = NGTCP2_CC_ALGO_BBR; + } else if (util::strieq_l("bbr2", optarg)) { + config->quic.upstream.congestion_controller = NGTCP2_CC_ALGO_BBR2; } else { - LOG(ERROR) << opt << ": must be either cubic or bbr"; + LOG(ERROR) << opt << ": must be one of cubic, bbr, and bbr2"; return -1; } #endif // ENABLE_HTTP3 diff --git a/src/shrpx_http3_upstream.cc b/src/shrpx_http3_upstream.cc index 4551dfed..12299360 100644 --- a/src/shrpx_http3_upstream.cc +++ b/src/shrpx_http3_upstream.cc @@ -745,7 +745,11 @@ int Http3Upstream::write_streams() { auto config = get_config(); auto &quicconf = config->quic; - if (quicconf.upstream.congestion_controller != NGTCP2_CC_ALGO_BBR) { + switch (quicconf.upstream.congestion_controller) { + case NGTCP2_CC_ALGO_BBR: + case NGTCP2_CC_ALGO_BBR2: + break; + default: max_pktcnt = std::min(max_pktcnt, static_cast(10)); }