<?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="no"?>
<!-- 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-gomez-lpwan-rto-considerations-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="RTO in LPWAN">
    RTO considerations in LPWAN
    </title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->
 
    <author fullname="Carles Gomez" initials="C.G" surname="Gomez">
      <organization>UPC</organization>

      <address>
        <postal>
          <street>C/Esteve Terradas, 7</street>

          <city>Castelldefels</city>

          <region/>

          <code>08860</code>

          <country>Spain</country>
        </postal>

        <phone/>

        <facsimile/>

        <email>carlesgo@entel.upc.edu</email>

        <uri/>
      </address>
    </author>

    <author fullname="Jon Crowcroft" initials="J.C" surname="Crowcroft">
      <organization>University of Cambridge</organization>

      <address>
        <postal>
          <street>JJ Thomson Avenue</street>

          <city>Cambridge</city>

          <region>CB3 0FD</region>

          <code/>

          <country>United Kingdom</country>
        </postal>

        <phone/>

        <facsimile/>

        <email>jon.crowcroft@cl.cam.ac.uk</email>

        <uri/>
      </address>
    </author>

    
    <!-- uri and facsimile elements may also be added -->

    <date month="July" year="2019"/>

    <!-- 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>INT</area>

<!--    <workgroup>LWIG Working Group</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. -->

    <!---->

    <abstract>
      <t> Low-Power Wide Area Network (LPWAN) technologies are characterized by very low physical layer bit and message transmission rates. Moreover, a response to a message sent by an LPWAN device may often only be received after a significant delay. As a result, Round-Trip Time (RTT) values in LPWAN are often (sometimes, significantly) greater than typical default values of Retransmission TimeOut (RTO) algorithms. Furthermore, buffering at network elements such as radio gateways may interact negatively with LPWAN technology transmission mechanisms, potentially exacerbating RTTs by up to several orders of magnitude. This document provides guidance for RTO settings in LPWAN, and describes an experimental dual RTO algorithm for LPWAN.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction ">

      <t>Low-Power Wide Area Network (LPWAN) technologies offer appealing features, such as multikilometer wireless link range, while allowing low energy consumption for Internet of Things (IoT) devices. However, these advantages come at the expense of reduced physical layer (PHY) bit and message rates, which in some regions are further affected by spectrum access regulatory constraints. In some LPWAN scenarios, with flagship LPWAN technologies such as LoRaWAN or Sigfox, PHY bit rates are lower than 1 kbit/s, and uplink message rates are lower than 1 message/minute <xref target="RFC8376"/>.</t>
 
      <t>Due to the aforementioned communication constraints, LPWAN technologies often exhibit high or very high Round Trip Times (RTTs). Even with negligible processing delays and in absence of communication errors, RTTs can be in the order of a few seconds or a few tens of seconds. Depending on the approach used to comply with spectrum access regulations, RTTs can grow to several minutes. Finally, when downlink responses are buffered in the radio gateway, RTTs will be in the order of the time between uplink messages (e.g. hours, if that is the time between two consecutive uplink messages).</t>

      <t>The described RTTs, as well as their potential variability, are significantly greater than typical ones on the Internet. 
         In TCP, the default RTO used to be 3 seconds and was reduced to 1 second <xref target="RFC7414"/>. In a similar order, the 
         Constrained Application Protocol (CoAP), which is the preferred application-layer protocol for IPv6-based LPWAN, has a default RTO randomly chosen between 2 and 3 seconds <xref target="RFC7252"/>. 
         At the adaptation layer between IPv6 and the LPWAN technology, some of the Static Context Header Compression (SCHC) fragmentation modes also use RTOs, which need to be defined suitably for each LPWAN technology <xref target="I-D.ietf-lpwan-ipv6-static-context-hc"/>.</t>

      <t>This document provides guidance for suitable RTO configuration and/or usage in LPWAN. First, the document characterizes the RTT for LoRaWAN and Sigfox in absence of communication errors, buffering delays or processing delays. Second, higher order RTTs are described, capturing the impact of message rate limitations due to regulatory constraints and radio gateway buffering delays. Finally, the document discusses suitable RTO settings in LPWAN, and describes an experimental LPWAN-specific dual RTO algorithm.</t>

    </section>
 
      <section title="Conventions used in this document">
        <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"/>.</t>
      </section>


  <section title="Ideal scenario RTT">
      
      <t>This section provides an analysis of the RTT for relevant LPWAN technologies, such as LoRaWAN and Sigfox, assuming ideal conditions
         (i.e. no losses, as well as negligible buffering and processing delay). For detailed descriptions of LoRaWAN and Sigfox, the reader 
         may refer to the literature <xref target="RFC8376"/><xref target="LoRaWAN"/><xref target="Sigfox"/>.</t>
      
      <t>In the analysis, the RTT comprises the time since the start of the transmission of an uplink message by an IoT device until a response is completely received by the IoT device.           A 4-byte SCHC-compressed IPv6/UDP/CoAP packet is assumed for the downlink response. Of course, larger sized packets will lead to greater RTTs.</t> 
      
    <section title="LoRaWAN">

      <t><xref target="fig_table_LoRaWAN"/> shows the minimum and maximum theoretical RTT values for LoRaWAN in the EU band in ideal conditions. For the minimum ones, we assume a 4-byte uplink frame payload, and a downlink response sent in the first receive window. For the maximum ones, we assume the maximum allowed uplink payload size for each Data Rate (DR), and a downlink response sent in the second receive window. Note that there is a 1- or 2-second delay between the uplink transmission and the first or second receive window, respectively.</t>
    
      <figure title="Minimum and maximum RTT values for LoRaWAN in the EU, without losses, and in absence of buffering delay and processing delay."
                anchor="fig_table_LoRaWAN">
        <artwork><![CDATA[    
          +------------------------+
          |         Maximum        |   
     +----+--------+-------+-------+------+------+
     | DR | Ulpld  | TtxUL | TtxDL |RTTmin|RTTmax|
     +----+--------+-------+-------+------+------+
     |  0 |   51   | 2.79  |  0.99 | 4.52 | 5.81 |
     +----+--------+-------+-------+------+------+
     |  1 |   51   | 1.56  |  0.58 | 2.99 | 4.15 |
     +----+--------+-------+-------+------+------+ 
     |  2 |   51   | 0.70  |  0.29 | 1.92 | 3.00 |
     +----+--------+-------+-------+------+------+ 
     |  3 |  115   | 0.68  |  0.14 | 1.73 | 2.82 |
     +----+--------+-------+-------+------+------+ 
     |  4 |  242   | 0.70  |  0.07 | 1.66 | 2.78 |
     +----+--------+-------+-------+------+------+ 
     |  5 |  242   | 0.40  |  0.04 | 1.37 | 2.44 |
     +----+--------+-------+-------+------+------+ 
     |  6 |  242   | 0.20  |  0.02 | 1.19 | 2.22 |
     +----+--------+-------+-------+------+------+ 
     |  7 |  242   | 0.04  |  0.003| 1.00 | 2.05 |
     +----+--------+-------+-------+------+------+ 
 
     ULpld:    uplink frame payload, in bytes
     TtxUL:    uplink frame transmission time, in seconds
     TtxDL:    downlink frame transmission time, in seconds
     RTTmin:   minimum RTT, in seconds
     RTTmax:   maximum RTT, in seconds

        ]]></artwork></figure>


     <t>As shown in <xref target="fig_table_LoRaWAN"/>, and under the conditions assumed, the minimum RTT value for DR0 will always (for DR1, will almost always) exceed the default CoAP RTO. The maximum RTT will always exceed the default CoAP RTO for DR0-DR2, and will often exceed the default CoAP RTO for DR3-DR7. Note that since DR6 and DR7 are optional, they are not necessarily supported in real deployments.</t>

    </section>

    <section title="Sigfox">

      <t><xref target="fig_table_Sigfox"/> shows the minimum and maximum theoretical RTT values for Sigfox in ideal conditions. For the minimum ones, we assume a 4-byte uplink 
         frame payload, and a downlink response sent right at the beginning of the downlink receive window. For the maximum ones, we assume the maximum 
         allowed uplink payload size, and a downlink response sent at the end of the receive window. Note that there is a 20-second delay between 
         the frame uplink transmission and the start of the downlink receive window. </t>

      <figure title="Minimum and maximum RTT values for Sigfox, without losses, and in absence of buffering delay and processing delay."
                anchor="fig_table_Sigfox">
        <artwork><![CDATA[    
            +------------------------+      
            |         Maximum        |
      +-----+--------+-------+-------+------+------+
      |UL BR|  Ulpld | TtxUL | TtxDL |RTTmin|RTTmax|
      +-----+--------+-------+-------+------+------+   
      | 100 |   12   | 2.08  |  0.39 | 21.8 | 47.1 |
      +-----+--------+-------+-------+------+------+
      | 600 |   12   | 0.35  |  0.39 | 20.6 | 45.4 |
      +-----+--------+-------+-------+------+------+ 

     UL BR:    uplink bit rate, in bit/s 
     ULpld:    uplink frame payload, in bytes
     TtxUL:    uplink frame transmission time, in seconds
     TtxDL:    downlink frame transmission time, in seconds
     RTTmin:   minimum RTT, in seconds
     RTTmax:   maximum RTT, in seconds
 
         ]]></artwork></figure>     


      <t>
         As shown in <xref target="fig_table_Sigfox"/>, and under the conditions assumed, the RTT in Sigfox will be one order of magnitude greater than the default CoAP RTO for all uplink bit rates and uplink frame payload sizes.
      </t>

     

    </section>
  </section>

    <section title="Higher order RTT">

     <t>The high RTTs found in ideal conditions can be further exacerbated by two further behaviours of LPWAN networks: i) policies for compliance with duty cycle constraints, and ii) radio gateway buffering delays.</t>

     <t>EU spectrum access regulations for some ISM bands used by LPWAN technologies state that, unless listen-before-talk is used, the duty cycle needs to be lower than some limit (e.g. 1% in some frequency bands). Both LoRaWAN and Sigfox need to comply with such regulations. There may be different applicable policies intended to ensure compliance with the regulations. In one of them, in order to comply with the 1% duty cycle limitation, after sending an uplink frame, an IoT device keeps an idle period equal to 99 times the transmission time of the uplink frame. Such a policy may increase the RTT by up to two orders of magnitude. For example, in LoRaWAN, this policy leads to RTTs that will always exceed the default CoAP RTO, leading to an RTT of up to 282 seconds in the worst case.</t>

     <t>Another phenomenon that may happen in LPWAN relates with the fact that in some technologies and scenarios (e.g. the most typical LoRaWAN class, called class A, and in Sigfox), a downlink frame can only be sent during a given time interval (called receive window) after the uplink frame transmission. If a radio gateway misses the opportunity to send a downlink response to an uplink frame (e.g. because the radio gateway is busy sending other downlink messages or because it needs to refrain from transmitting immediately in order to comply with duty cycle regulations), the response to an uplink frame may be queued by the radio gateway until the next opportunity for sending a downlink frame. This problem has already been described in <xref target="I-D.toutain-core-time-scale"/>. If the problem occurs, the RTT will be tied to the time between two uplink consecutive frames. Depending on the application and its traffic pattern, such time may take values in the order of seconds, minutes, hours or even days.</t> 

   
    </section>

    <section title="Discussion and proposed dual RTO algorithm">

      <t>The RTO needs to be greater than the RTT in order to avoid spurious timeouts. The latter are particularly expensive in LPWAN due to the
         message rate constraints in these networks, and also since they consume energy unnecessarily. However, as stated in <xref target="I-D.ietf-tcpm-rto-consider"/>, 
         "each implementation of a retransmission timeout mechanism represents a balance between correctness and timeliness and therefore no implementation suits all situations".
      </t>

      <t>If delay is not relevant for an application, setting the default RTO to at least the highest frequently expected RTT, denoted HIGH_RTT, may be a suitable approach.</t>

      <t>The problem arises when delay, even if at LPWAN scales, matters, and higher order RTTs (Section 3) are expected in addition to the ideal scenario ones (Section 2). At the very least, the default RTO needs to be greater than the corresponding ideal scenario RTT value shown in Section 2. If higher order RTTs are expected, one option is using a simple dual RTO approach as follows. </t>

      <t>The LPWAN device keeps two RTO instances. One instance (called Low RTO) is initialized to a suitable ideal scenario RTT, denoted LOW_RTT. 
         The other instance (called High RTO) is initialized to a value of at least HIGH_RTT. The dual RTO operates as follows (see <xref target="fig_states_dual_RTO"/>): </t>

      <t><list style="symbols">

          <t>Initially, the LPWAN device uses the High RTO.</t>

          <t>When the device uses the High RTO, after N_THRESH_LOW consecutive RTT samples lower than THRESH_LOW_RTT, the device switches to using the Low RTO.</t>

          <t>When the device uses the Low RTO, after N_THRESH_HIGH consecutive RTT samples greater than THRESH_HIGH_RTT, the device switches back to using the High RTO.</t>

         </list></t>

      <figure title="State machine of the dual RTO algorithm."
                anchor="fig_states_dual_RTO">
        <artwork><![CDATA[    
                         
                                +----------+
                           +--->| High RTO |----+
                           |    +----------+    |
   if N_THRESH_HIGH        |                    | if N_THRESH_LOW 
   consecutive RTT samples |                    | consecutive RTT samples  
    > THRESH_HIGH_RTT      |                    |  < THRESH_LOW_RTT
                           |    +----------+    |
                           +----|  Low RTO |<---+
                                +----------+

 
         ]]></artwork></figure> 

          <t>The above described dual RTO algorithm may be applied to different RTO approaches, such as a constant RTO, a constant but dithered RTO
              (e.g. as in default CoAP), an adaptive RTO algorithm (e.g. as in TCP or CoCoA <xref target="I-D.ietf-core-cocoa"/>), etc. If an adaptive RTO is used, performance will benefit
              from separating lower RTT and higher RTT regimes, avoiding inaccuracy due to a too high RTT variance. Note that the phenomena described in
              Section 3 are expected to yield systematically large step function RTT distributions. These deviate significantly from the roughly normal/gaussian
              RTT statistics assumed by the TCP RTO algorithm. </t>

          <t>Further refinement of the mechanism, to be discussed.</t>
    </section>  

    <section anchor="Security" title="Security Considerations">

      <t>TBD</t>

    </section>

    <!-- This PI places the pagebreak correctly (before the section title) in the text output. -->

    <!-- Possibly a 'Contributors' section ... -->
    
    <section anchor="ACKs" title="Acknowledgments">

      <t>Carles Gomez has been funded in part by the Spanish Government (Ministerio de Ciencia, Innovacion y Universidades) through the Jose Castillejo grant CAS18/00170
         and by European Regional Development Fund (ERDF) and the Spanish Government through project TEC2016-79988-P, AEI/FEDER, UE. 
         His contribution to this work has been carried out during his stay as a visiting scholar at the Computer Laboratory of the University of Cambridge.</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="Normative References">

      <?rfc include='reference.RFC.2119.xml'?>

    </references>

    <references title="Informative References">
      <!-- Here we use entities that we defined at the beginning. -->

      <?rfc include='reference.RFC.7252.xml'?>

      <?rfc include='reference.RFC.7414.xml'?>

      <?rfc include='reference.RFC.8376.xml'?>     

      <?rfc include='reference.I-D.toutain-core-time-scale'?>

      <?rfc include='reference.I-D.ietf-tcpm-rto-consider'?>

      <?rfc include='reference.I-D.ietf-core-cocoa'?>

      <?rfc include='reference.I-D.ietf-lpwan-ipv6-static-context-hc'?>

      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->
     <reference anchor="LoRaWAN">
        <front>
            <title>Modeling the Energy Performance of LoRaWAN</title>
            <author>
            <organization>L. Casals, B. Mir, R. Vidal, C. Gomez</organization>
            </author>
            <date year="2017" month="Sensors, October"/>
        </front>
     </reference>

     <reference anchor="Sigfox">
        <front>
            <title>A Sigfox Energy Consumption Model</title>
            <author>
            <organization>C. Gomez, J.C. Veras, R. Vidal, L. Casals, J. Paradells</organization>
            </author>
            <date year="2019" month="Sensors, February"/>
        </front>
     </reference>
    
    </references>

    <!-- -->
  </back>
</rfc>