<?xml version="1.0" encoding="US-ASCII"?>
<?rfc strict="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-cheng-rtgwg-enhanced-ecmp-03" ipr="trust200902" submissionType="IETF" consensus="true">
  <front>
    <title abbrev="Enhanced ECMP for AI Network">Enhanced ECMP for AI Cluster</title>

    <author fullname="Weiqiang Cheng" initials="W." surname="Cheng">
      <organization>China Mobile</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>chengweiqiang@chinamobile.com</email>
      </address>
    </author>

    <author fullname="Changwang Lin" initials="C." surname="Lin">
      <organization>New H3C Technologies</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>linchangwang.04414@h3c.com</email>
      </address>
    </author>
	
	<author fullname="Xiaodong Duan" initials="X." surname="Duan">
      <organization>China Mobile</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>duanxiaodong@chinamobile.com</email>
      </address>
    </author>
	
	    <author fullname="Rui Zhuang" initials="R." surname="Zhuang">
      <organization>China Mobile</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>zhuangruiyjy@chinamobile.com</email>
      </address>
    </author>

    <date year="2026"/>

    <workgroup>RTGWG Working Group</workgroup>

    <abstract>
      <t>In AI training scenarios, per-flow ECMP is the mainstream load balancing technology 
	  deployed in current networks. However, inherent hash collision issues of traditional 
	  ECMP lead to imbalanced traffic distribution, adversely affecting application
      performance.</t>
      <t>To address this problem, this document proposes an enhanced ECMP
      method that resolves load imbalance caused by hash collisions. The
      proposed solution effectively improves load balancing efficiency,
      reduces network congestion, and enhances overall network
      performance.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="sec-intro" title="Introduction">
      <t>
	  ECMP (Equal-Cost Multi-Path) is the fundamental load balancing technology widely deployed in AI cluster networks. 
	  The dominant implementation of traditional ECMP is per-flow forwarding, as illustrated in Figure 1.
      </t>
	  <t>
      Per-flow ECMP distributes traffic across multiple equal-cost paths based on hash calculation 
	  of flow characteristics (typically the five-tuple: source IP, destination IP, source port, destination 
	  port, protocol). This approach works effectively in general data center scenarios with massive small flows. 
	  Its core advantage is that packets of the same flow always follow the same path, naturally guaranteeing 
	  in-order packet delivery.</t>
	  <t>
      However, traditional per-flow ECMP has inherent limitations in load balancing granularity. 
	  Its load balancing performance relies on the statistical dispersion of a large number of flows. 
	  When the number of flows is limited, or elephant flows account for a high proportion, 
	  hash collisions are more likely to occur: multiple large flows are mapped to the same physical link, 
	  while other links are underutilized. This results in highly imbalanced link utilization and degraded 
	  load balancing performance.</t>
	  <t>
      In AI training scenarios, per-flow ECMP is still the mainstream load balancing approach. 
	  Due to the unique traffic patterns of AI training jobs (i.e., periodic bursts, small number of 
	  flows, and elephant flows), the hash collision and load imbalance problems of traditional 
	  ECMP become more prominent, which has become a key bottleneck affecting training efficiency.  
	  </t>


      <figure anchor="fig-1" title="Per-flow ECMP">
        <artwork><![CDATA[
                              ECMP
          Flow 1    Hash 1   +------+
          Flow 4  +--------- |if 1  |-----
          Flow 7             +------+
                             |      |-----
          Flow 2    Hash 2   +------+
          Flow 5  +--------  |if 2  |-----
          Flow 8             +------+
                             |      |-----
          Flow 3    Hash 3   +------+
          Flow 6  +-------   |if 3  |-----
          ...                +------+
                             |...   |-----
                             +------+
]]></artwork>
      </figure>

      <t>To address this problem, this document proposes an enhanced
      ECMP method that resolves load imbalance caused by hash
      collisions. The proposed solution effectively improves load
      balancing efficiency, reduces network congestion, and enhances
      overall network performance.</t>

      <section anchor="sec-req" title="Requirements Language">
        <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>

    <section anchor="sec-motivation" title="Motivation">
      <figure anchor="fig-2" title="Example of AI training network">
        <artwork><![CDATA[
            +---------+                         +---------+
            |  Spine1 |                         |  Spine2 |
            +-#--#-#--+                         +#---#--#-+
              |  | |                             |   |  |
              |  | |                             |   |  |
              |  | +-----------------------------)-+ |  |
              |  |                               | | |  |
              |  |   +---------------------------+ | |  |
              |  |   |                             | |  |
              |  +---)----------+     +------------)-+  |
              |      |          |     |            |    |
            +-#------#+       +-#-----#-+       +--#----#-+
            |  Leaf1  |       |  Leaf2  |       |  Leaf3  |
            +-#------#+       +-#------#+       +-#------#+
              |      |          |      |          |      |
            +-#+   +-#+       +-#+   +-#+       +-#+   +-#+
            |H1|   |H2|       |H3|   |H4|       |H5|   |H6|
            +--+   +--+       +--+   +--+       +--+   +--+
]]></artwork>
      </figure>

      <t>AI training clusters typically adopt a Spine-Leaf architecture, as shown in Figure 2. 
	  Computing nodes are connected to Leaf switches, and multiple parallel equal-cost paths exist 
	  between the Leaf and Spine layers. The traffic patterns of AI training networks is significantly 
	  different from that of general data centers, making it challenging to achieve balanced
      load distribution. The core traffic of AI training comes from collective communication operations 
	  and parameter synchronization between computing nodes. This traffic pattern has two prominent 
	  characteristics that challenge traditional ECMP mechanisms. First, the number of concurrent flows 
	  is relatively limited compared with general data centers. Second, AI training flows are 
	  typically high-bandwidth, long-duration elephant flows. The statistical load balancing effect 
	  of hash-based ECMP cannot be effectively exerted when the number of flows is small. 
	  Once hash collision occurs and multiple elephant flows are mapped to the same path, it will 
	  cause uneven traffic distribution, potentially leading to network congestion and bandwidth bottleneck, 
	  and significantly reducing the overall training throughput. Although
	  packet-based load balancing can mitigate this imbalance to some degree, they
      introduce packet reordering issues as packets belonging to the same flow may traverse
      different paths, requiring additional network-level reordering
      mechanisms.</t>

      <t>The imbalanced load caused by traditional ECMP has become an important factor 
	  restricting the network performance of AI clusters. This document proposes two enhanced ECMP 
	  methods to address the load imbalance problem in AI training networks and improve the overall 
      network performance.</t>
    </section>

    <section anchor="sec-solution" title="Solution">
      <section anchor="sec-ingress" title="ECMP based on source ingress interface">
        <t>This solution introduces source ingress interface grouping as an additional dimension to participate in ECMP hashing. 
		Group the ingress interfaces for traffic, assign an ECMP
        number to the interfaces within the same group, and then
        perform ECMP hashing based on this ECMP number. This method is
        suitable when the forwarding traffic size for each ingress
        interface is roughly the same.</t>

        <figure anchor="fig-3" title="ECMP based on source ingress interface">
          <artwork><![CDATA[
                                                         +-------+
    ingress-interface 1 -> group-id 1 -> ECMP Index 1--> |if 1   |
                                                         +-------+
    ingress-interface 2 -> group-id 1 -> ECMP Index 2--> |if 2   |
                                                         +-------+
    ingress-interface 3 -> group-id 1 -> ECMP Index 3--> |if 3   |
                                                         +-------+
    ingress-interface 4 -> group-id 1 -> ECMP Index 4--> |if 4   |
                                                         +-------+
    ingress-interface 5 -> group-id 2 -> ECMP Index 1--> |if 1   |
                                                         +-------+
    ingress-interface 6 -> group-id 2 -> ECMP Index 2--> |if 2   |
                                                         +-------+
    ingress-interface 7 -> group-id 2 -> ECMP Index 3--> |if 3   |
                                                         +-------+
    ingress-interface 8 -> group-id 2 -> ECMP Index 4--> |if 4   |
                                                         +-------+
]]></artwork>
        </figure>

        <t>As shown in <xref target="fig-3"/>, the eight ingress
        interfaces are divided into two groups, with four interfaces in
        each group.</t>

        <t>Within each group:</t>

        <ul>
          <li>The ingress interfaces are assigned ECMP numbers 1, 2, 3,
          and 4 respectively.</li>
          <li>ECMP hashing is performed based on these assigned ECMP
          numbers to select corresponding egress interfaces for
          forwarding.</li>
        </ul>

        <t>For traffic entering through the four ingress interfaces in
        Group 1: Different egress interfaces are selected for
        forwarding (four distinct paths).</t>

        <t>Similarly, for traffic entering through Group 2's four
        ingress interfaces: Different egress interfaces are selected
        for forwarding (four distinct paths).</t>
		
		<t>Compared with traditional per-flow ECMP, this solution reduces the probability that multiple 
		flows are mapped to the same egress path, and effectively improves the uniformity of 
		egress load distribution.</t>
      </section>

      <section anchor="sec-egress" title="ECMP based on egress Grouping">
        <figure anchor="fig-4" title="ECMP based on egress Grouping">
          <artwork><![CDATA[
                        +-----+       +----+ Egress
                        |Spine|-------|Leaf|----Host
          Ingress     / +-----+  / \   +----+
              +----+ /   +-----+/   \+----+  Egress
     Host ----|Leaf|/----|Spine|------|Leaf|----Host
              +----+\    +-----+\   / +----+
                     \  +-----+  \ /  +----+ Egress
                      \ |Spine|------|Leaf|----Host
                        +-----+      +----+
]]></artwork>
        </figure>

        <t>As shown in figure 4, the source HOST connects to the
        source Leaf via an Ingress interface, while the destination
        HOST connects to the destination Leaf through an Egress
        interface. Multiple ECMP links exist
        between the Leaf switches and multiple Spine devices.</t>

        <t>This solution introduces destination egress interface grouping as 
		an additional dimension to participate in ECMP hashing. 
		To improve load-balancing distribution uniformity, the ECMP
        interfaces connecting to multiple Spine devices are grouped on
        the source Leaf device. This grouping SHOULD be configured on the Leaf
        device. For example, if there are 128 equal-cost links between
        the source Leaf and Spine devices, they can be divided into
        groups of 4 interfaces each (Group 1: interfaces 1-4; Group 2:
        interfaces 5-8, etc.).</t>

        <t>For traffic load balancing, flows MUST first be mapped to
        specific groups based on their location information (flows
        with the same location information are assigned to the same
        group), and then hash-based load balancing is performed within
        each group.</t>

        <t>The location information used for group mapping can be
        either the source's Ingress interface or the destination's
        Egress interface.</t>

        <figure anchor="fig-5" title="Route carries remote egress group-id attribute">
          <artwork><![CDATA[
                Mapping to        <------Route(with egress group-id)
        +-------+Group ID     +-----+     +------+
        |Ingress|-------------|Spine|-----|Egress|------egress
        |Leaf   |             |     |     |Leaf  |
        +-------+             +-----+     +------+
]]></artwork>
        </figure>

        <figure anchor="fig-6" title="Grouping interfaces within an ECMP Group">
          <artwork><![CDATA[
       Ecmp Group--
                   |--Sub Group-id 1 ---------(if-1,if-2, if-3,if-4)
                   |--Sub Group-id 2 ---------(if-5,if-6, if-7,if-8)
                    ...
]]></artwork>
        </figure>

        <t>First, as shown in <xref target="fig-5"/>, when the Egress
        Leaf advertises a route, it MUST carry the egress group index,
        which can be composed of the local device's router-id and
        group-id (see <xref target="sec-proto"/> for details).</t>

        <t>On the Ingress Leaf, the ECMP egress interfaces toward the
        Spine devices MUST be grouped (as illustrated in <xref
        target="fig-6"/>).</t>

        <t>When the Ingress Leaf receives a route, it MUST extract the
        remote egress group index carried in the route. It then maps
        this remote egress group index to a local ECMP subgroup index,
        effectively directing traffic to the corresponding subset of
        interfaces for forwarding.</t>

        <t>This ensures that flows destined for different remote
        addresses are load-balanced across different ECMP subgroups,
        improving distribution granularity. Refer to <xref
        target="fig-7"/> for details.</t>

        <figure anchor="fig-7" title="Mapping of remote egress group index to local ECMP subgroup">
          <artwork><![CDATA[
+=========+=============+=================+======================+
|  Dest   |Remote       |  Local Index    | ECMP interfaces      |
|         | Attribute   |                 |                      |
+=========+=============+=================+======================+
| route-1 |Egress Group |Local ECMP       |(if-1,if-2, if-3,if-4)|
|         |Index 1      |Sub Group Index 1|                      |
+=========+=============+=================+======================+
| route-2 |Egress Group |Local ECMP       |(if-5,if-6, if-7,if-8)|
|         |Index 2      |Sub Group Index 2|                      |
+=========+=============+=================+======================+
|    ...  |     ...     |       ...       |          ...         |
+=========+=============+=================+======================+
]]></artwork>
        </figure>
		
		<t>By implementing fine-grained grouping of ECMP interfaces, 
		this solution achieves more uniform traffic load distribution, 
		thereby addressing the problem of imbalanced load sharing caused by hash collisions.</t>
      </section>
    </section>

    <section anchor="sec-proto" title="Protocol Extension">
      <t>To support the enhanced ECMP mechanism based on egress
      grouping described in <xref target="sec-egress"/>, the route
      advertised by the Egress Leaf MUST carry an egress group index,
      which is composed of the local device's router-id and group-id.
      The encoding of this information is defined as a new BGP
      Extended Community (BGP_EXT-COMM-ECMP-GROUPID) in
      <xref target="I-D.cheng-idr-ecmp-groupid"/>.</t>

      <t>On the Ingress Leaf, when a route carrying this extended
      community is received, the remote egress group index is mapped
      to a local ECMP subgroup index as described in
      <xref target="sec-egress"/>, directing traffic to the
      corresponding subset of ECMP interfaces for forwarding.</t>
    </section>

    <section anchor="sec-security" title="Security Considerations">
      <t>TBD.</t>
    </section>

    <section anchor="sec-iana" title="IANA Considerations">
      <t>This document has no IANA actions. The registration request
      for BGP_EXT-COMM-ECMP-GROUPID is defined in
      <xref target="I-D.cheng-idr-ecmp-groupid"/>.</t>
    </section>
  </middle>

  <back>
    <references anchor="sec-normref">
      <name>Normative References</name>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
        <front>
          <title abbrev="RFC2119">Key words for use in RFCs to Indicate Requirement Levels</title>
          <author initials="S." surname="Bradner" fullname="S. Bradner"/>
          <date month="March" year="1997"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
        <front>
          <title abbrev="RFC8174">Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author initials="B." surname="Leiba" fullname="B. Leiba"/>
          <date month="May" year="2017"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
    </references>

    <references anchor="sec-inforef">
      <name>Informational References</name>
      <reference anchor="I-D.cheng-idr-ecmp-groupid" target="https://datatracker.ietf.org/doc/draft-cheng-idr-ecmp-groupid/">
        <front>
          <title abbrev="BGP ECMP GroupID">BGP Extension for ECMP Group ID</title>
          <author initials="W." surname="Cheng" fullname="Weiqiang Cheng">
            <organization>China Mobile</organization>
          </author>
          <author initials="C." surname="Lin" fullname="Changwang Lin">
            <organization>New H3C Technologies</organization>
          </author>
          <date year="2026"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-cheng-idr-ecmp-groupid-00"/>
      </reference>
    </references>
  </back>
</rfc>
