Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely...

27
Loosely Coupled Communication in Actor Systems AW2 - Raphael Hiesgen

Transcript of Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely...

Page 1: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Loosely Coupled Communication in Actor Systems

AW2 - Raphael Hiesgen

Page 2: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

• Introduction

• Paper 1

• Paper 2

• Paper 3

• Next Steps

2

Page 3: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Introduction• Loosely Coupled Communication

• Handle unreliable connections

• Non-hierarchical error-propagation model

• Implement secure communication

• Transparent breach of NATs and firewalls

• Use-cases

• Internet of Things (IoT) (Project 1)

• Internet-wide Systems

3

Page 4: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

• Introduction

• Paper 1

• Paper 2

• Paper 3

• Next Steps

4

Page 5: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Why is the Web Loosely Coupled? A Multi-Faceted Metric for Service Design

• C. Pautasso and E. Wilde

• ‘Loose coupling’ is often quoted as desirable

• Impact of change is limited

• Services can evolve independently

• Specific definition is missing

5

Page 6: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Origins• First appeared in 1967

• Software engineering

• Principle of modularity

• Affects evolution of a system

• Distributed systems

• Shared memory vs. message passing

• Publish / subscribe paradigm

6

Page 7: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Facets• Discovery

• Central registration vs. decentralized referral

• Web uses search engines

• Interaction

• Synchronous vs. asynchronous

• Interface Orientation

• Horizontal (API) vs. vertical (protocol)

7

Page 8: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Facets• Model

• Specified data model vs. self contained messages

• State

• Requires management (establishment, recovery, …)

• Stateless design keeps ‘state’ in messages

• Conversation

• Predefined exchange vs. dynamic discovery

8

Page 9: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Facets

• Identification • Central identification services vs.

specified identification scheme

• Binding • Resolving names into identifiers

• Platform • Programming language

requirement, …

9

• Granularity • coarse-grained vs. fine-granular

interfaces

• Evolution • compatibility vs. fragmentation

• Generated Code • Code needs to be regenerated if

the description changes

Page 10: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Analysis

10

faceted definition also to measure the coupling implied bythis technology. We observe that ESB provides loose cou-pling according to four facets: binding (Dynamic), interac-tion (Asynchronous), state (Stateless) and platform (Inde-pendent). However, the technology uses context-based iden-tification (a tightly coupled solution) and requires central-ized service registration to support service discovery. Also,interactions based on multiple message exchanges are explic-itly modeled using workflow and conversation models. Thedevelopment process of services connected by an ESB relieson code generation techniques (thus, an ESB presents anhorizontal interface orientation). Therefore, according to allof these other five facets, this kind of middleware technologydoes not help to achieve loose coupling. Similar to the othertwo alternatives, the choice of using an ESB does not con-strain the evolution and granularity facets. Additionally, itis also possible to choose between a shared model design, orto leverage the ESB mediation capabilities to foster a moreloosely coupled design based on self-describing messages.

In more quantitative terms, the table counts the numberof facets for which a technology results in loose or tight cou-pling. We also distinguish facets for which the degree ofcoupling does not depend on the chosen technology but mayvary depending on more specific design decisions.

Coupling REST RPC WS-*/ESB

Loose 10 3 4Tight 0 4 5Design-Specific 2 5 3

Only in the best case (assuming that all design-specificfacets follow loosely coupled options) we can conclude thatusing RESTful HTTP would provide a system architecturefeaturing loose coupling according to all facets. ChoosingRPC over HTTP, instead, would not result in a completelyloosely coupled system, due to the 4 facets (interaction,model, generated code, and conversation) which only presenta tightly coupled approach. This alternative also requires

Discovery

Identification

Binding

Platform

Interaction

Model

Granularity

State

Evolution

Conversation

InterfaceOrientation

GeneratedCode

WS-*/ESBRPC over HTTPRESTful HTTP

Figure 4: Comparing the degree of coupling impliedby different Web services technologies

