Measurement and Characterisation of a Mobile IoT E-Health Application Latency
The Internet of Things (IoT) emerges as a myriad of devices and services that interact to build complex distributed applications. Interoperability and standardisation are imperative for the realisation of this vision. Machine-to-Machine (M2M) communications standards can be the middleware that glues together the IoT. However, standards are highly complex and require a large amount of interpretation, deployments are currently scarce, and performance evaluations simplistic or speculative. In this work, we focus on the experimental evaluation of latency in IoT service composition with mobile gateways. We measure latency between system components and quantify application protocol overheads to assess the capabilities and limitations of a standard M2M middleware. We designed and implemented a mobile e-health use case on top of ETSI M2M and openEHR standards. We ran a pilot remote monitoring 10 people for 3 weeks, collecting nearly 480 hours of data. Our results show that while the latency added by a broker lies around 25ms, the cellular network often exceeds 1s, becoming a problem for interactive applications. Moreover, we observe that latencies between a smartphone gateway and cloud hosted services vary largely depending on the user mobility, and on the promotion delay of the used wireless network.
In mobile M2M communications, smartphones are also envisioned to play the important role of M2M Gateways (GWs), acting as proxy for nearby devices with constrained resources and limited connectivity . Recent forecast  estimates that 6.4 billion connected things will be in use worldwide in 2016 reaching 20.8 billion by 2020, and IoT supported total services spending of $235 billion in 2016. Interoperability could guarantee that devices can be integrated with infrastructures and services, and that services can be composed into complex applications in which each stakeholder focuses on his specific know-how. Mobile e-health is a perfect use case because available solutions tend to be proprietary. This leads to closed and inefficient vertical silos that have difficulty in scaling and cause dispersion due to the impossibility to share resources , . Interoperability and standardisation are key for general recognition and acceptance
ETSI M2M provides a generic set of service capabilities: communication management, application management, service and device discovery and registration, device management, data processing, security, etc. The architecture  settles on current network domain standards, but extends them with M2M Applications and generic Service Capability Layers (SCLs). Service Capabilities (SCs) are functions shared by all entities in the M2M ecosystem, and communications are made using defined interfaces. Information is represented by resources, following a RESTful architecture style , with the four basic CRUD methods to handle resources: CREATE, RETRIEVE, UPDATE, and DELETE; plus two more additional methods: EXECUTE for executing a management command and NOTIFY for reporting a notification about a change of a resource to the subscribers of that resource. Any resource can be manipulated by these methods. Thus, different applications can access the same resources through the same reduced set of operations, something that cannot be achieved when dedicated infrastructures are used. In REST, resources have a particular state during time (they are mutable over time) and are uniquely addressable using a Universal Resource Identifier (URI). Furthermore, manipulation of data and data exchange between entities are all stateless. In ETSI M2M, each SCL hosts resources in a hierarchical tree structure, where information is maintained. So, comparing all timestamps to estimate one-way delays was a challenge. In the rest of this section we describe how we measured latency for the different segments given the different possibilities and accesses.
We presented an experimental characterisation of latency and application overheads in an IoT application of service composition with mobile gateways. For that, we designed and implemented a mobile e-health use case, combining ETSI M2M communications and openEHR, that monitored 10 people for 3 weeks. We observed that M2M resource structure paths contribute a lot to the overhead, but protocol headers only a small part. Further, latency between the smartphone and broker contributes to a large portion of the E2E latency, and depends on the mobility. We also verified that the access network makes up most of that latency due to the promotion delay. We conclude that M2M middleware should provide means to support low latency for applications with real-time requirements and that this may be a tradeoff with functionality/ complexity. Finally, we highlight some lines along which the current developments in networking may contribute to address some of the problems identified
 C. Pereira and A. Aguiar, “Towards efficient mobile m2m communications: Survey and open challenges,” Sensors, vol. 14, no. 10, p. 1958219608, Oct. 2014.
 C. Pereira, J. Rodrigues, A. Pinto, P. Rocha, F. Santiago, J. Sousa, and A. Aguiar, “Smartphones as m2m gateways in smart cities iot applications,” in 2016 23rd International Conference on Telecommunications (ICT), 2016, pp. 1–7.
 Gartner. (2015) Press Release: Gartner Says 6.4 Billion Connected “Things” Will Be in Use in 2016, Up 30 Percent From 2015. [Online]. Available: http://www.gartner.com/newsroom/id/3165317.
 G. Wu, S. Talwar, K. Johnsson, N. Himayat, and K. Johnson, “M2m: From mobile to embedded internet,” IEEE Communications Magazine, vol. 49, no. 4, pp. 36–43, Apr. 2011.
 S. Umer, M. Afzal, M. Hussain, K. Latif, and H. F. Ahmad, “Autonomous mapping of hl7 rim and relational database schema,” Information Systems Frontiers, vol. 14, no. 1, pp. 5–18, Mar. 2012.
 A. Soceanu, A. Egner, and F. Moldoveanu, “Towards interoperability of ehealth system networked components,” in 2013 19th International Conference on Control Systems and Computer Science (CSCS), 2013, pp. 147–154.
 G. L. Kreps and L. Neuhauser, “New directions in eHealth communication: Opportunities and challenges,” Patient Education and Counseling, vol. 78, no. 3, pp. 329 – 336, Mar. 2010.
 R. J. Cruz-Correia, P. M. Vieira-Marques, A. M. Ferreira, F. C. Almeida, J. C. Wyatt, and A. M. Costa-Pereira, “Reviewing the integration of patient data: how systems are evolving in practice to meet patient needs,” BMC Medical Informatics and Decision Making, vol. 7, no. 1, p. 14, June 2007.
 C. Pereira, S. Frade, P. Brandao, R. Correia, and A. Aguiar, “Integrating data and network standards into an interoperable e-health solution,” in 2014 IEEE 16th International Conference on e-Health Networking, Applications and Services (Healthcom), 2014, pp. 99–104.
 Y. Li and C. Lin, “Qos-aware service composition for workflow-based data-intensive applications,” in 2011 IEEE International Conference on Web Services (ICWS), 2011, pp. 452–459.