<?xml version="1.0" encoding="US-ASCII"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<?rfc toc="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc number="8405" 
     category="std"
     submissionType="IETF"
     consensus="yes"
     ipr="trust200902">

  <front>
    <title abbrev="SPF Back-Off Delay Algorithm">Shortest Path First (SPF) Back-Off Delay Algorithm for Link-State IGPs</title>

    <author fullname="Bruno Decraene" initials="B." surname="Decraene">
      <organization>Orange</organization>

      <address>
        <email>bruno.decraene@orange.com</email>
      </address>
    </author>
        
    <author fullname="Stephane Litkowski" initials="S" surname="Litkowski">
      <organization>Orange Business Service</organization>
      <address>
        <email>stephane.litkowski@orange.com</email>
      </address>
    </author>   

	    <author fullname="Hannes Gredler" initials="H." surname="Gredler">
      <organization>RtBrick Inc.</organization>
	  <address>
      <email>hannes@rtbrick.com</email>
      </address>
    </author>

  <author initials='A.' surname="Lindem" fullname='Acee Lindem'>
    <organization>Cisco Systems</organization>
    <address>
      <postal>
        <street>301 Midenhall Way</street>
        <city>Cary</city> <region>NC</region> 
        <country>United States of America</country>
        <code>27513</code> 
       </postal>
       <email>acee@cisco.com</email>
    </address>
    </author>
        
        <author fullname="Pierre Francois" initials="P." surname="Francois">
    <address>
      <email>pfrpfr@gmail.com</email>
      </address>
    </author>
    
<author fullname="Chris Bowers" initials="C." surname="Bowers">
  <organization>Juniper Networks, Inc.</organization>
  <address>
    <postal><street>1194 N. Mathilda
    Ave.</street><city>Sunnyvale</city><region>CA</region><code>94089</code><country>United
    States of America</country></postal>
    <email>cbowers@juniper.net</email>
  </address>
</author>    
        
    <date month="June" year="2018" />

    <abstract>
      <t>This document defines a standard algorithm to temporarily postpone or
      "back off" link-state IGP Shortest Path First (SPF) computations. This reduces the computational load and churn on IGP nodes when multiple temporally close network events trigger multiple SPF computations.</t>

      <t>Having one standard algorithm improves interoperability by reducing the probability and/or duration of transient forwarding loops during the IGP convergence when the IGP reacts to multiple temporally close IGP events.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="Intro"  title="Introduction">
      <t>Link-state IGPs, such as <xref target="ISO10589">IS-IS</xref>, <xref target="RFC2328">OSPF</xref>, and <xref target="RFC5340">OSPFv3</xref>, perform distributed route computation on all routers in the area/level. In order to have consistent routing tables across the network, such distributed computation requires that all routers have the same version of the network topology (Link-State Database (LSDB)) and perform their computation essentially at the same time.</t>
          
     <t>In general, when the network is stable, there is a desire to trigger a new Shortest Path First (SPF) computation as soon as a failure is detected in
 order to quickly route around the failure. However, when the network is experiencing multiple failures over a short period of time, there is a conflicting desire to limit the frequency of SPF computations, which would allow a reduction in control plane resources used by IGPs and all protocols/subsystems reacting to the attendant route change, such as <xref target="RFC5036">LDP</xref>, <xref target="RFC3209">RSVP-TE</xref>, <xref target="RFC4271">BGP</xref>, Fast Reroute computations (e.g., <xref target="RFC5286">Loop-Free Alternates (LFAs)</xref>), FIB updates, etc. This also reduces network churn and, in particular, reduces side effects (such as micro-loops <xref target="RFC5715"></xref>) that ensue during IGP convergence.</t>
         
         <t>To allow for this, IGPs usually implement an SPF Back-Off Delay
	 algorithm that postpones or backs off the SPF computation. However, different implementations chose different algorithms. Hence, in a multi-vendor network, it's not possible to ensure that all routers trigger their SPF computation after the same delay. This situation increases the average and maximum differential delay between routers completing their SPF computation. It also increases the probability that different routers compute their FIBs based on different LSDB versions. Both factors increase the probability and/or duration of micro-loops as discussed in <xref target="Impact"/>.</t>
         
         <t>This document specifies a standard algorithm to allow multi-vendor networks to have all routers delay their SPF computations for the same duration.</t>