more effort to achieve a loosely coupled system, as up to5 facets are design-specific and are unconstrained by thetechnology choice. This number is smaller in case of theWS-*/ESB alternative, where only 3 facets are design-specific.A more detailed, facet-by-facet comparison is visualized withthe radar chart of Figure 4. It is interesting to notice that thecurve indicating the degree of coupling implied by RESTfulHTTP is strictly bounded by both of the other curves. If wedo not consider the discovery and identification facets, thesame holds between the RPC and the ESB curves. Thus, ourmulti-faceted metric can be used to establish a partial or-dering between different Web services technologies in termsof their degree of coupling.

6. CONCLUSIONSSOAP-based Web services and the REST architectural

style have been and still are the topic of many debates.Many of these debates are heated, often missing the pointthat the more prescriptive style of the SOAP approach andthe more descriptive style of the REST approach have theirroots in different scenarios, the former assuming closed worldsand contractual relationships, whereas the latter caters toan open world with ad-hoc interactions [40]. So far, onlyfew attempts have been made to compare both approachesas objectively as possible [31]. “Loose coupling” and “tightcoupling” are frequently used terms in such debates, giventhe positive connotation of the former and the negative im-plications of the latter. Reduced coupling is beneficial be-cause interdependencies typically make complex IT applica-tion systems brittle and slow to adapt to changes [32].

In terms of the goals which should be accomplished whendesigning service systems, WS-* and REST can be describedby integration vs. cooperation (Fiedler et al. [11] make a sim-ilar distinction for database systems). Both goals (as wellas “loose” and ‘tight” coupling) are not good or bad per-se.They are the result of a strategic decision on how to de-sign and implement IT architectures, and there can be validbusiness objectives for both of these goals. These businessobjectives should be the input for a decision how to designa system, for example putting a higher emphasis of perfor-mance optimization (usually easier with tight coupling) oragility (usually easier with loose coupling).

The twelve facets described in this paper make it easier tounderstand which approach is more appropriate for a givenproblem, and for which facet of the system design a looseor tight coupling approach should be preferred. In the end,as we have shown in our evaluation, very few systems areloosely or tightly coupled according to all facets. Instead,they use a mix of both depending on the business objectivesand the constraints of the chosen Web technologies. Ourmulti-faceted metric thus also defines a set of choices thatneed to be made, giving system designers a more structuredapproach for making better design decisions and comparingalternative Web services technology options.

AcknowledgementsThe authors would like to thank Domenico Bianculli for hisconstructive feedback. This work is partially supported bythe EU-IST-FP7-215605 (RESERVOIR) project.

7. REFERENCES[1] Tim Berners-Lee, Roy Thomas Fielding, and Larry

Masinter. Uniform Resource Identifier (URI): GenericSyntax. Internet RFC 3986, January 2005.

WWW 2009 MADRID! Track: Web Engineering / Session: Web Architecture Aspect

919Coupling in Web services [1].

WS-*/ESB

RPC over HTTP

RESTful HTTP

Degree of Coupling

Loose Coupling

Coupling Facet

Tight Coupling

Design-Specific Coupling

Discovery

Identification

Binding

Platform

Interaction

InterfaceOrientation Interface

Orientation

InterfaceOrientation

Model

Granularity

State

Evolution

GeneratedCode

GeneratedCode

GeneratedCode

Conversation

Discovery

Identification

Binding

Platform

Interaction

Model

Granularity

State

Evolution

Conversation

Discovery

Identification

Binding

Platform

Interaction

Model

Granularity

State

Evolution

Conversation

(a) RESTful HTTP (b) RPC over HTTP (c) WS-*/ESB

Figure 3: Measuring the degree of coupling implied by different Web services technologies

RESTful HTTP RPC over HTTP WS-*/ESB

4.1 Discovery Referral Referral Registration4.2 Identification Global Global Context-based4.3 Binding Late Early/Late Late4.4 Platform Independent Independent Independent4.5 Interaction Asynchronous Synchronous Asynchronous4.6 Interface Orientation Vertical Horizontal Horizontal4.7 Model Self-Describing Messages Shared Model Self-D. Messages/Shared Model4.8 Granularity Fine/Coarse Fine/Coarse Fine/Coarse4.9 State Stateless Stateless/Shared, Stateful Stateless4.10 Evolution Compatible/Breaking Compatible/Breaking Compatible/Breaking4.11 Generated Code None/Dynamic Static Static4.12 Conversation Reflective Explicit Explicit

