You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/04/02 05:55:31 UTC

[trafficserver] branch quic-latest updated: Make constans of Congestion Control configurable

This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
     new eb6b247  Make constans of Congestion Control configurable
eb6b247 is described below

commit eb6b247130413a91ac816a4fa0b6174953c064b9
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Mon Apr 2 14:52:04 2018 +0900

    Make constans of Congestion Control configurable
    
    Add below configs
    ```
    proxy.config.quic.congestion_control.default_mss
    proxy.config.quic.congestion_control.initial_window_scale
    proxy.config.quic.congestion_control.minimum_window_scale
    proxy.config.quic.congestion_control.loss_reduction_factor
    ```
---
 iocore/net/quic/QUICConfig.cc               | 29 +++++++++++++++++++++++++++++
 iocore/net/quic/QUICConfig.h                | 11 +++++++++++
 iocore/net/quic/QUICCongestionController.cc | 28 +++++++++++++++-------------
 iocore/net/quic/QUICLossDetector.h          |  9 ++++++++-
 mgmt/RecordsConfig.cc                       |  9 +++++++++
 5 files changed, 72 insertions(+), 14 deletions(-)

diff --git a/iocore/net/quic/QUICConfig.cc b/iocore/net/quic/QUICConfig.cc
index 1f3661b..5d5654b 100644
--- a/iocore/net/quic/QUICConfig.cc
+++ b/iocore/net/quic/QUICConfig.cc
@@ -142,6 +142,11 @@ QUICConfigParams::initialize()
   REC_EstablishStaticConfigInt32U(timeout, "proxy.config.quic.loss_detection.default_initial_rtt");
   this->_ld_default_initial_rtt = HRTIME_MSECONDS(timeout);
 
+  REC_EstablishStaticConfigInt32U(this->_cc_default_mss, "proxy.config.quic.congestion_control.default_mss");
+  REC_EstablishStaticConfigInt32U(this->_cc_initial_window_scale, "proxy.config.quic.congestion_control.initial_window_scale");
+  REC_EstablishStaticConfigInt32U(this->_cc_minimum_window_scale, "proxy.config.quic.congestion_control.minimum_window_scale");
+  REC_EstablishStaticConfigFloat(this->_cc_loss_reduction_factor, "proxy.config.quic.congestion_control.loss_reduction_factor");
+
   QUICStatelessRetry::init();
 
   this->_server_ssl_ctx = quic_init_server_ssl_ctx(this);
@@ -286,6 +291,30 @@ QUICConfigParams::ld_default_initial_rtt() const
   return _ld_default_initial_rtt;
 }
 
+uint32_t
+QUICConfigParams::cc_default_mss() const
+{
+  return _cc_default_mss;
+}
+
+uint32_t
+QUICConfigParams::cc_initial_window() const
+{
+  return _cc_initial_window_scale * _cc_default_mss;
+}
+
+uint32_t
+QUICConfigParams::cc_minimum_window() const
+{
+  return _cc_minimum_window_scale * _cc_default_mss;
+}
+
+float
+QUICConfigParams::cc_loss_reduction_factor() const
+{
+  return _cc_loss_reduction_factor;
+}
+
 //
 // QUICConfig
 //
diff --git a/iocore/net/quic/QUICConfig.h b/iocore/net/quic/QUICConfig.h
index a2fb0ed..af76499 100644
--- a/iocore/net/quic/QUICConfig.h
+++ b/iocore/net/quic/QUICConfig.h
@@ -61,6 +61,11 @@ public:
   ink_hrtime ld_delayed_ack_timeout() const;
   ink_hrtime ld_default_initial_rtt() const;
 
+  uint32_t cc_default_mss() const;
+  uint32_t cc_initial_window() const;
+  uint32_t cc_minimum_window() const;
+  float cc_loss_reduction_factor() const;
+
 private:
   static int _connection_table_size;
 
@@ -93,6 +98,12 @@ private:
   ink_hrtime _ld_min_rto_timeout     = HRTIME_MSECONDS(200);
   ink_hrtime _ld_delayed_ack_timeout = HRTIME_MSECONDS(25);
   ink_hrtime _ld_default_initial_rtt = HRTIME_MSECONDS(100);
+
+  // [draft-10 recovery] - 4.7.1.  Constants of interest
+  uint32_t _cc_default_mss          = 1460;
+  uint32_t _cc_initial_window_scale = 10; // Actual initial window size is this value multiplied by the _cc_default_mss
+  uint32_t _cc_minimum_window_scale = 2;  // Actual minimum window size is this value multiplied by the _cc_default_mss
+  float _cc_loss_reduction_factor   = 0.5;
 };
 
 class QUICConfig
diff --git a/iocore/net/quic/QUICCongestionController.cc b/iocore/net/quic/QUICCongestionController.cc
index de607a4..b748050 100644
--- a/iocore/net/quic/QUICCongestionController.cc
+++ b/iocore/net/quic/QUICCongestionController.cc
@@ -24,6 +24,8 @@
 #include <ts/Diags.h>
 #include <QUICLossDetector.h>
 