<section title="Requirements Language" anchor="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&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
        </t>
</section>
    </section>
        
        <section anchor="Goals" title="High-Level Goals">

<t>The high-level goals of this algorithm are the following:<list style="symbols">

<t>very fast convergence for a single event (e.g., link failure),</t>
<t>paced fast convergence for multiple temporally close IGP events while IGP stability is considered acceptable,</t>
<t>delayed convergence when IGP stability is problematic (this will allow the
IGP and related processes to conserve resources during the period of
instability), and</t>
<t>avoidance of having different SPF_DELAY timer values
(<xref target="Definitions"/>) across different routers in the area/level.
This requires specific consideration as different routers may receive IGP
messages at different intervals, or even in different orders, due to differences both in the distance from the originator of the IGP event and in flooding implementations.</t>
</list></t>

        </section>
        
        <section anchor="Definitions" title="Definitions and Parameters">

<t>IGP event: The reception or origination of an IGP LSDB change requiring a
new routing table computation. Some examples are a topology change, a prefix change, and a metric change on a link or prefix. Note that locally triggering a routing table computation is not considered an IGP event since other IGP routers are unaware of this occurrence.</t>

<t>Routing table computation, in this document, is scoped to the IGP; so, this is the computation of the IGP RIB, performed by the
   IGP, using the IGP LSDB.  No distinction is made between the type of
computation performed, e.g., full SPF, incremental SPF, or Partial Route
Computation (PRC); the type of computation is a local consideration. This
document may interchangeably use the terms "routing table computation" and "SPF
computation".</t>

<t>SPF_DELAY: The delay between the first IGP event triggering a new routing table computation and the start of that routing table computation. It can take the following values:<list style="hanging" hangIndent="1">

<t>INITIAL_SPF_DELAY: A very small delay to quickly handle a single isolated link failure, e.g., 0 milliseconds.</t>

<t>SHORT_SPF_DELAY: A small delay to provide fast convergence in the case of a
single component failure (such as a node failure or Shared Risk Link Group
(SRLG) failure) that leads to multiple IGP events, e.g., 50-100 milliseconds.</t>

<t>LONG_SPF_DELAY: A long delay when the IGP is unstable, e.g., 2 seconds. Note that this allows the IGP network to stabilize.</t>

</list><vspace blankLines="1" /></t>

<t>TIME_TO_LEARN_INTERVAL: This is the maximum duration typically needed to
learn all the IGP events related to a single component failure (such as router
failure or SRLG failure), e.g., 1 second. It's mostly dependent on failure
detection time variation between all routers that are adjacent to the
failure. Additionally, it may depend on the different IGP implementations/parameters
across the network and their relation to the origination and flooding of link
state advertisements.</t>
<t>HOLDDOWN_INTERVAL: The time required with no received IGP event before considering the IGP to be stable again and allowing the SPF_DELAY to be restored to INITIAL_SPF_DELAY, e.g., a HOLDDOWN_INTERVAL of 3 seconds. The HOLDDOWN_INTERVAL MUST be defaulted or configured to be longer than the TIME_TO_LEARN_INTERVAL.</t>

    </section>
        
    <section anchor="Principles" title="Principles of the SPF Delay Algorithm">

<t>For the first IGP event, we assume that there has been a single simple
change in the network, which can be taken into account using a
single routing computation (e.g., link failure, prefix (metric) change), 
and we optimize for very fast convergence by delaying the initial routing
computation for a small interval, INITIAL_SPF_DELAY. Under this assumption, 
there is no benefit in delaying the routing computation. In a typical network, this is the most common type of IGP event. Hence, it makes sense to optimize this case.</t>