Table 2: Web Services Technology Evaluation Summary

protocol. However, when it comes to the interaction facet,some differences become apparent. RPC interactions are bydefinition synchronous. RESTful interactions are insteadasynchronous, since services interact indirectly by updating(with POST, PUT, or DELETE) the state of resources, whichcan be later accessed by other services (with GET) [33]. Inter-face orientation is vertical in REST, which only relies on theprotocol and resource representations, whereas RPC is oftenbased on the stub mechanism where the client of a remoteservice accessed via RPC calls a local interface which thenhandles the fact that the service is implemented remotely.The two technologies also differ in terms of the model facet,where RPC follows a shared model approach, where all ser-vices must agree beforehand on the syntax and the semanticsof the exchanged messages, while REST promotes a “Self-Describing Representations” solution. RESTful interactionsare also stateless, while RPC offers both options, as interact-ing services may establish a session by sharing state amongthem, but also may be designed to avoid such tight cou-pling. RPC is also based on generated code stubs, whileREST does not require them as it follows a more dynamicapproach based on plugin extensibility. Also regarding con-versations, REST promotes a dynamic, reflective approach,

while RPC-based Web services make the interaction con-straints explicit at design-time.

It is worth noting that not all the facets are bound bythe properties of a given technology. For example, the gran-ularity, state, and evolution facets depend on the concretedesign choice of a given service-oriented system architecture,and are not constrained by the choice of the REST vs. RPCstyles. In other words, it is possible to design tightly cou-pled RESTful Web services, which can be “chatty” in theirinteractions, if their interfaces expose a large number of fine-grained resources. The same can be said about RPC-basedservices, which can either publish many fine-grained opera-tions, or a few coarse-grained ones, depending on the cho-sen design strategy. Also in terms of the evolution facet, aservice design needs to be evaluated at a more specific level.For example, XML technology can support a loosely coupledevolution facet only if it is used with additional guidelinesfor versioning and the enforcement of mustUnderstand rules.

We have chosen to include in our evaluation the WS-*/ESBtechnology (which is not Web/HTTP centric), because theenterprise service bus family of middleware products is widelyperceived to be the foundation for loosely coupled SOA im-plementations. Thus, it is interesting to apply our multi-

WWW 2009 MADRID! Track: Web Engineering / Session: Web Architecture Aspect

918

Page 11: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

• Introduction

• Paper 1

• Paper 2

• Paper 3

• Next Steps

11

Page 12: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Constrained Application Protocol (CoAP)

• Developed by the IETF (currently a draft)

• Designed for M2M communication

• Request-response model adapted from HTTP

• Works asynchronously over UDP

• Implements reliable messages

• ‘Confirmable’ message answered with ‘ACK’

12

Page 13: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Congestion Control in Reliable CoAP

• A. Betzler, C. Gomez, I.Demirkol and J. Paradells

• Limited hardware and link capacities

• Basic CoAP vs. CoCoA

• Performance with parallel transactions

13

Page 14: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Basic CoAP vs CoCoA• Retransmission after timeout

• Lossy links

• Congestion

• Long processing

• Default interval [2s, 3s]

• Counteract congestion:

• Binary exponential back-off timer

14

• Two separate timeout values

• RTT until ACK is received

• Estimators

• Strong: no retransmission

• Weak: retransmission

• Weighted averages (init: 2s)

• Third approach uses the strong estimator (CoCoA-S)

Page 15: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Parallel Transactions

• Defined through NSTART (default = 1)

• Parallel transactions lead to higher congestion

• Overhead through additional state

• Examined for four parallel transactions

15

Page 16: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Analysis

• Stack: 802.15.4, 6LoWPAN, UDP and CoAP

• RPL Routing

• Different topologies

• Chain, grid and dumbbell

• Influenced by routing characteristics

16

1 10 1000

200

400

600

800

1000

1200

Offered load (kbps)

Dro

pp

ed

MA

C la

yer

pa

cke

ts

