Rethinking Scalable Service Architectures for the Internet of Things
Total Page:16
File Type:pdf, Size:1020Kb
Devices-as-Services: Rethinking Scalable Service Architectures for the Internet of Things Fatih Bakir, Rich Wolski, Chandra Krintz Gowri Sankar Ramachandran Univ. of California, Santa Barbara Univ. of Southern California Abstract vices at the edge that augment device capabilities and enable We investigate a new distributed services model and architec- scale. In this paper, we outline this approach to implementing ture for Internet of Things (IoT) applications. In particular, Devices-as-Services and describe some of the capabilities of we observe that devices at the edge of the network, although an early prototype. resource constrained, are increasingly capable – performing Our work is motivated by the following observations. • IoT applications can and will likely be structured as collec- actions (e.g. data analytics, decision support, actuation, con- tions of services that require functionality from a device trol, etc.) in addition to event telemetry. Thus, such devices tier, an edge tier, and a cloud tier are better modeled as servers, which applications in the cloud • in-network data processing can significantly reduce re- compose for their functionality. We investigate the implica- sponse time and energy consumption [31], tions of this “flipped” IoT client-server model, for server dis- • edge isolation precludes the need for dedicated commu- covery, authentication, and resource use. We find that by com- nication channels between application and devices, and bining capability-based security with an edge-aware registry, facilitates privacy protection for both data and devices, this model can achieve fast response and energy efficiency. • actuation in device tier will require some form of request- 1 Introduction response protocol where the device fields the request, • the heterogeneity of devices militates for a single program- As the Internet of Things (IoT) grows in size and ubiquity, it ming paradigm and distributed interaction model, and is becoming critical that we perform data-driven operations • multi-function devices can and will be able to perform their (i.e. analytics, actuation, and control) at the “edge” to reduce functions (including data publication) conditionally based the latency, response time, cost, and energy use for IoT ap- on application needs (e.g. as a power optimization). plications. As such, edge systems increasingly co-locate data Thus we propose a new model for distributed IoT applications management and analysis services with sensing, instead of in Figure 1. We flip the client-server model such that devices requiring that devices ship their data over long-haul networks at the edge are “servers” that although resource constrained, for remote processing using the traditional “cloud” model. service multiple, scalable applications (i.e. clients) deployed Edge systems [3, 4, 8, 10, 11, 27, 28] typically implement a in the cloud. Note that in many commercial solutions [3,11] publish/ subscribe (pub-sub) model in which devices publish devices “publish” data to channels to which servers (running streams of data (often via a nearby broker); when supported, in the cloud) subscribe. We propose to move the servers actuation often uses a separate protocol. Alternatively, some to the edge (as a way to scale data ingress, lower latency, solutions target a client-server model, where the IoT devices and improve privacy) thereby reversing the current cloud- are the clients that respond with data whenever a decision centric architecture. Such a model requires a new distributed making server needs it. In our view, a client-server model is architecture that leverages edge resources in these ways. well suited to emerging IoT applications in which resource In this paper, we define one such architecture, investigate constrained edge devices provide nanoservices – data-driven how it can accommodate this new model, and evaluate the actuation and control, data analysis, processing, and sensing. implications of its use in IoT settings and for servicing IoT We believe that the IoT deployments in the not-too-distant applications. The architecture is based on the functions as- future will include multi-function devices. As a result, a ser- a-service (FaaS) programming and deployment model (the vices model in which the specific function (including data execution engine that underpins serverless computing for publication) can be requested from each device when it is clouds [13,20,22,23]), and integrates a new approach for effi- needed is more appropriate. Further, because devices will con- cient client and server discovery, authentication, and authoriza- tinue to be resource constrained, they will require “helper” ser- tion via a combination of capability-based security [5, 12, 24] chronous commands (although for low-power applications that use MQTT-SN, this option is not possible). With our system, the same server code runs at all tiers — device, edge, and cloud — unifying the device API as a first-class services API. The currently prevalent commercial IoT/cloud APIs require devices to act separately as “publishers” or “subscribers” or both (the last to implement “closed-loop” actuation). We be- lieve that IoT infrastructure must accommodate a richer model Figure 1: A new distributed services model for IoT: “client” in which devices (however resource restricted) are capable applications in the cloud compose services exported by of actions as well as event telemetry. Thus, logically, IoT de- resource-constrained devices at the edge via Edgistries – edge vices are better modeled as servers that provide services to nodes that facilitate device discovery/registration, privacy me- applications. diation, and optimization. 2.1 The Edgistry and a set of edge services for service registry, privacy media- Our approach splits the provisioning of services between de- tion, and optimization called an Edgistry. vices and a common set of management services located at We prototype an early implementation of this architecture the edge, termed The Edgistry. Devices host small, resource- and approach using microcontrollers, single board comput- light services that field requests from, and respond to, client ers, and edge clouds. We empirically compare the energy applications (hosted in the cloud or edge). The Edgistry consumption and performance of traditional and flipped archi- • implements an eventually consistent distributed service tectures, as well as our capability approach versus TLS/SSL registry (e.g. using blockchain consensus protocols such as based mechanisms for authentication. We find that it is possi- Tendermint BFT [6] and Hyperledger Fabric [2]), ble to implement Devices-as-Services – a flipped model of the • acts as a speed-matching communication service, currently popular cloud-based IoT architecture – efficiently, • can protect device privacy (e.g. through anonymization) by using FaaS as a universal programming paradigm and a set of isolating the service provider from service consumer, and application agnostic edge services. • provides computational and storage off-loading services 2 Devices-as-services – a New Approach (e.g. content caching) for device-hosted services. Our view is that the current Internet and cloud architecture From a programmability perspective, we advocate a uni- should “reverse” to accommodate scalable IoT applications. versally portable “Functions as a Service” (FaaS) capabil- Rather than hosting services in the cloud (logically making ity [13,17,20,22,23]. Services on the device are implemented IoT devices clients of those services), we view devices as using a “micro FaaS” – a small, specially tuned, implementa- “servers” and applications running in the cloud as “clients”. tion of FaaS specifically targeting resource-restricted micro- This viewpoint is supported by several observations. First, controllers as an execution platform. The micro FaaS supports devices are resource restricted making them capable of de- the same programming APIs as a heavier-weight (and server- livering limited and relatively fixed functionality. This func- less) implementation designed to run on an edge device, in a tionality is naturally described as an enumerable set of ser- private cloud, or in a public cloud. In this way, IoT applica- vices (responses to requests) that are composed by applica- tions can be coded using a single “FaaS everywhere” set of tions. These services are necessarily “small” but even fully programming abstractions from device to cloud. resourced cloud services are now being developed as microser- To enable this portability and also data durability in a dis- vices [18]. Devices are the “nanoservices” in an IoT setting. tributed setting, such scale-spanning FaaS capability must Secondly, applications must compose device capabilities define a portable storage abstraction, ideally having append- from vast collections of devices into meaningful functionality only semantics. Thus all computations, regardless of location, for users, and in an IoT setting, the user scale will be sub- can persist data by appending it to some object hosted in the stantial. The cloud is where this scaling will necessarily take device-edge-cloud hierarchy using a common API. place, both in terms of aggregating device functionality, and 2.2 Request Forwarding and Duty Cycle matching these aggregations to user demand for them. Note that to save power, some devices will need to spend most Thirdly, much of the current technological development of their duty cycle in a power-saving “sleep” mode. For ex- for IoT [3, 11] is focused on bringing devices