<t>If subsequent IGP events are received in a short period of time
(TIME_TO_LEARN_INTERVAL), we then assume that a single component failed, but
that this failure requires the knowledge of multiple IGP events in order for
IGP routing to converge. Under this assumption, we want fast convergence since
this is a normal network situation. 
   However, there is a benefit in waiting for all IGP events related to this
   single component failure: the IGP can then compute the post-failure routing
   table in a single additional route computation.
In this situation, we delay the routing computation by SHORT_SPF_DELAY.</t>

<t>If IGP events are still received after TIME_TO_LEARN_INTERVAL from the
initial IGP event received in QUIET state (see <xref target="FSM"/>), then the
network is presumably experiencing multiple independent failures. In this
case, while waiting for network stability, the computations are delayed for a
longer time, which is represented by LONG_SPF_DELAY. This SPF delay is used until no IGP events are received for HOLDDOWN_INTERVAL.</t>

<t>Note that in order to increase the consistency network wide, the algorithm uses a delay (TIME_TO_LEARN_INTERVAL) from the initial IGP event rather than the number of SPF computations performed. Indeed, as all routers may receive the IGP events at different times, we cannot assume that all routers will perform the same number of SPF computations. For example, assuming that the SPF delay is 50 milliseconds, router R1 may receive three IGP events (E1, E2, E3) in those 50 milliseconds and hence will perform a single routing computation, while another router R2 may only receive two events (E1, E2) in those 50 milliseconds and hence will schedule another routing computation when receiving E3.</t> 
    </section>
        
    <section anchor="Algo" title="Specification of the SPF Delay State Machine">

<t>This section specifies the Finite State Machine (FSM) intended to control the timing of the execution of SPF calculations in response to IGP events.</t>
	
            <section anchor="FSM" title="State Machine">
                <t>The FSM is initialized to the QUIET state with all three
		timers (SPF_TIMER, HOLDDOWN_TIMER, and LEARN_TIMER) deactivated.</t>
				<t> The events that may change the FSM states
				are an IGP event or the expiration of one
				timer (SPF_TIMER, HOLDDOWN_TIMER, or LEARN_TIMER).</t>
				<t> The following diagram briefly describes the state transitions.</t>
                