CoAP (Default)CoCoACoCoA−S

Figure 4: Dropped MAC layer packets for different offeredloads in the dumbbell topology with NSTART=1.

destination, i.e., NSTART parallel transactions, has beenreached for the destination of the packet.

MAC layer buffer overflows are a clear sign of conges-tion, as they indicate that a high amount of packets arecreated and intended to be forwarded throughout the net-work, exceeding the capabilities of the network. The effectof the RTO algorithm on the amount of dropped packetsis deducted for the dumbbell topology and Fig. 4 showsthe overall amount of dropped MAC layer packets for thistopology.

As seen in the figure, when applying the default RTO algo-rithm, the number of MAC layer packet drops grows quicklyabove 3 kbps of offered traffic load and reaches an asymp-totic value at around 20 kbps. When using the alternativeRTO algorithms for CoAP congestion control, a slower in-crement of the number of dropped packets and a much lowerasymptotic value are observed. This means that the CoCoAalgorithms are capable of effectively decreasing the conges-tion in the network. The clear difference in the number ofdropped MAC layer packets between CoCoA and CoCoA-Sis a result of the different RTO estimations they apply. Incontrast to CoCoA-S, CoCoA additionally uses weak RTTmeasurements from retransmissions that may lead to largeRTOs. This throttles the output of packets and leads to afurther reduction of buffer overflows in the network.

An asymptotic behavior of the amount of dropped MAClayer packets is observable, because the actual amount oftraffic transmitted over the radio channel does not increasesignificantly further with the offered load at high trafficrates. On the other hand, due to the limitation given byNSTART=1 and increasing packet generation frequenciesat each node, the probability of dropping newly generatedCoAP messages gets higher with the offered load. For offeredload beyond the threshold where the amount of droppedMAC layer packets reaches its asymptotic value, the CoAPpacket drop rate is observed to increase almost linearly withthe amount of generated packets.

As mentioned before, the amount of hops between sourceand sink nodes in the dumbbell topology is low, resulting insmall RTTs. How the congestion control algorithms performwhen larger RTTs are observed can be demonstrated in thechain topology, where packets may have to travel along manyhops before reaching their destination. The radio links alongthe chain are not utilized equally. The links closer to the sinkwill be required more frequently for transmissions, as all thepackets from the other end of the chain need to traverse

1 10 1001

1.5

2

2.5

3

3.5

4

4.5

5

Offered load (kbps)

Ca

rrie

d lo

ad

(kb

ps)

CoAP (Default)CoCoACoCoA−S

Figure 5: Throughput achieved for different offered loads inthe chain topology with NSTART=1.

1 10 1000

200

400

600

800

1000

1200

Offered load (kbps)

Dro

pp

ed

MA

C la

yer

pa

cke

ts

CoAP (Default)CoCoACoCoA−S

Figure 6: Dropped MAC layer packets for different offeredloads in the chain topology with NSTART=1.

them. On the other hand, due to spatial reuse, it is possiblefor several nodes to transmit in parallel along the chain,without interfering each other.

For this particular setup, the difference between the de-fault CoAP and the CoCoA mechanisms becomes larger, ascan be seen in Fig. 5. This shows that the CoCoA mecha-nisms are able to adapt to different RTT values and to thetraffic characteristics of the network. This observation canbe backed up by observing the amount of dropped MAClayer packets (Fig. 6), showing a similar behavior as inthe dumbbell topology, where the drop rates for the CoCoAmechanisms are much smaller than for default CoAP.

On the other hand, in the grid topology, the number ofhops between source and destination nodes varies a lot, sincemany combinations of links for the connection of source andsink nodes are possible. Therefore, RTTs of different scalescan be observed. Since within the transmission, and alsothe interference range of a node there will be more nodes,a congestion of the radio channel is more likely than in theother analyzed topologies.

The performance comparison for the grid topology re-veals that CoCoA mechanisms are able to perform signif-icantly better than default CoAP. Fig. 7 shows that CoCoAand CoCoA-S perform better than the default CoAP, evenwhen the offered load is small (starting at 4 kbps). How-ever, the performance achieved by the two advanced con-gestion control mechanisms is very similar for this topology.For the intermediate traffic rates, CoCoA gets many weakRTT measurements from retransmissions, increasing the es-

