polishing
[skm-ma-ws1314.git] / sec-discussion.tex
1 \section{Discussion}\label{sec:discussion}
2
3 \subsection{Future Work}
4
5 In addition to the XEPs covered above, there are a few additional XEPs which can
6 be implemented to further increase the effictivity of Chatty Things. Especially
7 the documents XEP-0323 through XEP-0326 (which are currently in Experimental
8 status) are targeted to the Internet of Things.
9
10 \paragraph{Concentrators (XEP-0326)~\cite{xep0326}}
11 In contrast to sensor nodes which are focused on collecting data, concentrators
12 can be used to serve as a proxy and control a subset of the network. The XEP
13 defines messages to query a sensor node for data sources, and subscribing to
14 them, while subscription is loosely modeled after the Publish-Subscribe
15 mechanism (XEP-0060). It also specifies how clients can request data or
16 control certain nodes over a concentrator.
17
18 This approach can be practical in large-scale sensor networks, where usually not
19 every sensor node can be reached directly, and where sensor nodes only have a
20 very limited amount of storage. Individual concentrators can then be equipped
21 with larger storage and serve as a facility to aggregate data from sensor nodes.
22 This structure can be implemented on several levels, forming a hierarchy. A user
23 interested in specific values then only needs to communicate with a single node
24 in the network.
25
26 \paragraph{Sensor Data (XEP-0323)~\cite{xep0323}}
27 %\begin{figure}
28 %\caption{Example stream between a sensor node and a client}
29 %\label{fig:streamexample}
30 %\begin{verbatim}
31 %Client Device
32 %<stream>
33
34 %\end{verbatim}
35 %\end{figure}
36 This XEP specifies a way of reading out values from a
37 sensor node. It allows to specify multiple data sources (e.~g. temperature,
38 humidity) as well as multiple types of data (e.~g., momentary values, historical
39 values, peak values).
40 As a simple use case, the client sends an IQ stanza containing the request and a
41 sequence number used to identify the request. The sensor node then rejects or
42 accepts the request by returning a corresponding IQ stanza. If it has
43 accepted the request, it reads out the requested data and returns it in a
44 subsequent message stanza to the client.
45
46 \paragraph{Control (XEP-0325)~\cite{xep0325}} In this document, a way of
47 controlling sensor nodes is specified, which allows a client to get and set
48 control values on the node over message or IQ stanzas. As an example, in this
49 way a sensor node could be instructed to return data in a different unit or
50 range, or be put into power-safe mode.
51
52 \paragraph{Provisioning (XEP-0324)~\cite{xep0324}}
53 To protect the integrity of a sensor network and securing the data being
54 collected, this XEP specifies a way of implementing access rights and user
55 privileges. Since a single sensor node is usually very restricted in user input and
56 output, the approach is very simple and can be implemented e.~g. using a button
57 and an LED for interaction, while presentation of data takes places on a
58 provisioning server with a rich user interface (which can be, for example, a
59 concentrator).
60
61 When integrating a new sensor node into the network, the user instructs the
62 provisioning server to generate a \term{friendship} request for the new node.
63 The node can e.~g. symbolize this request by blinking its LED and requesting a
64 button press in the next 30 seconds. If the user presses the button, the node
65 confirms the friendship to the server. The server then remembers this sensor
66 node and generates a token which must be used in all further communication
67 between the server and the sensor node, else communication is rejected.
68
69 \paragraph{Efficient XML Interchange Format (EXI, XEP-0322)~\cite{xep0322}}
70 Finally, EXI describes how XMPP stanzas sent between nodes can be compressed,
71 thereby effectively reducing the overhead in message size introduced by XML.
72 XMPP nodes can negotiate a compressed stream inside their existing XMPP streams
73 and exchange \code{<compress>} stanzas which then contain the payload. However,
74 it is to be noted that this requires further implementation of compression
75 algorithms as well as additional CPU and memory resources and thus might
76 decrease message throughput and increase power consumption on embedded systems.
77
78
79 \todo{example XML stream with sensor data}
80
81 \subsection{Related Approaches}
82
83 ``Chatty Things'' is not the only approach to implement communication in
84 embedded networks. This section gives a short overview of related protocols for
85 the Internet of Things and shows their advantages and disadvantages, which are
86 summarized in Table~\ref{tab:comparison}.
87
88 \begin{table}
89 \small\centering
90 \caption{Comparison of related approaches}
91 \label{tab:comparison}
92 \begin{tabular}{|l||l|l|l|l|}
93 \hline
94 Feature & Chatty Things & CoAP & MQTT & WS4D \\
95 \hline\hline
96 application gateways neccessary & - & yes & yes & - \\ \hline
97 usable with standard clients & yes & - & - & (yes) \\ \hline
98 discovery support & yes & yes & - & yes\\ \hline
99 IPv6/6LoWPAN ready & yes & yes & ? & partial \\ \hline
100 asynchronous messages & yes & yes & & \\ \hline
101 protocol overhead & moderate & small & small & high \\ \hline
102 \end{tabular}
103 \end{table}
104
105 \paragraph{Constrained Application Protocol (CoAP)}
106
107 The Constrained Application Protocol~\cite{draft-ietf-core-coap-18} focuses on
108 machine-to-machine communication and originates from the IETF Constrained
109 Resources Working Group\footnote{\url{http://datatracker.ietf.org/wg/core/}},
110 but still has been only in draft status since 2010.\ It allows a mapping to
111 HTTP, and is therefore stateless, but it specifies a binary protocol, which
112 makes it neccessary to deploy application-level gateways and special client
113 software to communicate with its environment. It relies on UDP, but emulates
114 congestion control, message confirmation and message IDs, since – in contrast to
115 HTTP – messages can be sent asynchronously. Discovery is also specified and done
116 over multicast, service discovery is then done over a well-known URI on the
117 host. Since it is a binary protocol and mostly self-contained, it has low
118 protocol overhead and parsing complexity.
119
120 \paragraph{MQ Telemetry Transport (MQTT)}
121
122 Specified by IBM as a binary protocol, the MQ Telemetry Transport~\cite{mqtt}
123 has been proposed as an OASIS standard for machine-to-machine communication. It
124 also relies on TCP/IP, and its fixed message header is only 2 bytes in size, but
125 can contain further variable headers. Since it is also only used in embedded
126 networks, application gateways and appropriate client software are necessary.
127 Its main feature is a publish-subscribe mechanism with topic names, discovery is
128 not specified.
129
130 \paragraph{Web Service for Devices (WS4D)}
131
132 As a different approach to avoid application-level gateways, WS4D has been
133 specified as a Devices Profile for Web Services~\cite{zeeb-moritz-ws4d}. Since
134 Web Services are wide-spread in the business world, this approach can probably
135 be used in existing infrastructures, and is also focused on multiple platforms
136 like embedded systems and servers. Web Services can be very flexible and
137 composable, and discovery is already specified, however, this also comes at a
138 cost: messages are enclosed in SOAP, which is enclosed in HTTP, which is
139 transported over TCP, which introduces a substantial overhead, especially with
140 SOAP being based on verbose XML. IPv6 support is only partially implemented.
141 For communication, standard APIs can be used.
142
143 \subsection{Conclusion}
144
145 With the XMPP
146 protocol, there is the need to implement at least an XML parser on each node,
147 which comes with protocol overhead and increased code size. However Klauck and
148 Kirsche show that with good optimization (in the code as well as in the
149 procotol), a complete stack can be implemented in 12 kByte of ROM, which leaves
150 enough space for other applications to be built onto it. As compared to Web
151 Services, Chatty Things are probably not as flexible, but they have less
152 overhead, even when using XML, while MQTT and CoAP provide less flexibility for
153 future enhancement, but less protocol overhead and easier parsing.
154
155 With TCP, mDNS, DNS-SD and XMPP as foundation, the proposed architecture builds
156 on reliable and established standards, which allows it to reuse Chatty Things in
157 various contexts without the need for central infrastructure.
158
159 Nonetheless, a drawback is the virtual dependency from a centralized XMPP
160 server in order to use Temporary Subscription for Presence for topic filtering,
161 which is caused by the lack of support for Multi-User Chats in XEP-0174
162 (Serverless Messaging). If this gap can be closed, or a different way for topic
163 filtering in distributed networks is found, the server can be
164 eliminated and what remains is a highly distributed network without the need for
165 much central infrastructure, therefore eliminating most single points of failure
166 in the system.
167
168 It is always hard to trade flexibility and accessibility for efficiency. The
169 Chatty Things approach is probably not one of the most efficient, and not the
170 most flexible, but it has the big advantage that users can interact with their
171 things using standard chat clients, without the need for application gateways or
172 specialized software. In terms of efficiency, it chooses a compromise between
173 binary protocols and Web Services, latter which were originally developed for
174 servers with much less resource constraints as embedded systems. However, with
175 additional XEPs focusing on the Internet of Things, enough flexibility can be
176 achieved for this use case.
177
178 % vim: set ft=tex et ts=2 sw=2 :
This page took 0.060504 seconds and 5 git commands to generate.