Network Working Group | G. Montenegro |
Internet-Draft | Microsoft |
Intended status: Informational | S. Cespedes |
Expires: January 9, 2017 | Universidad de Chile |
S. Loreto | |
Ericsson | |
R. Simpson | |
General Electric | |
July 8, 2016 |
H2oT: HTTP/2 for the Internet of Things
draft-montenegro-httpbis-h2ot-00
This document makes the case for HTTP/2 for IoT.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on January 9, 2017.
Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
When the IETF started work on the Internet-of-Things ("IoT") with the 6lowpan WG, it was clear that in addition to the lower-layer adaptation work for IPv6, much work elsewhere in the stack was necessary. (In this document, the "things" in "IoT" are nodes that are constrained in some manner--e.g., cpu, memory, power--such that direct use of unmodified mainstream protocols is challenging.) Once the IPv6 adaptation was understood, the next question was what protocols to use above IP(v6) for different functions and at different layers to have a complete stack. That question may not have a single answer that is always best for all scenarios and use cases. There are many such use cases, in accordance with the fact that IoT means too many things.
Accordingly, the IoT landscape includes a proliferation of options for any particular functionality (transport, encoding, security suites, authentication/authorization, etc). Different vendors and standards organizations (or fora) offer IoT solutions by grouping these different components into separate stacks. Even if the components have the same name or originate in the same original standard (or even in the same code base), each organization adapts it ever so slightly to their own goals, often rendering the resultant components non-interoperable. Many of these components are being created expressly for IoT (within the IETF and elsewhere) under the assumption that the mainstream options could not possibly be usable for IoT scenarios. This results in multiple disparate networking and software stacks. Given the incipient state of IoT, for the foreseeable future multiple competing stacks will continue to exist at least in gateways and cloud elements. The additional complexity to IoT amplifies the attack surface. Nevertheless, properly configured and implemented, mainstream options may not just be workable, but may even be the best option at least in some scenarios.
The appearance of one-off stacks (as opposed to a properly configured and adapted mainstream stack) is reminiscent of WAP 1.x, a complete vertical stack offered for phones as they were starting to access the Internet (albeit from within a walled garden) in the late 90's. At that time the IETF and the W3C started efforts to develop the mainstream alternatives. As a result, today no phone uses WAP. Instead, phone stacks are mainstream TCP/IP protocols (properly configured and adapted, of course). In contrast, today in IoT we see not just one non-mainstream stack, but several (as if we had not just WAP, but WAP1, WAP2, WAP3, etc.). And we may have to live with them for some time, but it is essential to ponder what the mainstream stack might look like if we are to eventually reap the benefits of a true Internet of Things instead of a not-quite-but-kinda-close-to-Internet-non-interoperable-hodge-podge-of-Things.
HTTP/2 [RFC7540][RFC7541] is now widely available as a transport option. Moreover, the ongoing effort to layer HTTP/2 over UDP (i.e., over QUIC) adds a useful capability for IoT scenarios. We show the current suitability of HTTP/2 for IoT scenarios and examine possible improvements.
Let's look at some application communication patterns to establish some common language (see also section 2 of [RFC7452] for a related discussion):
In the above, a "node" may, in fact, be multiple nodes when engaging in group communication. Group communications (e.g., via multicast) are commonly used for discovery or routing (see also Section 2.3).
We can further categorize the above communication patterns into two basic types of networking exchanges:
This document makes the case for HTTP/2 as the most general protocol of choice for Internet of Things applications. HTTP/2 is most at home in Internet scenarios and is also suitable for at least some Constrained network scenarios.
A recent survey by the Eclipse IoT working group queried IoT developers about the protocols and technologies they are using and planning to use [Eclipse_survey]. Some of the currently used application transport protocols (above the link layer) for IoT applications are as follows:
It is interesting to note that in the same survey done in 2015, HTTP/2 was not even present, whereas it is now at 19% (the other protocols are mostly unchanged). No doubt it is being used in scenarios where there are no major constraints (precisely where HTTP/1.x is also being used). Optimizing it for IoT can further promote its use. The sections below provide some more details on top-of-the-list protocols other than HTTP/2.
HTTP/1.1 is a text-based protocol, and is widely successful as it is the basis not just for the web, but for much non-web traffic in the internet today. Most (but not all) of the instances of HTTP today implement version 1.1 as specified in RFC2616 [RFC2616]. Since its publication back in 1999 it has evolved organically, producing countless variations and exceptions to its rules. Modern browser and server implementations have very complex and convoluted code to deal with parsing and handling the many nuances of the protocol. Because of all this confusion, the HTTPbis working group set out to clarify the existing specifications, and after a multi-year effort to clarify its many sources of confusion, it has published a cleaner specification in RFCs 7230-7235 [RFC7230] [RFC7231] [RFC7232] [RFC7233] [RFC7234] [RFC7235]. In spite of this, the protocol still has a plethora of legacy issues and remains too verbose.
HTTP/1.1 is very clearly a mismatch for the constrained devices and networks that characterize IoT. Despite its shortcomings, it is the most popular protocol for IoT applications (61% per the aforementioned survey, although the survey does not clarify if this is for Internet or constrained network scenarios). Why would such an ill-suited protocol be clearly the most popular for IoT applications? It is by far the most commonly known protocol. It has many implementations (many in open source), with massive support in all platforms, tools and APIs. It is easy to find know-how and support. In short, it has the power and convenience that comes with being a mainstream protocol.
Another major advantage is that it is the protocol that has the best chance of traversing firewalls and middle boxes in the internet due to its use of port 80 when in the clear, and, especially, its use of port 443 when over TLS. This is a primary concern in Internet scenarios.
MQ Telemetry Transport (MQTT) is a publish/subscribe messaging protocol that runs on top of TCP. It was created by IBM. Version 3.1.1 is available as an OASIS standard [mqtt_oasis] and as an ISO publication [mqtt_iso]. It is popular in the Internet scenario (node to cloud, gateway to cloud) and it aims to connect embedded devices and networks with applications and middleware. It is a compact, binary protocol, and is very popular in certain application domains. It has been known as a protocol suitable to be used in resource constrained devices and unreliable networks.
It is the second most popular protocol in the survey (behind HTTP/1.1) with 52% of developers using it. In the internet scenario, however, TLS is probably required. This additional TLS overhead renders all protocols slightly larger, so, e.g., MQTT loses some relative size advantage.
The MQTT protocol requires an underlying transport that provides an ordered, lossless, stream of bytes from the Client to Server and Server to Client. It cannot be used over UDP. There is an alternative (and not standardized) variant called MQTT-SN (previously called MQTT-S) which can use UDP, Zigbee or other datagram transports, but this is a substantially different protocol which has been tailored to meet the needs of small, battery-powered sensors connected by wireless sensor networks (WSNs), and relies upon a MQTT-SN Gateway or forwarder for external communications.
MQTT is closely tied to PUBLISH/SUBSCRIBE operations and this is the only mode of message transfer. This means that MQTT cannot be used for “node to node” communications because a server is required (the server forwards messages between publishers and subscribers, manages subscriptions, and performs user authorization functions.) The exclusive use of publish/subscribe operations can complicate some IoT operations, such as request-response traffic, and transferring large payloads (e.g. firmware updates). It is sometimes desirable to use a different protocol (like HTTP) for transferring large payloads, even though MQTT supports a maximum per-message payload size of 256 MiB. The OASIS MQTT-TC is considering proposals involving changes in handling request-response traffic and large message transfers.
MQTT is deployed over TCP (port 8833 when over TLS, port 1883 without TLS). Even when using TLS, it has the well-known firewall traversal issues common to any protocol not over port 443.
CoAP is a compact, binary, UDP-based protocol based on RESTful principles and closely patterned after HTTP. It has been designed to be used in constrained devices and constrained networks. The protocol specification has been published [RFC7252], although additional functionalities such as congestion control, block-wise transfer, TCP and TLS transfer and HTTP mapping are still being specified.
The protocol meets IoT requirements through the modification of some HTTP functionalities to achieve low-power consumption and operation over lossy links. To avoid undesirable packet fragmentation the CoAP specification provides an upper bound to the message size, dictating that a CoAP message, appropriately encapsulated, SHOULD fit within a single IP datagram:
CoAP interaction with HTTP must traverse a proxy, with the concomitant issues of breaking end-to-end security (Section 7), but at least the common REST architecture makes it easier.
CoAP works on port 5683 and offers optional reliable delivery (thru a retransmission mechanism), support for unicast and multicast, and asynchronous message exchange. Multicast (see Section 1 is typically used by IoT SDO's for routing and discovery. A common use of multicast within CoAP is for discovery, something addressed in mainstream (and even some IoT) scenarios via mDNS [RFC6762] and DNS-SD [RFC6763]. More general uses of multicast within CoAP (and, in general, at the application transport, e.g., to address group communication for IoT), introduces complexity for security, IPv6 scoping, wireless reliability, etc.
A typical CoAP message can be between 10 and 20 bytes.
It is the third most popular protocol in the survey with a 21% preference. Nevertheless, since CoAP is UDP-based, in the Internet scenario it also suffers from firewall traversal issues, verbosity (as compared to TCP) to maintain state in NAT boxes and lack of integration with existing enterprise infrastructures. There is ongoing work to specify the use of CoAP over TCP as well as CoAP over TLS, in an attempt to overcome issues with middleboxes and improve its applicability to Internet scenarios.
As noted above, there is much ongoing work on CoAP, and much of it seeks to define a transport on top of UDP. This is a very complex task not to be underestimated. QUIC is also embarking on this task, but it appears to be benefitting from many more resources within the networking community at large.
The aformentioned protocols have been compared in both experimental and emulated environments [IEEE_survey]. Previous reports show that performance is highly dependent on the network conditions: in good link conditions with low packet loss, MQTT delivers packets with lower delay than CoAP, but CoAP outperforms when high packet losses are present; in terms of packet sizes, if packet loss is under 25% and messages are of a small size, CoAP demonstrates a better link usage than MQTT. However, other experiments report a better performance of MQTT in high traffic/high packet loss scenarios [IoT_analysis]. CoAP has also been compared to HTTP/1.1. In terms of power consumption and response time, naturally CoAP behaves better than HTTP/1.1 thanks to the reduced packet sizes.
Coexistence among the protocols has also been tested with varied network configurations. For the most part, interaction of CoAP with HTTP has been studied [Web_things], demonstrating successful exchange when there is a CoAP server running on a constrained node and the HTTP client is requesting resources from it, or when there is a CoAP client requesting resources from an HTTP server. In both cases a proxy is necessary to enable translation between the protocols. Another network configuration with a CoAP client - CoAP proxy - CoAP server has been compared to the CoAP client - CoAP/HTTP proxy - HTTP server configuration, in which case the response times of the only-CoAP configuration resulted to be lower even when the number of concurrent requests increases [CoAP_integration].
To date, no reports have been found comparing MQTT or CoAP to HTTP/2.
These protocols often do not exist in a vacuum. Typically, they are mandated as part of a given stack specified by any of several IoT consortia (e.g., OCF, AllSeen Alliance/AllJoyn, Thread Group). We know that these multiple IoT protocols (and stacks) provide very useful sources of information for prying eyes (See “US intelligence chief says we might use the IoT to spy on you” at http://www.wired.com/2012/03/petraeus-tv-remote/). Security and privacy issues are exacerbated because:
The previous two points can be summarized as follows:
A recent Harvard report on the state of surveillance and erosion of privacy [Going_Dark] concludes among its findings that the projected substantial growth of IoT will drastically change surveillance (surveillance is not merely limited to government agencies of course), and that the fragmentation of ecosystems hinders the deployment of countermeasures (e.g., end-to-end encryption) as that requires more coordination and standardization than currently available. This not only gives rise to rogue surveillance sites such as Shodan (https://www.shodan.io/), but also represents a great opportunity for government agencies’ surveillance needs [Clapper].
Furthermore, multiple stacks defeat one of the main benefits of the “I” in IoT: interoperability. Also, reusing mainstream protocols affords the benefits of using better-known technology, with easier access to reference implementations (including open source), people with the required skills and experience, training, etc. These are basically the same arguments that were used originally to justify the use of IP-based networking over custom-built stacks. The message was heard loud and clear but for the most part it was applied to only a limited set of components (e.g., IP, UDP, DTLS). Other components are still being custom built (albeit, on top of IP).
As noted above, for the foreseeable future the IoT landscape requires several stacks. Thinking about a canonical stack based on mainstream protocols is not an exercise in the delusion that one single stack will be enough. Rather, it is an attempt to define an option that can serve IoT better into the future, and one that can be recommended whenever there is a choice (often there isn't one).
The goals in pursuing a canonical stack are the following:
To arrive at a canonical stack the mainstream standards-based stack must be properly profiled and optimized. This requires optimizing aspects such as:
This document deals only with the application layer transport based on HTTP/2.
HTTP/2 is a good match for IoT for several reasons:
HTTP/2 has many negotiable settings that can improve its performance for IoT applications by reducing bandwidth, codespace, and RAM requirements. Specifically, the following settings and values have been found to be useful in IoT applications:
For Constrained and Internet scenarios, it is assumed that HTTP/2 runs over TLS. Accordingly, the ALPN negotiation in section 3.3 of [RFC7540] applies. As seen above, an IoT scenario may wish to depart from the default SETTINGS. To do so, the usual SETTINGS negotiation applies. In this case, the initial SETTINGS negotiation setup is based on the first message exchange initiated by the client. This is simpler than general HTTP/2 case: not having an in-the-clear Upgrade path means the client is always in control of first HTTP/2 message, including any SETTINGS changes it may wish.
Additionally, the use of "prior knowledge" per section 3.4 of [RFC7540] is likely to also work particularly well in IoT scenarios in which a client and its web service are likely to be closely matched. In such scenarios, prior knowledge may allow for SETTINGS to be set in accordance with some shared state implied by the the prior knowledge. In such cases, SETTINGS negotiation may not be necessary in order to depart from the defaults as defined by HTTP/2.
The proliferation of application and security protocols in the IoT has produced the deployments of islands of IoT devices, each using one of the several protocols available. However, usually an IoT deployment needs to communicate to another one, or at least needs to communicate with the Web, both because they have to upload data to the Cloud or because usually they are controlled by a Web application.
In such cases, communication is facilitated by a cross-protocol proxy or a gateway translating from one protocol syntax and semantic into another one. However, the presence of Cross-Protocol or Application gateways has at least two main drawbacks that need to be analyzed and addressed carefully.
This section assumes HTTP/2 over TCP.
In addition to underlying stack considerations with respect to IPv4, IPv6, TCP, and TLS, there are implementation considerations for HTTP/2 for IoT.
A primary consideration is the number of allowed simultaneous HTTP/2 connections. As each connection has associated overhead, as well as overhead for each stream, constrained hosts may wish to limit their number of simultaneous connections. However, implementers should consider that some popular browsers require more than one connection to operate.
In addition to minimizing the number of simultaneous connections, hosts should consider leaving connections open if there is a possibility of further communication with the remote peer. HTTP/2 contains mechanisms such as PING to periodically check idle connections. Leaving established connections open when there is a possibility of future communication allows connection establishment overhead (and potentially TLS session establishment overhead) to be avoided.
Should TLS be used, implementers may wish to consider utilizing hardware-based encryption to further reduce codespace and RAM requirements.
This section presents some simple results obtained using the Deuterium HTTP/2 library [Deuterium] and is not intended to be complete, but rather a start for discussion. From an IoT perspective, the reduced message sizes presented help to conserve both bandwidth and battery life, as well as potentially saving some memory/buffer space.
The results presented in this section make the following assumptions and considerations:
This first example compares and contrasts a GET method to a resource containing an XML representation of a simple switch using HTTP/1.1 and HTTP/2.
4745 5420 2f6f 6e6f 6666 2048 5454 502f 312e 310d 0a48 6f73 743a 2066 6f6f 0d0a 4163 6365 7074 3a20 2a2f 2a0d 0a0d 0a
GET /onoff HTTP/1.1\r\n Host: foo\r\n Accept: */*\r\n \r\n
4854 5450 2f31 2e31 2032 3030 204f 4b0d 0a44 6174 653a 204d 6f6e 2c20 3039 204d 6172 2032 3031 3520 3036 3a32 363a 3434 2047 4d54 0d0a 436f 6e74 656e 742d 4c65 6e67 7468 3a20 3336 0d0a 436f 6e74 656e 742d 5479 7065 3a20 6170 706c 6963 6174 696f 6e2f 786d 6c0d 0a0d 0a 3c4f 6e4f 6666 3e0a 093c 7374 6174 653e 6f66 663c 2f73 7461 7465 3e0a 3c2f 4f6e 4f66 663e
HTTP/1.1 200 OK\r\n Date: Mon, 09 Mar 2015 06:26:44 GMT\r\n Content-Length: 36\r\n Content-Type: application/xml\r\n \r\n <OnOff>\n \t<state>off</state>\n </OnOff>
0000 1901 0500 0000 01 8286 0585 60f5 1e59 7f01 8294 e70f 0489 f963 e7ef b401 5c00 07
:method: GET :path: /onoff :scheme: http :authority: foo accept: */*
0000 2d01 0400 0000 01 880f 1296 d07a be94 03ea 681d 8a08 016d 4039 704e 5c69 a531 68df 0f10 8b1d 75d0 620d 263d 4c79 a68f 0f0d 8265 cf
:status: 200 content-type: application/xml content-length: 36 date: Mon, 09 Mar 2015 06:26:44 GMT
0000 2400 0100 0000 01 3c4f 6e4f 6666 3e0a 093c 7374 6174 653e 6f66 663c 2f73 7461 7465 3e0a 3c2f 4f6e 4f66 663e
<OnOff> \t<state>off</state> </OnOff>
In total and ignoring the payload (36 octets), the HTTP/2 flow is 37% smaller than the HTTP/1.1 flow.
The use of additional headers, particularly common headers that are present in the HTTP/2 static table, will result in greater savings.
While not compared here, HTTP/2's ability to reuse connections for multiple streams reduces connection establishment overhead, such as TCP connection establishment and TLS session establishment.
QUIC (Quick UDP Internet Connections) is a new multiplexed transport protocol designed to run in user space above UDP, optimized for HTTP/2 semantics. In this document, "QUIC" refers to the upcoming IETF standard. The protocol is still in its early days and the standardization work in IETF has just started.
QUIC provides functionality already present in TCP and HTTP/2
Where functionality is similar to that of existing protocols, it has been re-designed to be more efficient. For example, the native multistream provides multiplexing without the head-of-line blocking inherent to HTTP/2 over TCP.
QUIC will use DTLS 1.3. Accordingly, connections will commonly benefit from 0-RTT as defined by TLS 1.3, meaning that on most QUIC connections, data can be sent immediately without waiting for a reply from the server. Furthermore, packets are always authenticated and typically the payload is fully encrypted.
QUIC has been designed to provide richer information to congestion control algorithms than TCP, moreover the actual congestion control is plugable in QUIC.
Even if QUIC has been initially designed with HTTP/2 as the primary application protocol to support, it is meant to become a modern general-purpose transport protocol. The IETF standardization effort will also focus on describing the mapping of HTTP/2 semantics using QUIC specifically with the goal of minimizing web latency using QUIC. This mapping will accommodate the extension mechanisms defined in the HTTP/2 specification.
QUIC also dictates that packets should be sized to fit within the path's MTU to avoid IP fragmentation. However path MTU discovery is work in progress, and the current QUIC implementation uses a 1350-byte maximum QUIC packet size for IPv6, 1370 for IPv4.
Judging from its current state, QUIC may bring some potential benefits like the possibility to design and use a specific congestion control algorithm suited to IoT scenarios and possibility to reduce header overhead as compared to that of TCP plus HTTP/2. The latter is possible since these two layers are more integrated in QUIC.
This document has no considerations for IANA.
Section 1 and Section 3 above point out security issues in the current IoT landscape, namely, the additional attack vectors from having several bespoke stacks instead of one mainstream stack and protocols. This document seeks to improve security of the IoT by encouraging use of mainstream protocols which are better understood and more thoroughly debugged (both in their specifications as well as in their implementations).
Section 7 point out another issue with the current IoT landscape: the proliferation of gateways and proxies. Whereas they serve useful functions in IoT, allowing more constrained nodes to have much lower duty cycles or filtering them from much traffic, there are inherent security issues, not the least of which is that they break end-to-end security. Enabling more mainstream protocols would not preclude using a proxy or gateway whenever the tradeoff dictated it, but would also allow for end-to-end security.
Given the security challenges in IoT scenarios, HTTP/2 is assumed to use TLS services. In Internet scenarios, [RFC7540] has clear guidance in this respect. In Constrained network scenarios, the guidance for IoT is [I-D.ietf-dice-profile]. However, these are currently at odds. For example, Section 4.2 of [I-D.ietf-dice-profile] mandates the ciphersuite TLS_PSK_WITH_AES_128_CCM_8 for preshared key-based authentication (quite common in IoT deployments). On the other hand, Appendix A of [RFC7540] includes TLS_PSK_WITH_AES_128_CCM_8 in the HTTP/2 Black List of disallowed cipher suites, despite it being an AEAD ciphersuite. This is still to be resolved. The other IoT ciphersuite mandated by [I-D.ietf-dice-profile], namely, TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 (used for both certificate-based and Raw Public Key-based authentication) is not on the HTTP/2 Black List.
Thanks to the following individuals for helpful comments and discussion: Brian Raymor, Dave Thaler, Ed Briggs.
This document was produced using the xml2rfc tool [RFC2629][RFC7749].