370

Dropped MAC layer packets in the chain topology [2].

Page 17: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Throughput

17

1 10 1000

200

400

600

800

1000

1200

Offered load (kbps)

Dro

pped M

AC

laye

r pack

ets

CoAP (Default)CoCoACoCoA−S

Figure 4: Dropped MAC layer packets for different offeredloads in the dumbbell topology with NSTART=1.

destination, i.e., NSTART parallel transactions, has beenreached for the destination of the packet.

MAC layer buffer overflows are a clear sign of conges-tion, as they indicate that a high amount of packets arecreated and intended to be forwarded throughout the net-work, exceeding the capabilities of the network. The effectof the RTO algorithm on the amount of dropped packetsis deducted for the dumbbell topology and Fig. 4 showsthe overall amount of dropped MAC layer packets for thistopology.

As seen in the figure, when applying the default RTO algo-rithm, the number of MAC layer packet drops grows quicklyabove 3 kbps of offered traffic load and reaches an asymp-totic value at around 20 kbps. When using the alternativeRTO algorithms for CoAP congestion control, a slower in-crement of the number of dropped packets and a much lowerasymptotic value are observed. This means that the CoCoAalgorithms are capable of effectively decreasing the conges-tion in the network. The clear difference in the number ofdropped MAC layer packets between CoCoA and CoCoA-Sis a result of the different RTO estimations they apply. Incontrast to CoCoA-S, CoCoA additionally uses weak RTTmeasurements from retransmissions that may lead to largeRTOs. This throttles the output of packets and leads to afurther reduction of buffer overflows in the network.

An asymptotic behavior of the amount of dropped MAClayer packets is observable, because the actual amount oftraffic transmitted over the radio channel does not increasesignificantly further with the offered load at high trafficrates. On the other hand, due to the limitation given byNSTART=1 and increasing packet generation frequenciesat each node, the probability of dropping newly generatedCoAP messages gets higher with the offered load. For offeredload beyond the threshold where the amount of droppedMAC layer packets reaches its asymptotic value, the CoAPpacket drop rate is observed to increase almost linearly withthe amount of generated packets.

As mentioned before, the amount of hops between sourceand sink nodes in the dumbbell topology is low, resulting insmall RTTs. How the congestion control algorithms performwhen larger RTTs are observed can be demonstrated in thechain topology, where packets may have to travel along manyhops before reaching their destination. The radio links alongthe chain are not utilized equally. The links closer to the sinkwill be required more frequently for transmissions, as all thepackets from the other end of the chain need to traverse

1 10 1001

1.5

2

2.5

3

3.5

4

4.5

5

Offered load (kbps)

Ca

rrie

d lo

ad

(kb

ps)

CoAP (Default)CoCoACoCoA−S

Figure 5: Throughput achieved for different offered loads inthe chain topology with NSTART=1.

1 10 1000

200

400

600

800

1000

1200

Offered load (kbps)

Dro

pped M

AC

laye

r pack

ets

CoAP (Default)CoCoACoCoA−S

Figure 6: Dropped MAC layer packets for different offeredloads in the chain topology with NSTART=1.

them. On the other hand, due to spatial reuse, it is possiblefor several nodes to transmit in parallel along the chain,without interfering each other.

For this particular setup, the difference between the de-fault CoAP and the CoCoA mechanisms becomes larger, ascan be seen in Fig. 5. This shows that the CoCoA mecha-nisms are able to adapt to different RTT values and to thetraffic characteristics of the network. This observation canbe backed up by observing the amount of dropped MAClayer packets (Fig. 6), showing a similar behavior as inthe dumbbell topology, where the drop rates for the CoCoAmechanisms are much smaller than for default CoAP.

On the other hand, in the grid topology, the number ofhops between source and destination nodes varies a lot, sincemany combinations of links for the connection of source andsink nodes are possible. Therefore, RTTs of different scalescan be observed. Since within the transmission, and alsothe interference range of a node there will be more nodes,a congestion of the radio channel is more likely than in theother analyzed topologies.

