<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
  <header>
    <title>Mobile Considerations on LTE Networks</title>
    <abstract>
      This document provides background information for XMPP implementors
      concerned with mobile devices operating on an LTE cellular network.
    </abstract>
    
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.</permissions>
<warranty>## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##</warranty>
<liability>In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.</liability>
<conformance>This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
    <number>0286</number>
    <status>Active</status>
    <lastcall>2017-11-15</lastcall>
    <type>Informational</type>
    <sig>Standards</sig>
    <approver>Council</approver>
    <dependencies>
      <spec>XMPP Core</spec>
    </dependencies>
    <supersedes/>
    <supersededby/>
    <shortname>NOT_YET_ASSIGNED</shortname>
    
    <author>
      <firstname>Dave</firstname>
      <surname>Cridland</surname>
      <email>dave@hellopando.com</email>
      <jid>dwd@dave.cridland.net</jid>
    </author>

    
  <author>
    <firstname>Sam</firstname>
    <surname>Whited</surname>
    <email>sam@samwhited.com</email>
    <jid>sam@samwhited.com</jid>
    <uri>https://blog.samwhited.com/</uri>
  </author>

    <revision>
      <version>1.0.0</version>
      <date>2018-01-25</date>
      <initials>XEP Editor (jwi)</initials>
      <remark><p>Advance to Active as per Council vote on 2018-01-10.</p></remark>
    </revision>
    <revision>
      <version>0.4.1</version>
      <date>2017-09-17</date>
      <initials>ssw</initials>
      <remark>
        <ul>
          <li>Minor editorial fixes.</li>
          <li>Remove reference to EXI which has no implementations.</li>
        </ul>
      </remark>
    </revision>
    <revision>
      <version>0.4.0</version>
      <date>2017-01-17</date>
      <initials>ssw</initials>
      <remark>
        <ul>
          <li>Attempt to fix some confusing paragraphs.</li>
          <li>Add Client State Indication to Notable Extensions.</li>
        </ul>
      </remark>
    </revision>
    <revision>
      <version>0.3</version>
      <date>2015-07-24</date>
      <initials>ssw</initials>
      <remark>
        <p>
          Include real world compression numbers and additional recommended
          reading.
        </p>
      </remark>
    </revision>
    <revision>
      <version>0.2</version>
      <date>2015-07-22</date>
      <initials>ssw</initials>
      <remark><p>Overhaul to include LTE.</p></remark>
    </revision>
    <revision>
      <version>0.1</version>
      <date>2010-09-15</date>
      <initials>psa</initials>
      <remark><p>Initial published version.</p></remark>
    </revision>
    <revision>
      <version>0.0.1</version>
      <date>2010-07-13</date>
      <initials>dwd</initials>
      <remark><p>First draft. Also John's birthday.</p></remark>
    </revision>
  </header>
  <section1 topic="Introduction" anchor="intro">
    <p>
      XMPP as a protocol was designed before the wide spread adoption of mobile
      devices, and is often cited as not being very mobile friendly as a result.
      However, this mostly stems from undocumented lore and outdated notions of
      how XMPP works. As the Internet and protocol design have changed to be
      more accommodating for mobile, so has XMPP.
    </p>
    <p>
      This XEP aims to provide useful background knowledge of mobile handset
      behavior, and those considerations that client and server designers can
      take to ensure that bandwidth and battery are used efficiently.
    </p>
  </section1>
  <section1 topic="Overview" anchor="overview">
    <p>
      The two major constraints on mobile devices are power and bandwidth.
      With the wide spread proliferation of 3G and LTE technologies, mobile
      bandwidth and speeds have become broadly comparable to broadband.
      However, they are still relatively expensive compared to traditional wired
      networks, and therefore conserving them is still desirable.
      This XEP mostly focuses on LTE as it already has a very wide deployment
      and will only continue to further replace 3G technologies.
    </p>
  </section1>

  <section1 topic="Compression" anchor="compression">
    <p>
      XML, and by extension XMPP, is known to be highly compressible.
      Compression of XMPP data can be achieved with the DEFLATE algorithm
      (<span class="ref"><link url="http://tools.ietf.org/html/rfc1951">RFC 1951</link></span> <note>RFC 1951: DEFLATE Compressed Data Format Specification version 1.3 &lt;<link url="http://tools.ietf.org/html/rfc1951">http://tools.ietf.org/html/rfc1951</link>&gt;.</note>) via TLS compression (<span class="ref"><link url="http://tools.ietf.org/html/rfc3749">RFC 3749</link></span> <note>RFC 3749: Transport Layer Security Protocol Compression Methods &lt;<link url="http://tools.ietf.org/html/rfc3749">http://tools.ietf.org/html/rfc3749</link>&gt;.</note>) or <span class="ref"><link url="https://xmpp.org/extensions/xep-0138.html">Stream Compression (XEP-0138)</link></span> <note>XEP-0138: Stream Compression &lt;<link url="https://xmpp.org/extensions/xep-0138.html">https://xmpp.org/extensions/xep-0138.html</link>&gt;.</note> (which also
      supports other compression algorithms).
      A description of the security implications of stream compression is beyond
      the scope of this document (See <span class="ref"><link url="http://tools.ietf.org/html/rfc3749">RFC 3749</link></span> <note>RFC 3749: Transport Layer Security Protocol Compression Methods &lt;<link url="http://tools.ietf.org/html/rfc3749">http://tools.ietf.org/html/rfc3749</link>&gt;.</note> or <span class="ref"><link url="https://xmpp.org/extensions/xep-0138.html">Stream Compression (XEP-0138)</link></span> <note>XEP-0138: Stream Compression &lt;<link url="https://xmpp.org/extensions/xep-0138.html">https://xmpp.org/extensions/xep-0138.html</link>&gt;.</note> for more
      information), but the author does not recommend using TLS compression with
      XMPP (or in general).
      If compression must be used, stream level compression should be
      implemented instead, and the compressed stream should have a full flush
      performed on stanza boundaries to help prevent chosen plaintext attacks.
      While this may mitigate some of the benefits of compression by raising
      compression ratios, in a large, real world deployment, network traffic was
      still observed to decrease by a factor of 0.58 when enabling <span class="ref"><link url="https://xmpp.org/extensions/xep-0138.html">Stream Compression (XEP-0138)</link></span> <note>XEP-0138: Stream Compression &lt;<link url="https://xmpp.org/extensions/xep-0138.html">https://xmpp.org/extensions/xep-0138.html</link>&gt;.</note>
      with ZLIB compression.
    </p>
    <p>
      While the CPU cost of compression may directly translate to higher power
      usage, it is vastly outweighed by the benefits of reduced network
      utilization, especially on modern LTE networks which use a great deal more
      power per bit than 3G networks as will be seen later in this document.
      However, CPU usage is also not guaranteed to rise due to compression.
      In the aforementioned deployment of stream compression, a
      <em>decrease</em> in CPU utilization by a factor of 0.60 was observed,
      presumably due to reductions in TLS and packet handling overhead.
      Therefore CPU time spent on compression (for ZLIB, at least; other
      algorithms were not tested) can be considered negligable.
    </p>
    <p>
      Supporting compression and performming a full flush on stanza boundaries
      is recommended for mobile devices.
    </p>
  </section1>
  <section1 topic="Power Consumption" anchor="power">
    <p>
      While the wide spread adoption of LTE has dramatically increased available
      bandwidth on mobile devices, it has also increased power consumption.
      According to one study, early LTE devices consumed 5–20% more power
      than their 3G counterparts <note>LTE Smartphone measurements &lt;<link url="https://web.archive.org/web/20160624043050/http://networks.nokia.com/system/files/document/lte_measurements_final.pdf">http://networks.nokia.com/system/files/document/lte_measurements_final.pdf</link>&gt;</note>.
      On some networks that support the legacy SVLTE (Simultaneous Voice and
      LTE) or CSFB (Circuit-switched fallback) instead of the more modern VoLTE
      (Voice Over LTE) standard, this number would (presumably) be even higher.
    </p>
    <p>
      XMPP server and client implementers, bearing this increased power usage in
      mind, and knowing a bit about how LTE radios work, can optimize their
      traffic to minimize network usage.
      For the downlink, LTE user equipment
      (UE) utilizes Orthogonal Frequency Division Multiplexing (OFDM), which is
      somewhat inefficient <note>A Close Examination of Performance and Power Characteristics of 4G LTE Networks &lt;<link url="https://doi.org/10.1145/2307636.2307658">doi:2307636.2307658</link>&gt;</note>.
      On the uplink side a different technology, Single-carrier frequency
      division multiple access (SC-FDMA) is used, which is slightly more
      efficient than traditional OFDM, slightly offsetting the fact that
      broadcasting requires more power than receiving.
      LTE UE also implements a Discontinuous reception (DRX) mode in which the
      hardware can sleep until it is woken by a paging message or is needed to
      perform some task.
      LTE radios have two power modes: RRC_CONNECTED and RRC_IDLE.
      DRX is supported in both of these power modes.
      By attempting to minimize the time which the LTE UE state machine spends
      in the RCC_CONNECTED state, and maximize the time it stays in the DRX
      state (for RCC_CONNECTED and RRC_IDLE), we can increase battery life
      without degrading the XMPP experience.
      To do so, the following rules should be observed:
    </p>
    <section2 topic="Transmit no data">
      <p>
        Whenever possible, data that is not strictly needed should not be
        transmitted (by the server or client).
        Supporting <span class="ref"><link url="https://xmpp.org/extensions/xep-0352.html">Client State Indication (XEP-0352)</link></span> <note>XEP-0352: Client State Indication &lt;<link url="https://xmpp.org/extensions/xep-0352.html">https://xmpp.org/extensions/xep-0352.html</link>&gt;.</note> is recommended.
        Most importantly, XMPP pings should be kept as far apart as possible and
        only used when necessary.
        Server operators are encouraged to set high ping timeouts, and client
        implementors are advised to only send pings when absolutely necessary to
        prevent the server from closing the socket.
      </p>
    </section2>
    <section2 topic="When transmitting, transmit as much as you can">
      <p>
        If one is on 3G, transmitting a small amount of data will cause the
        radio to enter FACH mode which is significantly cheaper than its high
        power mode.
        On LTE radios, however, transmitting small amounts of data is vastly
        more expensive per bit due to the higher tail-time (the time it takes
        for the radio to change state) of approximately 11 seconds<note>A Close Examination of Performance and Power Characteristics of 4G LTE Networks &lt;<link url="https://doi.org/10.1145/2307636.2307658">doi:2307636.2307658</link>&gt;</note>.
        On LTE radios, one should transmit as much data from the client as
        possible when the radio is already on (eg. by placing messages in a send
        queue and executing the queue as a batch when the radio is on).
        Similarly, when data is being received from the server, the mobile
        devices radio is already in a high power state and therefore any data
        that needs to be sent to the server should be transmitted.
      </p>
      <p>
        These rules also apply to server operators: If the server receives data,
        the phones radio is already on, therefore you should flush any pending
        data as soon as possible after receiving data from a client.
      </p>
    </section2>
  </section1>
  <section1 topic="Notable Extensions" anchor="xeps">
    <p>
      This section provides pointers to other documents which may be of interest
      to those developing mobile clients, or considering implementing
      optimizations for them in servers.
    </p>
    <p><span class="ref"><link url="https://xmpp.org/extensions/xep-0138.html">Stream Compression (XEP-0138)</link></span> <note>XEP-0138: Stream Compression &lt;<link url="https://xmpp.org/extensions/xep-0138.html">https://xmpp.org/extensions/xep-0138.html</link>&gt;.</note> provides stream level compression.</p>
    <p>
      <span class="ref"><link url="https://xmpp.org/extensions/xep-0115.html">Entity Capabilities (XEP-0115)</link></span> <note>XEP-0115: Entity Capabilities &lt;<link url="https://xmpp.org/extensions/xep-0115.html">https://xmpp.org/extensions/xep-0115.html</link>&gt;.</note> provides a mechanism for caching, and hence eliding, the
      disco#info requests needed to negotiate optional features.
    </p>
    <p>
      <span class="ref"><link url="https://xmpp.org/extensions/xep-0237.html">Roster Versioning (XEP-0237)</link></span> <note>XEP-0237: Roster Versioning &lt;<link url="https://xmpp.org/extensions/xep-0237.html">https://xmpp.org/extensions/xep-0237.html</link>&gt;.</note> provides a relatively widely deployed extension for reducing
      roster fetch sizes.
    </p>
    <p>
      <span class="ref"><link url="https://xmpp.org/extensions/xep-0198.html">Stream Management (XEP-0198)</link></span> <note>XEP-0198: Stream Management &lt;<link url="https://xmpp.org/extensions/xep-0198.html">https://xmpp.org/extensions/xep-0198.html</link>&gt;.</note> allows the client to send and receive smaller keep-alive
      messages, and resume existing sessions without the full handshake.
      This is useful on unstable connections.
    </p>
    <p>
      <span class="ref"><link url="https://xmpp.org/extensions/xep-0352.html">Client State Indication (XEP-0352)</link></span> <note>XEP-0352: Client State Indication &lt;<link url="https://xmpp.org/extensions/xep-0352.html">https://xmpp.org/extensions/xep-0352.html</link>&gt;.</note> allows clients to indicate to the server that they are inactive,
      allowing the server to optimize and reduce unnecessary traffic.
    </p>
    <p>
      <span class="ref"><link url="https://xmpp.org/extensions/xep-0357.html">Push Notifications (XEP-0357)</link></span> <note>XEP-0357: Push Notifications &lt;<link url="https://xmpp.org/extensions/xep-0357.html">https://xmpp.org/extensions/xep-0357.html</link>&gt;.</note> implements push notifications (third party message delivery),
      which are often used on mobile devices and highly optimized to conserve
      battery.
      Push notifications also allow delivery of notifications to mobile clients
      that are currently offline (eg. in an XEP-0198 "zombie" state).
    </p>
    <p>
      <span class="ref"><link url="https://xmpp.org/extensions/xep-0313.html">Message Archive Management (XEP-0313)</link></span> <note>XEP-0313: Message Archive Management &lt;<link url="https://xmpp.org/extensions/xep-0313.html">https://xmpp.org/extensions/xep-0313.html</link>&gt;.</note> lets clients fetch messages which they missed (eg. due to poor
      mobile coverage and a flaky network connection).
    </p>
  </section1>
  <section1 topic="Acknowledgements" anchor="acks">
    <p>
      This XEP was originally written by Dave Cridland, and parts of his
      original work were used in this rewrite.
      Thanks to Atlassian (HipChat) for allowing me to release numbers from
      their XMPP compression deployment.
    </p>
  </section1>
  <section1 topic="Security Considerations" anchor="security">
    <p>This document introduces no new security considerations.</p>
  </section1>
  <section1 topic="IANA Considerations" anchor="iana">
    <p>
      This document requires no interaction with the Internet Assigned Numbers
      Authority (IANA).
    </p>
  </section1>
  <section1 topic="XMPP Registrar Considerations" anchor="registrar">
    <p>
      No namespaces or parameters need to be registered with the XMPP Registrar
      as a result of this document.
    </p>
  </section1>
</xep>