<figure anchor="FSM-Figure" title="State Machine">
<artwork align="center"><![CDATA[
          +-------------------+
    +---->|                   |<-------------------+
    |     |      QUIET        |                    |
    +-----|                   |<---------+         |
7:        +-------------------+          |         |
SPF_TIMER           |                    |         |
expiration          |                    |         |
                    | 1: IGP event       |         |
                    |                    |         |
                    v                    |         |
          +-------------------+          |         |
    +---->|                   |          |         |
    |     |    SHORT_WAIT     |----->----+         |
    +-----|                   |                    |
2:        +-------------------+  6: HOLDDOWN_TIMER |
IGP event           |               expiration     |
8: SPF_TIMER        |                              |
   expiration       |                              |
                    | 3: LEARN_TIMER               |
                    |    expiration                |
                    |                              |
                    v                              |
          +-------------------+                    |
    +---->|                   |                    |
    |     |     LONG_WAIT     |------------>-------+
    +-----|                   |
4:        +-------------------+  5: HOLDDOWN_TIMER
IGP event                           expiration
9: SPF_TIMER expiration
]]></artwork></figure>
            </section>

            <section anchor="State" title="States">
                
                <t> The naming and semantics of each state corresponds directly to the SPF delay used for IGP events received in that state. Three states are defined:</t>
                
                <t>QUIET: This is the initial state, when no IGP events have occurred for at least HOLDDOWN_INTERVAL since the last routing table computation. The state is meant to handle link failures very quickly.</t>
                <t>SHORT_WAIT: This is the state entered when an IGP event has
		been received in QUIET state. This state is meant to handle a single component failure requiring multiple IGP events (e.g., node, SRLG).</t>
                <t>LONG_WAIT: This is the state reached after
		TIME_TO_LEARN_INTERVAL in state SHORT_WAIT. This state is meant to handle multiple independent component failures during periods of IGP instability.</t>
            </section>


            <section anchor="Timers" title="Timers">

			<t>SPF_TIMER: This is the FSM timer that uses the computed SPF delay. Upon expiration, the routing table computation (as defined in <xref target="Definitions"/>) is performed. </t>
			
			<t>HOLDDOWN_TIMER: This is the FSM timer that is (re)started when an IGP event is received and set to HOLDDOWN_INTERVAL. Upon expiration, the FSM is moved to the QUIET state.</t>
			
			<t>LEARN_TIMER: This is the FSM timer that is started when an IGP event is received while the FSM is in the QUIET state. Upon expiration, the FSM is moved to the LONG_WAIT state. </t>
			
			</section>



            <section anchor="Events" title="FSM Events">
                <t>This section describes the events and the actions performed in response.</t>
                <t>Transition 1: IGP event while in QUIET state</t>
                <t>Actions on event 1:<list style="symbols">
                <t>If SPF_TIMER is not already running, start it with value INITIAL_SPF_DELAY.</t>
                <t>Start LEARN_TIMER with TIME_TO_LEARN_INTERVAL.</t>
                <t>Start HOLDDOWN_TIMER with HOLDDOWN_INTERVAL.</t>
                <t>Transition to SHORT_WAIT state.</t>
                </list><vspace blankLines="1"/></t>
                                
                <t>Transition 2: IGP event while in SHORT_WAIT</t>
                <t>Actions on event 2:<list style="symbols">
                <t>Reset HOLDDOWN_TIMER to HOLDDOWN_INTERVAL.</t>
                <t>If SPF_TIMER is not already running, start it with value
		SHORT_SPF_DELAY.</t>
                <t>Remain in current state.</t>
                </list><vspace blankLines="1"/></t>
                
                <t>Transition 3: LEARN_TIMER expiration</t>
                <t>Actions on event 3:<list style="symbols">
                <t>Transition to LONG_WAIT state.</t>
                </list><vspace blankLines="1"/></t>
                
                <t>Transition 4: IGP event while in LONG_WAIT</t>
                <t>Actions on event 4:<list style="symbols">
                <t>Reset HOLDDOWN_TIMER to HOLDDOWN_INTERVAL.</t>
                <t>If SPF_TIMER is not already running, start it with value
		LONG_SPF_DELAY.</t>
                <t>Remain in current state.</t>
                </list><vspace blankLines="1"/></t>
                
                <t>Transition 5: HOLDDOWN_TIMER expiration while in LONG_WAIT</t>
                <t>Actions on event 5:<list style="symbols">
                <t>Transition to QUIET state.</t>               
                </list><vspace blankLines="1"/></t>
                
                <t>Transition 6: HOLDDOWN_TIMER expiration while in SHORT_WAIT</t>
                <t>Actions on event 6:<list style="symbols">
                <t>Deactivate LEARN_TIMER.</t>
                <t>Transition to QUIET state.</t>               
                </list><vspace blankLines="1"/></t>

                <t>Transition 7: SPF_TIMER expiration while in QUIET</t>
                <t>Actions on event 7:<list style="symbols">
                <t>Compute SPF.</t>
		<t>Remain in current state.</t>
                </list><vspace blankLines="1"/></t>

                <t>Transition 8: SPF_TIMER expiration while in SHORT_WAIT</t>
                <t>Actions on event 8:<list style="symbols">
                <t>Compute SPF.</t>
		<t>Remain in current state.</t>
                </list><vspace blankLines="1"/></t>
                
                <t>Transition 9: SPF_TIMER expiration while in LONG_WAIT</t>
                <t>Actions on event 9:<list style="symbols">
                <t>Compute SPF.</t>
		<t>Remain in current state.</t>
                </list><vspace blankLines="1"/></t>
                </section>

        </section>
        
        <section anchor="Parameters" title="Parameters">

