Scc2012 Scala

21
cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche Event-Driven Mashup Orchestration with Scala Michele Stecca , Martino Fornasa, Nicholas Dall’Armellina, and Massimo Maresca Follow me on Twitter: @steccami E-mail: [email protected] Computer Platform Research Center (CIPI) University of Padova & Genova (Italy) Honolulu, HI, June 28 th , 2012

Transcript of Scc2012 Scala

Page 1: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

Event-Driven Mashup Orchestration with Scala

Michele Stecca, Martino Fornasa, Nicholas Dall’Armellina, and Massimo Maresca

Follow me on Twitter: @steccamiE-mail: [email protected]

Computer Platform Research Center (CIPI)

University of Padova & Genova (Italy)

Honolulu, HI, June 28th, 2012

Page 2: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

2

Agenda

1. Introduction

2. Mashup Execution Platform (MEP) Design

3. The Scala programming language

4. A Scala-based MEP

5. Performance evaluation

6. Conclusions

Page 3: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

…about the ‘Mashup’ concept

Data Mashup: combining different data sources (e.g., Yahoo!Pipes)

Presentation Mashup: combining different gadgets/widgets in a web page (e.g., iGoogle)

Process/Functional Mashup: combining different services/Web APIs (e.g., JackBe Presto but also IFTTT)

1. Introduction (1/5)

Page 4: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

4

1. Introduction (2/5)

Reference Scenario Availability of contents and services through technologies

typical of the Web 2.0 philosophy such as RSS Feed, Atom, REST-WS, SOAP-WS, etc. See programmableweb.com for a list of more than 6000 Web APIs

Internet/Web of Things (need for event management)

Availability of tools for the rapid development of convergent Composite Services (a.k.a., Mashups) that combine different resources such as Yahoo Pipes!, JackBe Presto, etc.

Page 5: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

The Mashup Creation Platform1. Introduction (3/5)

Page 6: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

The Mashup Creation Platform1. Introduction (4/5)

Check if RSS item contains “Italy defeated Germany”

Event Date: July 1st, 2012Event Title: Final Match

TweetText = RSS_Eurosport.title

Page 7: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

Mashup Repository

Mashup Execution Platform(Server-side platform)

Mashup Creation Platform

1. Introduction (5/5)System overview

Page 8: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

8

2. The MEP Design (1/2)

We already implemented a Java-based MEP* whose high level architecture is depicted in the figure

*Stecca M., Maresca M., “An Architecture for a Mashup Container in Virtualized Environments”, Cloud, pp.386-393, 2010 IEEE 3rd International Conference on Cloud Computing, Miami, Florida, 2010

SP=Service Proxy (i.e., a wrapper for Web APIs)

Page 9: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

9

2. The MEP Design (2/2)

The MEP has been designed as a Server-side platform “in-the-cloud” (reasons: security, performance optimization, always-on, etc.)

It is important to chose a suitable concurrency model because of the huge number of Mashup executions taking place concurrently

Two approaches: Thread-based (but difficult to optimize the resource usage) Event-driven (but difficult to develop)

How can we improve the existing Java-based MEP performance without re-developing the system from the scratch?

Possible answer: by using the Scala programming language

Page 10: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

10

3. The Scala programming language (1/4) Developed at the EPFL Lausanne,

Switzerland It merges the Functional Programming (FP)

and the OOP paradigms It is executed by a JVM Fully compatibility

with legacy Java libraries Concurrency model: actors (e.g., Erlang)

It is suitable to exploit the multi-core processors An actor is a “computational unit” lighter than a

system thread Actors communicate among each others

according to the message passing paradigm DestinationActor ! Message

Page 11: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

11

3. The Scala programming language (2/4)

Here is the typical Scala Actor’s body (pseudocode)

Loop{ onMessage{ Case Message1=> Process Message1;

Case Message2=> Process Message2;

… }

}

Page 12: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

12

3. The Scala programming language (3/4)

Case 1: onMessage=receive primitive

The concurrency model falls back to the Thread model

Page 13: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

13

3. The Scala programming language (4/4)

Case 2: onMessage=react primitive

The concurrency model is event driven (a.k.a., threadless model)

Page 14: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

14

4. A Scala-based MEP (1/4) The Java-based MEP has been developed in

modular way (i.e., clear separation between the Business Logic and the Concurrency logic)

The idea is to exploit at the same time: The Java-based MEP implementation The efficient Scala concurrency model

based on actors What have we done?

We mapped the Orchestrator component and each SP into Scala actors

We defined the MessageDo and the MessageEvent Scala messages

Page 15: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

15

4. A Scala-based MEP (2/4)

Page 16: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

16

4. A Scala-based MEP (3/4) The reference example OAI=Orchestrator Actor Instance

Page 17: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

17

4. A Scala-based MEP (4/4)The Orchestrator component in Scala (code)

Page 18: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

18

5. Performance Evaluation (1/2)The testbed Two nodes (QuadCore, 4GB RAM, Ubuntu OS)

Node 1: traffic injector Node 2: the Scala-based MEP

Deployment of 2 fake SPs and 1 fake Mashup Definition of two metrics:

Mashup Execution Time (MET) #Threads

Page 19: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

19

5. Performance Evaluation (2/2)

The results

Page 20: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

20

6. Conclusions

We successfully migrated the Java-based MEP to Scala

The evaluation tests show how the Scala-based MEP outperforms the Java-based MEP

Future work: Additional performance tests Focus on the Service Proxy (i.e., adpatation)

level

Final Match vs

Page 21: Scc2012 Scala

cipi

Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche

21

Thank you for your attention!

Follow me on Twitter: @steccamiEmail: [email protected]

Michele Stecca