<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->

<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2629 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2629.xml">
<!ENTITY RFC3552 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3552.xml">
<!ENTITY I-D.narten-iana-considerations-rfc2434bis SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.narten-iana-considerations-rfc2434bis.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="info" docName="draft-v6ops-jaeggli-pmtud-ecmp-problem-00" ipr="trust200902">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->

    <title abbrev="misses with ICMPv6 PTB">Close encounters of the icmp type 2 kind (near misses with ICMPv6 PTB)</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Joel Jaeggli" initials="J." surname="Jaeggli">
      <organization>Fastly</organization>

      <address>
        <postal>
          <street></street>

          <!-- Reorder these if your country does things differently -->

          <city>Mountain View</city>

          <region>CA</region>

          <code></code>

          <country>US</country>
        </postal>

        <phone></phone>

        <email>joelja@gmail.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Matt Hite" initials="M." surname="Hite">
      <organization>Zynga</organization>

      <address>
        <postal>
          <street></street>

          <!-- Reorder these if your country does things differently -->

          <city>Redwood City</city>

          <region>CA</region>

          <code></code>

          <country>US</country>
        </postal>

        <phone></phone>

        <email>mhite@zynga.com</email>

   </address>
    </author>

    <author fullname="Matt Byerly" initials="M." surname="Byerly">
      <organization>Zynga</organization>

      <address>
        <postal>
          <street></street>

          <!-- Reorder these if your country does things differently -->

          <city></city>

          <region>HI</region>

          <code></code>

          <country>US</country>
        </postal>

        <phone></phone>

        <email>mbyerly@zynga.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <date year="2014" />

    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
         in the current day for you. If only the current year is specified, xml2rfc will fill 
	 in the current day and month for you. If the year is not the current one, it is 
	 necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	 purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	 specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>Operations</area>

    <workgroup>v6ops</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF 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 IETF. -->

    <keyword>ipv6 icmp6 type 2 ptb</keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>This document calls attention to the problem posed to ICMP type 2 (PTB) messages by using stateless loading balancing in front of statelful services. It discusses operational mitigations that can mitigate this kind of failure. </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>The operators of large internet applications face some challenges associated with scaling their infrastructure. One approach in the toolbox, used in conjunction with others is the stateless distribution of incoming tcp sessions to stateful servers or to middle boxes known as load-balancers (which could be layer-4 devices or full application proxies) using an ecmp hash. Distribution of traffic in this fashion presents a problem when dealing with icmp signaling that does not match the values used compute the hash employed to distribute incoming traffic. A case that is particularly problematic operationally is path MTU discovery (PMTUD).</t>

<!--
      <section title="Requirements Language">
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
        document are to be interpreted as described in <xref
        target="RFC2119">RFC 2119</xref>.</t>
      </section> -->
    </section> 

    <section title="Problem">
      <t>
        A common application for stateless load-balancing of TCP or UDP flows is to perform an initial subdivision of flows in front of a stateful load-balancer tier or multiple servers such that the workload can be divided into managable chunks. The division is performed using ECMP forwarding and a stateless but sticky algorythm for hashing the flows across the available paths. This is constrained form of anycast distribution where all anycast destinations are eqidistant topologically from the upstream router making the last nexthop forwarding decision. In this approach the hash used in path selection has to use available headers, typically IP-source/IP-destination/protocol/source-port/destination-port for TCP or UDP though it could be limited to IP-source / IP-destination or in the case of IPv6 IP-source/IP-destination/flow-label. 
      </t>

      <t>
        A problem common to this approach to distribution through hashing is it's impact on path-mtu-discovery. An ICMP6 type 2 PTB message generated on the path taken by packets originating from a statelessy load balanced server will  have the anycast address as desintation and will be statelessly load-balanced to one of the stateful loadbalancers. While the ICMPv6 PTB message contains as much of the packet that could not be forwarded as possible the payload does not factor into the forwarding decision and it is not possible to reconstruct the results of the inward bound hashing decision (by reverseing the order of the source/dest/source port/dest port/protocol number or equivalent hash).
      </t>

      <t>
      An example packet flow and topology follow.
      </t>

<figure align="center" anchor="nexthop">
        <preamble></preamble>

        <artwork align="left"><![CDATA[

ptb -> router ecmp -> nexthop L4/L7 load balancer -> destination

  router --> load-balancer 1 --->
       \\--> load-balancer 2 ---> load-balanced service
        \--> load-balancer N --->

            ]]></artwork>

        <postamble> </postamble>
      </figure>