<t>All the parameters MUST be configurable at the protocol instance level.
They MAY be configurable on a per IGP LSDB basis (e.g., IS-IS level, OSPF area, 
or IS-IS Level 1 area).  All
the delays (INITIAL_SPF_DELAY, SHORT_SPF_DELAY, LONG_SPF_DELAY,
TIME_TO_LEARN_INTERVAL, and HOLDDOWN_INTERVAL) SHOULD be configurable with a
granularity of a millisecond.  They MUST be configurable with a granularity of
at least a tenth of a second. The configurable range for all the parameters
SHOULD be from 0 milliseconds to at least 6000 milliseconds. The HOLDDOWN_INTERVAL
MUST be defaulted or configured to be longer than the TIME_TO_LEARN_INTERVAL.
</t>


<?rfc subcompact="yes"?>
<t>If this SPF Back-Off algorithm is enabled by default, then in order to have
consistent SPF delays between implementations with default configuration, the
following default values SHOULD be implemented: 
<figure><artwork>
   INITIAL_SPF_DELAY         50 ms
   SHORT_SPF_DELAY          200 ms
   LONG_SPF_DELAY          5000 ms
   TIME_TO_LEARN_INTERVAL   500 ms
   HOLDDOWN_INTERVAL      10000 ms
</artwork></figure>
</t>

<?rfc subcompact="no"?>

<t>In order to satisfy the goals stated in <xref target="Goals"/>, operators are RECOMMENDED to configure delay intervals such that INITIAL_SPF_DELAY &lt;= SHORT_SPF_DELAY and SHORT_SPF_DELAY &lt;= LONG_SPF_DELAY.</t>

<t>When setting (default) values, one should consider the customers and their
application requirements, the computational power of the routers, the size of
the network as determined primarily by the number of IP prefixes advertised in
the IGP, the frequency and number of IGP events, and the number of protocol
reactions/computations triggered by IGP SPF computation (e.g., BGP, Path
Computation Element Communication Protocol (PCEP), Traffic Engineering
Constrained SPF (CSPF), and Fast Reroute computations). Note that
some or all of these factors may change over the life of the network. In case
of doubt, it's RECOMMENDED that timer intervals should be chosen conservatively (i.e., longer timer values).</t>

<t>For the standard algorithm to be effective in mitigating micro-loops, it is RECOMMENDED that all routers in the IGP domain, or at least all the routers in the same area/level, have exactly the same configured values.</t>
        </section>
       
	   <section anchor="Partial_Deployment" title="Partial Deployment">
	   
	  <t>In general, the SPF Back-Off Delay algorithm is only effective in mitigating micro-loops 
      if it is deployed with the same parameters on all routers in the IGP domain or, at least, all routers in an 
      IGP area/level. The impact of partial deployment is dependent on the particular event, 
      the topology, and the algorithm(s) used on other routers in the IGP area/level. 
      In cases where the previous SPF Back-Off Delay algorithm was implemented uniformly, partial
      deployment will increase the frequency and duration of micro-loops. Hence, it is 
      RECOMMENDED that all routers in the IGP domain, or at least within the same
      area/level, be migrated to the SPF algorithm described herein at roughly the 
      same time.</t>