The performance comparison for the grid topology re-veals that CoCoA mechanisms are able to perform signif-icantly better than default CoAP. Fig. 7 shows that CoCoAand CoCoA-S perform better than the default CoAP, evenwhen the offered load is small (starting at 4 kbps). How-ever, the performance achieved by the two advanced con-gestion control mechanisms is very similar for this topology.For the intermediate traffic rates, CoCoA gets many weakRTT measurements from retransmissions, increasing the es-

370

Achieved throughput in the chain topology, NSTART=1 (left) and NSTART=4 (right) [2].

1 10 1000

500

1000

1500

2000

2500

3000

3500

4000

4500

Offered load (kbps)

Dro

pp

ed

MA

C la

yer

pa

cke

ts

CoAP (Default)CoCoACoCoA−S

(a) Dropped MAC layer packets for different offered loads inthe dumbbell topology with NSTART=4.

1 10 1001

1.5

2

2.5

3

3.5

4

4.5

5

Offered load (kbps)

Ca

rrie

d lo

ad

(kb

ps)

CoAP (Default)CoCoACoCoA−S

1 10 1001

1.5

2

2.5

3

3.5

4

4.5

5

Offered load (kbps)

Ca

rrie

d lo

ad

(kb

ps)

CoAP (Default)CoCoACoCoA−S

(b) Throughput achieved for different offered loads in thegrid topology with NSTART=4.

1 10 1001

1.5

2

2.5

3

3.5

4

4.5

5

Offered load (kbps)C

arr

ied

loa

d (

kbp

s)

CoAP (Default)CoCoACoCoA−S

(c) Throughput achieved for different offered loads in thechain topology with NSTART=4.

Figure 9: Congestion control performances for NSTART=4.

to outperform the default CoAP congestion control mech-anism, while not requiring as much state information asCoCoA. With the results obtained in this paper, we canconfirm the relevance of advanced congestion control mech-anisms and confirm that for this purpose CoCoA is an in-teresting candidate.

As future work, the advanced congestion control mecha-nisms will be tested in more network topologies, other per-formance metrics will be evaluated and different traffic gen-eration patterns will be applied.