+#include "QUICConfig.h"
+
 #define QUICCCDebug(fmt, ...)                                                                                           \
   Debug("quic_cc", "[%" PRIx64 "] "                                                                                     \
                    "window: %" PRIu32 " bytes: %" PRIu32 " ssthresh: %" PRIu32 " " fmt,                                 \
@@ -36,20 +38,20 @@
         static_cast<uint64_t>(this->_connection_id), this->_congestion_window, this->_bytes_in_flight, this->_ssthresh, \
         ##__VA_ARGS__)
 
-// 4.7.1.  Constants of interest
-constexpr static uint16_t DEFAULT_MSS         = 1460;
-constexpr static uint32_t INITIAL_WINDOW      = 10 * DEFAULT_MSS;
-constexpr static uint32_t MINIMUM_WINDOW      = 2 * DEFAULT_MSS;
-constexpr static double LOSS_REDUCTION_FACTOR = 0.5;
-
-QUICCongestionController::QUICCongestionController()
+QUICCongestionController::QUICCongestionController() : QUICCongestionController(0)
 {
-  this->_congestion_window = INITIAL_WINDOW;
 }
 
 QUICCongestionController::QUICCongestionController(QUICConnectionId connection_id) : _connection_id(connection_id)
 {
-  this->_congestion_window = INITIAL_WINDOW;
+  QUICConfig::scoped_config params;
+  this->_k_default_mss           = params->cc_default_mss();
+  this->_k_initial_window        = params->cc_initial_window();
+  this->_k_minimum_window        = params->cc_minimum_window();
+  this->_k_loss_reduction_factor = params->cc_loss_reduction_factor();
+
+  // 4.7.3.  Initialization
+  this->_congestion_window = this->_k_initial_window;
 }
 
 void
@@ -79,7 +81,7 @@ QUICCongestionController::on_packet_acked(QUICPacketNumber acked_packet_number,
     QUICCCDebug("slow start window chaged");
   } else {
     // Congestion avoidance.
-    this->_congestion_window += DEFAULT_MSS * acked_packet_size / this->_congestion_window;
+    this->_congestion_window += this->_k_default_mss * acked_packet_size / this->_congestion_window;
     QUICCCDebug("Congestion avoidance window changed");
   }
 }
@@ -96,8 +98,8 @@ QUICCongestionController::on_packets_lost(std::map<QUICPacketNumber, PacketInfo
   // than the end of the previous recovery epoch.
   if (!this->_in_recovery(largest_lost_packet)) {
     this->_end_of_recovery = largest_lost_packet;
-    this->_congestion_window *= LOSS_REDUCTION_FACTOR;
-    this->_congestion_window = std::max(this->_congestion_window, MINIMUM_WINDOW);
+    this->_congestion_window *= this->_k_loss_reduction_factor;
+    this->_congestion_window = std::max(this->_congestion_window, this->_k_minimum_window);
     this->_ssthresh          = this->_congestion_window;
     QUICCCDebug("packet lost, window changed");
   }
@@ -106,7 +108,7 @@ QUICCongestionController::on_packets_lost(std::map<QUICPacketNumber, PacketInfo
 void
 QUICCongestionController::on_retransmission_timeout_verified()
 {
-  this->_congestion_window = MINIMUM_WINDOW;
+  this->_congestion_window = this->_k_minimum_window;
 }
 
 bool
diff --git a/iocore/net/quic/QUICLossDetector.h b/iocore/net/quic/QUICLossDetector.h
index 202e6a7..0fd65c5 100644
--- a/iocore/net/quic/QUICLossDetector.h
+++ b/iocore/net/quic/QUICLossDetector.h
@@ -65,7 +65,14 @@ public:
   uint32_t current_ssthresh() const;
 
 private:
-  // 4.7.2.  Variables of interest
+  // 4.7.1. Constants of interest (draft-10)
+  // Values will be loaded from records.config via QUICConfig at constructor
+  uint32_t _k_default_mss        = 0;
+  uint32_t _k_initial_window     = 0;
+  uint32_t _k_minimum_window     = 0;
+  float _k_loss_reduction_factor = 0.0;
+
+  // 4.7.2. Variables of interest
   uint32_t _bytes_in_flight         = 0;
   uint32_t _congestion_window       = 0;
   QUICPacketNumber _end_of_recovery = 0;
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 85bd71a..4705eed 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1351,6 +1351,15 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.quic.loss_detection.default_initial_rtt", RECD_INT, "100", RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[0-9]+$", RECA_NULL}
   ,
+  // Constatns of Congestion Control
+  {RECT_CONFIG, "proxy.config.quic.congestion_control.default_mss", RECD_INT, "1460", RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[0-9]+$", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.quic.congestion_control.initial_window_scale", RECD_INT, "10", RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[0-9]+$", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.quic.congestion_control.minimum_window_scale", RECD_INT, "2", RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[0-9]+$", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.quic.congestion_control.loss_reduction_factor", RECD_FLOAT, "0.5", RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[\\.0-9]+$", RECA_NULL}
+  ,
 
   //# Add LOCAL Records Here
   {RECT_LOCAL, "proxy.local.incoming_ip_to_bind", RECD_STRING, nullptr, RECU_NULL, RR_NULL, RECC_NULL, nullptr, RECA_NULL}

-- 
To stop receiving notification emails like this one, please contact
masaori@apache.org.