<t>Note that this is not a new consideration; over time, network operators
have changed SPF delay parameters in order to accommodate new customer
requirements for fast convergence, as permitted by new software and
hardware. They may also have progressively replaced an implementation using a
given SPF Back-Off Delay algorithm with another implementation using a
different one.</t>

	   
	   </section>
       
        <section anchor="Impact" title="Impact on Micro-loops">

   <t>Micro-loops during IGP convergence are due to a non-synchronized or
   non-ordered update of FIBs <xref target="RFC5715"></xref> <xref
   target="RFC6976"></xref> <xref target="SPF-MICRO"></xref>. FIBs are installed
   after multiple steps, such as flooding of the IGP event across the network,
   SPF wait time, SPF computation, FIB distribution across line cards, and FIB
   update. This document only addresses the contribution from the SPF wait
   time. This standardized procedure reduces the probability and/or duration
   of micro-loops when IGPs experience multiple temporally close events. 
   It does not prevent all
   micro-loops; however, it is beneficial and is less complex and costly
   to implement when compared to full solutions such as Distributed Tunnels
   <xref target="RFC5715"/>, Synchronized FIB Update <xref target="RFC5715"/>, or
   the ordered FIB approach <xref target="RFC6976"/>.</t>
        </section>
        
    <section anchor="IANA" title="IANA Considerations">
      <t>This document has no IANA actions.</t>
    </section>

        <section anchor="Security" title="Security Considerations">
      <t>The algorithm presented in this document does not compromise IGP security. An attacker having the ability to generate IGP events would be able to delay the IGP convergence time.
          The LONG_SPF_DELAY state may help mitigate the effects of Denial-of-Service (DoS) attacks generating many IGP events.</t>
    </section>

  </middle>

  <back>
    <references title="Normative References">
          
          <?rfc include="reference.RFC.2119"?>
          <?rfc include="reference.RFC.8174"?>

    </references>
  <references title="Informative References">
    <?rfc include="reference.RFC.2328"?>
    <?rfc include="reference.RFC.5340"?>
    <?rfc include="reference.RFC.3209"?>
    <?rfc include="reference.RFC.4271"?>

<!--draft-ietf-rtgwg-spf-uloop-pb-statement-06: I-D Updated to -07 -->

<reference anchor='SPF-MICRO'>
<front>
<title>Link State protocols SPF trigger and delay algorithm impact on IGP micro-loops</title>

<author initials='S' surname='Litkowski' fullname='Stephane Litkowski'>
    <organization />
</author>

<author initials='B' surname='Decraene' fullname='Bruno Decraene'>
    <organization />
</author>

<author initials='M' surname='Horneffer' fullname='Martin Horneffer'>
    <organization />
</author>

<date month='May' year='2018' />

<abstract><t>A micro-loop is a packet forwarding loop that may occur transiently among two or more routers in a hop-by-hop packet forwarding paradigm.  In this document, we are trying to analyze the impact of using different Link State IGP implementations in a single network, with respect to micro-loops.  The analysis is focused on the SPF delay algorithm.</t></abstract>

</front>

<seriesInfo name='Work in Progress,' value='draft-ietf-rtgwg-spf-uloop-pb-statement-07' />

</reference>


<?rfc include="reference.RFC.5036"?>
<?rfc include="reference.RFC.5286"?>
<?rfc include="reference.RFC.5715"?>
<?rfc include="reference.RFC.6976"?>

          <reference anchor="ISO10589"><front>
	    <title>Information technology -- Telecommunications and information exchange between
	    systems -- Intermediate System to Intermediate System intra-domain routeing
	    information exchange protocol for use in conjunction with the protocol for
	    providing the connectionless-mode network service (ISO 8473)</title>
<author>
  <organization abbrev="ISO">International Organization for Standardization</organization>
</author>
  <date month="November" year="2002"/></front>
<seriesInfo name="ISO/IEC" value="10589:2002, Second Edition"/>

        </reference>
        </references>

        <section anchor="acknowledgements" title="Acknowledgements" numbered="no">
      <t>We would like to acknowledge Les Ginsberg, Uma Chunduri, Mike Shand,
      and Alexander Vainshtein for the discussions and comments related to
      this document.</t>
	</section>

  </back>
</rfc>
	