�� $&.12:/('*0(176This work has been supported by the Spanish Govern-

ment’s Ministerio de Economı́a y Competitividad throughproject TEC2012-32531 and by MICINN through projectTEC2009-11453, as well as by the Comissionat per a Univer-sitats i Recerca del DIUE from the Generalitat de Catalunya,the Social European Budget (Fons Social Europeu), andFEDER.

�� 5()(5(1&(6[1] C. Bormann. CoAP Simple Congestion

Control/Advanced (work in progress), August 2012.[2] C. Bormann and Z. Shelby. Blockwise transfers in

CoAP (work in progress), Feb. 2013.[3] Crossbow Technology Inc. TelosB mote platform,

2009.[4] D. S. J. De Couto, D. Aguayo, J. Bicket, and

R. Morris. A high-throughput path metric formulti-hop wireless routing. In Proceedings of the 9thannual international conference on Mobile computingand networking, MobiCom ’03, pages 134–146, NewYork, NY, USA, 2003. ACM.

[5] R. T. Fielding. Architectural styles and the design ofnetwork-based software architectures. PhD thesis,2000. AAI9980887.

[6] K. Hartke. Observing Resources in CoAP (work inprogress), Feb. 2013.

[7] M. Kovatsch, S. Duquennoy, and A. Dunkels. Alow-power coap for contiki. In Proceedings of the 8thIEEE International Conference on Mobile Ad-hoc andSensor Systems (MASS 2011), Valencia, Spain, Oct.2011.

[8] N. Kushalnagar, G. Montenegro, and C. Schumacher.IPv6 over Low-Power Wireless Personal AreaNetworks (6LoWPANs): Overview, Assumptions,Problem Statement, and Goals. RFC 4919(Informational), August 2007.

[9] Moteiv Corporation. TMote Sky: Ultra low powerIEEE 802.15.4 compliant wireless sensor module, June2006.

[10] F. Osterlind, A. Dunkels, J. Eriksson, N. Finne, andT. Voigt. Cross-level sensor network simulation withcooja. In Local Computer Networks, Proceedings 200631st IEEE Conference on, pages 641–648, 2006.

[11] C. Paxson, M. Allman, J. Chu, and M. Sargent.Computing TCP’s Retransmission Timer (RFC 6298),June 2011.

[12] Z. Shelby and C. Bormann. 6LoWPAN: The WirelessEmbedded Internet. Wiley Publishing, 2010.

[13] Z. Shelby, K. Hartke, and C. Bormann. Constrainedapplication protocol (CoAP), May 2013.

[14] Texas Instruments. Chipcon products: CC2420Datasheet: 2.4 GHz IEEE 802.15.4 / ZigBee-ready RFTransceiver, March 2013.

[15] T. Winter, P. Thubert, J. Hui, P. Kelsey, P. Levis,K. Pister, R. Struik, J. Vasseur, and R. Alexander.RPL: IPv6 Routing Protocol for Low-Power and LossyNetworks. Technical Report 6550, RFC Editor,Fremont, CA, USA, Mar. 2012.

[16] Zolertia. Z1 low-power wireless sensor networkmodule, March 2010.

372

Page 18: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

• Introduction

• Paper 1

• Paper 2

• Paper 3

• Next Steps

18

Page 19: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Drop the Phone and Talk to the Physical World: Programming the Internet of Things with Erlang

• A. Sivieri, L. Mottola and G. Cugalo

• Most embedded systems are developed in low-level languages, such as C

• Leaves a lot of responsibility to the developer

• Difficult to test, maintain and port

• Solution: a high-level programming model for the IoT

19

Page 20: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Erlang

• Actor-like concurrency model (masking distribution)

• Functional core (dynamic typing, pattern-matching)

• Embedded system support (pattern-matching on bit streams)

• Code can be hot-swapped

20

Page 21: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

ELIoT• Library for constrained, distributed environments

• Many-to-many syntax, not based on TCP

• Interpreter without unnecessary features

• Smaller memory requirements (few MB)

• Simulator to validate implementation

• Transparent migration to real hardware

21

Page 22: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Analysis• Implementation of three

routing protocols

• Flooding, Tickle and CTP

• 62 simulated devices and 2 real ones

• Compare lines of code to TinyOS and Contiki

22

• Few lines of code for complex protocols

Figure 4. ELIOT processes monitor.

computes routing metrics to the closest sink and reportchanges to the routing process. This, in turn, provides theforwarding process with the most efficient route to use.Splitting functionality results in more readable code, witha correct separation of concerns, making the individual pro-cesses more reusable. Moreover, the hot-swapping capabilitycan be used for changing only one part of the protocol, e.g.,to replace the link estimation protocol with a different one.

Figure 4 is a snapshot of the processes monitor interfacewhile running CTP. The process monitor allows to inspecteach process, showing variable values and letting developersinsert breakpoints into the code. The screenshot refers to amixed network configuration, enabled by our simulator: weuse a laptop running 14 simulated nodes, a more powerfuldesktop running 48 simulated nodes, and two real ARMdevices. The possibility of inspecting the state of simulatednodes using the process monitor, while they interact withthe real devices allowed us to easily spot bugs.

Comparison. We were also interested in measuring to whatextent ELIOT reduces the programming effort. To thisend, we measure the uncommented lines of code as anapproximate measure of the coding effort and we comparethe ELIOT implementations of the aforementioned protocolswith their counterparts in TinyOS [10] and Contiki [11].

Figure I reports the values we measured. It shows that themore complex is the protocol, the greater is the advantagein using ELIOT. Indeed, while Contiki already provides a(slight) advantage over TinyOS, ELIOT shows even greaterimprovements, due to the functional and declarative model.This, together with the powerful pattern matching and seri-alization/deserialization features, results in implementations

Table IPROTOCOL IMPLEMENTATIONS LINES OF CODE.

Algorithm TinyOS Contiki ELIOTOpportunistic flooder 495 187 100Trickle 219 194 61CTP 2169 1470 303

up to seven times more compact than their TinyOS andContiki counterparts.

V. RELATED WORK

Solutions exist to develop applications spanning bothstandard Internet devices and networks of embedded sensorsand actuators. As example, the CoAP framework provides aRESTful interface on resource-poor devices [17]. Implemen-tations of such framework exist for common sensor networkplatforms [18]. Unlike our approach, however, the appli-cation logic runs entirely outside the embedded network,whereas sensor and actuators are essentially application-agnostic. This spares the need for embedded system pro-gramming at the price of reduced performance. Differently,we design ELIOT to allow developers to deploy even theentire application logic on embedded devices, while stillretaining a high-level programming model.

The operating system facilities are the most used program-ming platform in sensor networks. However, the low levelof abstraction typically provided usually results in entangledimplementation that are difficult to debug and maintain [2].In this setting, TinyOS [10] and Contiki [11], which weuse in the comparison of Section IV, are most often em-ployed. Commercial products may also come with their ownplatform-specific APIs [19]. Applications developed atopthese APIs, however, are often difficult to port to differentplatforms.

Higher-level sensor network programming abstractions,on the other hand, often sacrifice generality for simplic-ity [2]. For example, Regiment [20] features a functionalprogramming model, providing primitives such as fold andmap to process data originating from subsets of nodes.Flask [6] provides a data-flow programming model based ondiscrete computational steps, akin to side effect-free functioncalls. Snlog [21] is a rule-oriented approach inspired bylogical programming, where rules are recursively applied ondata available in a dedicated repository. Common to theseapproaches—and in fact to most solutions in the field [2]—is that the language constructs are compiled to TinyOS orContiki code before deployment. Thus, the code running onthe embedded device bears little resemblance to the hand-written one, complicating testing and debugging.

ELIOT sits in the middle between an operating systemlayer and higher-level programming solutions. It still allowsthe implementation of both system- and application-levelfunctionality, yet it spares programmers from many low-level details and the intricacies of OS-level scheduling. Thelatter is mainly due to the actor-like concurrency model,

Lines of code comparison [3].

Page 23: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Further Questions

• Paper does not present the network stack

• Why is message passing limited to a single-hop?

• Code has not been published

• Author is still active!

23

Page 24: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

• Introduction

• Paper 1

• Paper 2

• Paper 3

• Next Steps

24

Page 25: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Next Steps• Implement a network stack

• Transaction based message passing

• Use protocols for the IoT

• Future work

• Setup test environment

• Address Internet-wide systems (HTTP, NATs, …)

• Encryption and authentication

IEEE 802.15.4

6LoWPAN

UDP

DTLS

CoAP

libcppa

Ethernet / WLAN

IPv4 / IPv6

TCP

Adapting the network stack of libcppa to the IoT.

25

Page 26: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

Thank you! Questions?

26

Page 27: Loosely Coupled Communication in Actor Systemsubicomp/... · 2014-05-22 · facets follow loosely coupled options) we can conclude that using RESTful HTTP would provide a system architecture

References[1] Pautasso, Cesare and Wilde, Erik (2009). Why is the Web Loosely Coupled?: A Multi-faceted Metric for Service Design. In Proceedings of the 18th International Conference on World Wide Web, WWW ’09, pages 911–920, New York, NY, USA. ACM.

[2] Betzler, August and Gomez, Carles and Demirkol, Ilker and Paradells, Josep (2013). Congestion Control in Reliable CoAP Communication. In Proceedings of the 16th ACM International Conference on Modeling, Analysis & Simulation of Wireless and Mobile Systems, MSWiM ’13, pages 365–372, New York, NY, USA. ACM.

[3] Sivieri, A. and Mottola, L. and Cugola, G. (2012). Drop the phone and talk to the physical world: Programming the internet of things with Erlang. In Software Engineering for Sensor Network Applications (SESENA), 2012 Third International Workshop on, pages 8–14.

[4] Shelby, Z., Hartke, K., and Bormann, C. (2013). Constrained Application Protocol (CoAP). Internet-Draft – work in progress 18, IETF.

[5] Bormann, C. (2014). CoAP Simple Congestion Control/Advanced. Internet-Draft – work in progress 01, IETF.

27