<t> 
The router ECMP decsion is used because it is part of the forwarding architecture, can be performed at what amounts to line-rate and is also not depedant on the existance of shared memory or coordination across a distributed forwarding architecture. The ECMP decision is determinstic with resepct to packets having the same hash.
</t>

<t>
  The typical case where ICMPv6 PTB messages are recieved at the load-balancer is where the path MTU from the client to the load-balancer is limited by a tunnel, which the client is itself not aware of. In the case of a TCP connection where TLS is employed, the first packet that is likely to exceed a tunnel MTU lower than that specified by the MSS on the client and the load-balancer/server is the serverhello and certificate (With http the client is likely to send the first packet exceeding the MTU given the loquatious nature of http clients). 
</t>

<t>
  Direct experience says that the frequency of PTB messages is fairly low as a percentage of traffic is pretty low, and that says a lot about native vs tunneled multicast deployment and techniques such as happy-eyeballs may actually contribute some amelioration to the IPv6 client experience. Still the expectation is that PMTUD should work and that unecessary breakage of client traffic should work.
</t>

<t>
  Some final oberservations are that it is typically not possible even if potentially desirable to be able to independantly set the TCP mss for different address families. The problem as described does also impact IPv4, however the ability to fragment on wire and the relative rarity of sub-1500 byte MTUs that are not coupled to changes in client behavior (client vpn tunnels for example typically set the MTU accordingly for perfomance reasons) makes the problem sufficiently rare that some depolyments simply choose to ignore it.
  </t>
</section>

  <section title="mitigation">
    <t>
      Mitigation of the issue of effectively random distribution of ICMPv6 PTB messages involves insuring that the packet in question is distributed to the load-balancer responsible for for the flow for which it is generated. Mitigation could be done by looking into payload of the ICMP message as the load balancer would (to determine which TCP flow it was associated with) before making a forwarding decision. 
    </t>

    <t>
      Alternative mitigation is predicated distributing the PTB message to all load-balancers under the assumption that the one that needs it will be able to match it to a flow and the others will safely discard it. Such distribution has signficant implications for resource consumption (it might result in a 10 or more fold increase in the amount of ICMP PTB traffic) and the potential for DOS if not carefully employed. Fortunately the number of flows for which this problem occurs is relatively small (10 or fewer pps on 1Gb/s or more worth of https traffic) and sensible ingress rate limits can protect the load-balancer tiers with potential fallout only under circumstances of deliberate duress.
    </t>

    <section title="Implementation">
    <t>
      <list style="numbers">
        <t>
          Filter-based-forwarding matches next-header ICMP6 ICMP type-2 and matches a next hop on a particular subnet directly attached to both border routers. (Filter is policed to 1000pps)
        </t>

        <t>
          Filter is applied on input side of all external interfaces
        </t>
        
        <t>
          A proxy located at the next hop forwards ICMP6 type-2 packets recived at the nexthop to an ethernet multicast address (example ff:ff:ff:ff:ff:ff) on all specificed subnets. This was necessitated by, The routers inability (in IPv6) to forward the same packet to multiple nexthops.
        </t>

        <t>
          load balancer(s) recieve and discard or process packet as needed
        </t>

      </list>
    </t>
    </section>

  </section>

  <section title="Improvements">
    <t> There are several ways to imagine that improvements could be made to the situation with respect load balancing ICMP PTB. 
    </t>

    <t>
      <list style="numbers">
        <t>Routers with sufficient capacity within the lookup process could parse all the way through the L3 or L4 header in the ICMP Payload begining at bit offset 32 of the ICMP header. By reordering the elements of the hash to match the inward direction of the flow the PTB could be directed to the same nexthop as the incoming packets in the flow.
        </t>

        <t>The Fib could be programed with a multicast distribution tree that included all of the necessary nexthops.
        </t>
      </list>
      </t>

</section>


    <section anchor="Acknowledgements" title="Acknowledgements">
      <t></t>
    </section>

    <!-- Possibly a 'Contributors' section ... -->

    <section anchor="IANA" title="IANA Considerations">
      <t>This memo includes no request to IANA.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t></t>
    </section>
  
  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
    <!-- References split into informative and normative -->

    <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->
<!--
    <references title="Informative References">

<reference anchor="" target="">
      <front>
          <title></title>

          <author>
            <organization></organization>
          </author>

          <date year="" />
        </front>
</reference>
</references>
-->
  </back>
</rfc>