<?xml version="1.0" encoding="utf-8"?>
<!-- 
     draft-rfcxml-general-template-annotated-00
  
     This template includes examples of most of the features of RFCXML with comments explaining 
     how to customise them, and examples of how to achieve specific formatting.
     
     Documentation is at https://authors.ietf.org/en/templates-and-schemas
-->
<?xml-model href="rfc7991bis.rnc"?>  <!-- Required for schema validation and schema-aware editing -->
<!-- <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?> --> 
<!-- This third-party XSLT can be enabled for direct transformations in XML processors, including most browsers -->

<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<!-- If further character entities are required then they should be added to the DOCTYPE above.
     Use of an external entity file is not recommended. -->

<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="info"
  docName="draft-zhang-iccrg-confucius-00"
  ipr="trust200902"
  obsoletes=""
  updates=""
  submissionType="IETF"
  xml:lang="en"
  version="3">
<!-- 
    * docName should be the name of your draft
    * category should be one of std, bcp, info, exp, historic
    * ipr should be one of trust200902, noModificationTrust200902, noDerivativesTrust200902, pre5378Trust200902
    * updates can be an RFC number as NNNN
    * obsoletes can be an RFC number as NNNN 
-->

  <front>
    <title abbrev="Confucius">Adapting Home Routers to Congestion Control’s Reactions for Consistent Low Latency</title> <!-- https://authors.ietf.org/en/rfcxml-vocabulary#title-4 -->
    <!--  The abbreviated title is required if the full title is longer than 39 characters -->

    <seriesInfo name="Internet-Draft" value="draft-zhang-iccrg-confucius-00"/> <!-- https://authors.ietf.org/en/rfcxml-vocabulary#seriesinfo -->
    <!-- Set value to the name of the draft  -->
   
    <author fullname="Bochun Zhang" initials="B." surname="Zhang">
      <organization>Tsinghua SIGS</organization>
      <address> 
        <postal>
          <country>China</country>
        </postal>        
        <email>zbc22@mails.tsinghua.edu.cn</email>  
      </address>
    </author>

    <author fullname="Zili Meng" initials="Z." surname="Meng"> <!-- https://authors.ietf.org/en/rfcxml-vocabulary#author -->
    <!-- initials should not include an initial for the surname -->
    <!-- role="editor" is optional -->
    <!-- Can have more than one author -->
      
    <!-- all of the following elements are optional -->
      <organization>HKUST</organization> <!-- https://authors.ietf.org/en/rfcxml-vocabulary#organization -->
      <address> <!-- https://authors.ietf.org/en/rfcxml-vocabulary#address -->
        <postal>
          <!-- Reorder these if your country does things differently -->
          <!-- <street>Street</street> -->
          <city>HongKong</city>
          <!-- <region>Region</region> -->
          <!-- <code>Postal code</code> -->
          <country>China</country>
          <!-- Can use two letter country code -->
        </postal>        
        <!-- <phone>Phone</phone> -->
        <email>zilim@ust.hk</email>  
        <!-- Can have more than one <email> element -->
        <uri>https://zilimeng.com/</uri>
      </address>
    </author>
   
    <date year="2025"/> <!-- https://authors.ietf.org/en/rfcxml-vocabulary#date -->
    <!-- On draft subbmission:
         * If only the current year is specified, the current day and month will be used.
         * If the month and year are both specified and are the current ones, the current day will
           be used
         * If the year is not the current one, it is necessary to specify at least a month and day="1" will be used.
    -->

    <area>General</area>
    <workgroup>Internet Engineering Task Force</workgroup>
    <!-- "Internet Engineering Task Force" is fine for individual submissions.  If this element is 
          not present, the default is "Network Working Group", which is used by the RFC Editor as 
          a nod to the history of the RFC Series. -->
    
    <keyword>AQM</keyword>
    <keyword>real-time communication</keyword>
    <!-- Multiple keywords are allowed.  Keywords are incorporated into HTML output files for 
         use by search engines. -->

    <abstract>
      <t>This document describes Confucius -- a practical queue management scheme designed for offering real-time flows with consistently low latency regardless of competition. Confucius employs an age-aware weight adjustment mechanism to slows down bandwidth adjustment to match the reaction of congestion control, so that the end host can reduce the sending rate without overshooting the network. Confucius is deployed on home routers and requires no configuration in normal Internet deployments.</t>
    </abstract>
 
  </front>

  <middle>
    
    <section anchor="intro">
    <!-- The default attributes for <section> are numbered="true" and toc="default" -->
      <name>Introduction</name>
      <t>Emerging high-quality real-time video streaming applications require consistently low latency, which is often disrupted by latency spikes caused by competing flows, especially those from web traffic. </t>
      <t>The root cause of latency spikes in real-time flow is the mismatch in reaction time between the bandwidth reallocation on routers and congestion control mechanisms on endpoints. When loading a website, with 9 flows, in the same time with an existing real-time flow, the available bandwidth of the real-time flow is immediately reduced to 1/10 of what it was.</t>
      <t>Congestion Control Algorithms (CCAs) reduce the real-time flow’s congestion window or sending rate only after end hosts observe latency increases or packet loss, by which time the reaction is already too late. It takes several RTTs for CCAs to converge to the new available bandwidth, while the excessive packets during this period will result in a bufferbloat and lead to an increase in the end-to-end delay.</t>
      <t>Several approaches to AQM have been developed over the past two decades, but none have been able to practically control latency spikes in scenarios where real-time flows compete with eb traffic. With fair queueing (FQ and FqCoDel<xref target="RFC8289"/>), the latency spikes is worsen since the per-flow fair queueing shifts large bandwidth away from real-time flows. By labeling flows in advance, AQMs like CBQ<xref target="CBQ1995"/>, DiffServ<xref target="RFC4594"/> and L4S<xref target="RFC9330"/> schedule real-time flows and web traffic differently on the router using ’StrictPriority‘ or weighted class. However, this is impractical in home networks where the application and router belong to different entities since applications will be incentivized to fake their labels for better performance.</t>
      <t>Learning from this history, the Confucius approach is designed to meet the following goals:</t>
      <ol type="(%c)">
          <li>Provide latency consistency to real-time flows independently of the number, rate, or CCA of the competing flows.</li>
          <li>Achieve eventual fairness between real-time flows and competing flows within a bounded convergence time.</li>
          <li>Operate transparently without endpoint labeling, ensuring practical deployment.</li>
      </ol>
      <t>Confucius introduces, for the first time, an age-aware weight adjustment mechanism capable of distinguishing real-time flows from web traffic while smoothly regulating bandwidth allocation between them.</t>
    </section>

    <section anchor="requirements">
    <!-- anchor is an optional attribute -->
      <name>Conventions Used in This Document</name>
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
        "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
        RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
        interpreted as described in BCP 14 <xref target="RFC2119"/>
        <xref target="RFC8174"/> when, and only when, they appear in
        all capitals, as shown here.</t>
    </section>
    
    <section>
      <name>Overview of Confucius</name>
      <t>The Confucius algorithm described in the rest of this document uses one key variable: LAMBDA, which controls the speed of the weight adjustment.</t>
    
      <section anchor="reweight">
        <name>Exponential Bandwidth Re-allocation</name>
        <t>The scheduling of Confucius among flows is implemented with a per-flow Deficit Weighted Round Robin (DWRR) mechanism, where a flow's bandwidth share equals its weight divided by the sum of all weights under DWRR scheduling. Unlike the uniform weights in FQ, Confucius carefully calculates the weight for each flow.</t>
        <t>When a flow arrives at the home router, it is classified as a 'new flow' with an initial weight based on the number of existing new flows. </t>
        <t>For each new flow, Confucius doubles its weight every 1/LAMBDA milliseconds. This shows how Confucius exponentially increases the weights of new flows. After a time of t the weight of the new flow will be multiplied by 2 LAMBDA * t.</t>
        <t>Confucius uses a flow weight threshold of 1 to 'age out' new flows. Once the weight of a flow reaches 1, the flow is no longer considered new and will be marked as old flow. </t>
      </section>

      <section>
        <name>Setting LAMBDA</name>
        <t>A large LAMBDA leads to abrupt reductions in available bandwidth and causes latency spike, while a small LAMBDA results in unfairness for new flows.</t>
        <t>The principle of setting LAMBDA SHOULD be to limit the performance degradation of competing flows to an acceptable level while maximizing 1/LAMBDA.</t>
        <t>We configure LAMBDA = 0.004 (ms^-1) to have a doubling interval of 1/LAMBDA = 250 ms based on the reduction speed metrics of the real-time flows. For typical websites with 10-20 flows, the Page Load Time (PLT) degradation is less than 100 ms, which is acceptable compared to the second-level PLT.</t>
        <t>With no changes to parameters, Confucius is expected to work across a wide range of conditions, with varying links and all major delay-controlling CCAs.</t>
      </section>
    </section>

    <section>
      <name>Annotated Pseudocode for Confucius</name>
      <t>What follows is the pseudocode of the Confucius algorithm, illustrating the specific process of  a new flow arriving, completing, and reweighting. We denote the set of new flows and all flows as F_new and F_all, respectively.</t>

      <section>
        <name>Arrival and completion of new flows</name>

        <!-- <sourcecode name="arrival" type="pseudocode" markers="false">
          <![CDATA[
NewFlowArrival(f):
  for i in F_new:           // Scale down weights
      w_i = (|F_new| * w_i) / (|F_new| + 1)
  w_f = 1 / (|F_new| + 1)   // Initialize the weight for f
  F_new = F_new + f         // Add flow f to set 'F_new'
  F_all = F_all + f         // Add flow f to set 'F_all'
          ]]>
        </sourcecode> -->


        <artwork name="arrival" type="ascii-art">
          <![CDATA[
NewFlowArrival(f):
    for i in F_new:           /* Scale down weights */
        w_i = (|F_new| * w_i) / (|F_new| + 1)
    w_f = 1 / (|F_new| + 1)   /* Initialize the weight for f */
    F_new = F_new + f         /* Add flow f to set 'F_new' */
    F_all = F_all + f         /* Add flow f to set 'F_all' */
          ]]>
        </artwork>

        <t>When a flow f just arrives at the queue, Confucius will adjust the weights of the flows that are already in F_new, rebalance the weights to the weight w_f for flow f.</t>

        <ul spacing="normal">
          <li>
            <t>The sum of weights of new flows is upper-bounded.</t>
            <t>Rebalancing the weights of the new flows in F_new to the just arrived flow f ensures that the sum of weights of new flows will not surge. In general, the weights of new flows will increase only when they are doubled. In this case, the existing flows will not be affected by the arrival of flow f.</t>
          </li>
          <li>
            <t>The ratio between the weights of flows in F_new is maintained.</t>
            <t>During the rebalancing, the flows that arrived earlier will still proportionally have larger weights. For two flows i and j, if flow i arrives T units of time earlier than flow j and before the rebalancing, w_i / w_j = 2T, the ratio still holds after rebalancing. This will help flow with a longer age to exit from F_new earlier, and help to maintain the long-term fairness.</t>
          </li>
        </ul>


        <!-- <sourcecode name="completion" type="pseudocode" markers="false">
          <![CDATA[
NewFlowCompletion(f):
  for i in F_new:           // Scale up weights
      w_i = (|F_new| * w_i) / (|F_new| - 1)
  F_new = F_new - f         // Remove flow f from set 'F_new'
  F_new = F_all - f         // Remove flow f from set 'F_all'
          ]]>
        </sourcecode> -->


        <artwork name="completion" type="ascii-art">
          <![CDATA[
NewFlowCompletion(f):
    for i in F_new:           /* Scale up weights */
        w_i = (|F_new| * w_i) / (|F_new| - 1)
    F_new = F_new - f         /* Remove flow f from set 'F_new' */
    F_new = F_all - f         /* Remove flow f from set 'F_all' */
          ]]>
        </artwork>

        <t>When one flow completes before its weight reaches the threshold, we will reallocate the bandwidth share to all flows in F_new. This ensures that the new flows can converge fast without affecting the existing flows.</t>

      </section>

      <section>
        <name>Age-aware Weight Adjustment Mechanism</name>

        <t>As described in <xref target="reweight"/>, Confucius reweights every 1/LAMBDA ms as follows:</t>
      

        <!-- <sourcecode name="arrival" type="pseudocode" markers="false">
          <![CDATA[
Reweight(f):
  for i in F_new:
      w_f = w_f * 2         // The weight doubles every 1/LAMBDA ms
  ration = sum_weight_of(F_new) / max(1, sum_weight_of(F_old))
  if ration > 1:            // New flows are the minority
      for f in F_new:
          w_f = w_f / ration
  for f in F_new:
      if w_f >= 1:          // The new flow is old enough
          w_f = 1
					F_new = F_new - f
          ]]>
        </sourcecode> -->


        <artwork name="arrival" type="ascii-art">
          <![CDATA[
Reweight(f):
    for i in F_new:
        w_f = w_f * 2         /* The weight doubles every 1/LAMBDA ms */
    ration = sum_weight_of(F_new) / max(1, sum_weight_of(F_old))
    if ration > 1:            /* New flows are the minority */
        for f in F_new:
            w_f = w_f / ration
    for f in F_new:
        if w_f >= 1:          /* The new flow is old enough */
            w_f = 1
            F_new = F_new - f
          ]]>
        </artwork>

        <ul spacing="normal">
          <li>
            <t>When there are more old flows than new flows.</t>
            <t>Confucius addresses the issue where a burst of new flows impacts a few existing flows. However, there may be more existing flows and only a few new flows. In this case, the new flow will not drastically grab the available bandwidth from the existing flows. We allocate resources to new flows as long as the bandwidth reduction of existing flows is bounded by half and the fair share.</t>
          </li>
          <li>
            <t>When flows are no longer new, i.e., their weight reaches 1, Confucius removes the flow from F_new. After that, the flow's weight will remain 1 all the time in the scheduling.</t>
          </li>
        </ul>

        <t>Consider the example in <xref target="intro"/>:</t>
        <t>There is a real-time flow existing in the Confucius queue that is marked as an 'old flow'. Then, a web page initiates multiple flows, leading to a burst of new flows. The sum weight of the weights of the new flows equals the weight of the real-time flow, causing the bandwidth of the real-time flow to be reduced to half of its original value instead of 1/10. Subsequently, the weights of the web flows grow exponentially and quickly converge towards fair allocation within a few RTTs, which is much shorter than the completion time of web traffic. During this process, the bandwidth is smoothly allocated between the real-time flow and the web traffic.</t>
        <t>Web traffic tends to start with multiple concurrently active flows, while real-time traffic usually generates only a few flows. Despite the absence of labels from the endpoints, Confucius is still able to distinguish web traffic and implement a different reaction compared to real-time flows.</t>
      
      </section>
    </section>
    
    
    <!-- <section>
      <name>Using xref</name>
      <t>A reference to <xref target="adding-diagrams"/></t>
      <t>A reference to <xref target="RFC8174" sectionFormat="of" section="2"/></t>
    </section> -->
    
    <section anchor="IANA">
    <!-- All drafts are required to have an IANA considerations section. See RFC 8126 for a guide.-->
      <name>IANA Considerations</name>
      <t>This memo includes no request to IANA.</t>
    </section>
    
    <section anchor="Security">
      <!-- All drafts are required to have a security considerations section. See RFC 3552 for a guide. -->
      <name>Security Considerations</name>
      <t>This document should not affect the security of the Internet.</t>
    </section>
    
    <!-- NOTE: The Acknowledgements and Contributors sections are at the end of this template -->
  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <!-- The recommended and simplest way to include a well known reference -->
        
      </references>
 
      <references>
        <name>Informative References</name>
       
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
        <!-- Manually added reference -->
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization/>
            </author>
            <date year="1997" month="March"/>
            <abstract>
              <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.
              </t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>

        <reference anchor="RFC8289" target="https://www.rfc-editor.org/info/rfc8289">
        <!-- Manually added reference -->
          <front>
            <title>Controlled Delay Active Queue Management</title>
            <author initials="K." surname="Nichols" fullname="K. Nichols">
              <organization/>
            </author>
            <date year="2018" month="January"/>
            <abstract>
              <t>This document describes CoDel (Controlled Delay) -- a general framework that controls bufferbloat-generated excess delay in modern networking environments. CoDel consists of an estimator, a setpoint, and a control loop. It requires no configuration in normal Internet deployments.
              </t>
            </abstract>
          </front>
          <!-- <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/> -->
        </reference>
       
        <reference anchor="CBQ1995">
        <!-- Example minimum reference -->
          <front>
            <title>Link-sharing and resource management models for packet networks</title>
            <author initials="S." surname="Floyd">
              <organization/>
            </author>
            <date year="1995"/>
          </front>
        </reference>

        <reference anchor="RFC4594" target="https://www.rfc-editor.org/info/rfc4594">
        <!-- Manually added reference -->
          <front>
            <title>Configuration Guidelines for DiffServ Service Classes</title>
            <author initials="J." surname="Babiarz" fullname="J. Babiarz">
              <organization/>
            </author>
            <date year="2006" month="August"/>
            <abstract>
              <t>This memo provides information for the Internet community.  It does not specify an Internet standard of any kind.  Distribution of this memo is unlimited.
              </t>
            </abstract>
          </front>
          <!-- <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/> -->
        </reference>

        <reference anchor="RFC9330" target="https://www.rfc-editor.org/info/rfc9330">
        <!-- Manually added reference -->
          <front>
            <title>Low Latency, Low Loss, and Scalable Throughput (L4S) Internet Service: Architecture</title>
            <author initials="B." surname="Briscoe" fullname="B. Briscoe">
              <organization/>
            </author>
            <date year="2023" month="January"/>
            <abstract>
              <t>This memo provides information for the Internet community.  It does not specify an Internet standard of any kind.  Distribution of this memo is unlimited.
              </t>
            </abstract>
          </front>
          <!-- <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/> -->
        </reference>

        <!-- <reference anchor="exampleRefOrg" target="http://www.example.com/">
          <front>
            <title>Title</title>
            <author>
              <organization>Organization</organization>
            </author>
            <date year="1984"/>
          </front>
        </reference>        -->
       
      </references>
    </references>
    
    <!-- <section>
      <name>Appendix 1</name>
      <t>This becomes an Appendix</t>
    </section> -->

    <!-- <section anchor="Acknowledgements" numbered="false">
      <name>Acknowledgements</name>
      <t>This template uses extracts from templates written by Pekka Savola, Elwyn Davies and 
        Henrik Levkowetz.</t>
    </section> -->
    
    <section anchor="Contributors" numbered="false">
      <!-- a Contributors section is optional -->
      <name>Contributors</name>
      <t>Thanks to all of the contributors.</t>
      <contact fullname="Zili Meng" initials="Z." surname="Meng"><!-- https://authors.ietf.org/en/rfcxml-vocabulary#contact-->
        <!-- including contact information for contributors is optional -->
        <organization>Hong Kong University of Science and Technology (HKUST)</organization>
        <address>
          <email>zilim@ust.hk</email>
        </address>
      </contact>

      <contact fullname="Bochun Zhang" initials="B." surname="Zhang"><!-- https://authors.ietf.org/en/rfcxml-vocabulary#contact-->
        <!-- including contact information for contributors is optional -->
        <organization>Tsinghua Shenzhen International Graduate School (SIGS)</organization>
        <address>
          <email>zbc22@mails.tsinghua.edu.cn</email>
        </address>
      </contact>
    </section>
    
 </back>
</rfc>
