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
               Computer Platform Research Center (CIPI)
                 University of Padova & Genova (Italy)
                     Honolulu, HI, June 28th, 2012

  Follow me on Twitter: @steccami
  E-mail: m.stecca@cipi.unige.it
cipi    Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche




                    Agenda

1.   Introduction
2.   Mashup Execution Platform (MEP) Design
3.   The Scala programming language
4.   A Scala-based MEP
5.   Performance evaluation
6.   Conclusions


                                                                                      2
cipi      Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche



                1. Introduction (1/5)
…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)
cipi         Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche



                     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.

                                                                                              4
cipi        Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche



                 1. Introduction (3/5)
The Mashup Creation Platform
cipi          Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche



                 1. Introduction (4/5)
The Mashup Creation Platform
                                                               Event Date: July 1st, 2012
                                                               Event Title: Final Match




         Check if RSS item contains
         “Italy defeated Germany”


                                                 TweetText = RSS_Eurosport.title
cipi        Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche



                  1. Introduction (5/5)
System overview

                               Mashup Creation Platform




                                              Mashup Repository




                      Mashup Execution Platform
                        (Server-side platform)
cipi             Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


                           2. The MEP Design (1/2)
We already implemented a Java-based MEP* whose
   high level architecture is depicted in the figure




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




*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                                                                        8
cipi           Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


                         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
                                                                                                    9
cipi       Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


          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                                                  10
cipi       Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


       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;
             …
               }
    }
                                                                                          11
cipi       Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


       3. The Scala programming language (3/4)
   Case 1: onMessage=receive primitive




The concurrency model falls back to the Thread model

                                                                                          12
cipi       Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


       3. The Scala programming language (4/4)
   Case 2: onMessage=react primitive




The concurrency model is event driven (a.k.a., threadless
   model)
                                                                                          13
cipi     Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


                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                                                      14
cipi     Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


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




                                                                            15
cipi     Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


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




                                                                                      16
cipi     Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


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




                                                                                        17
cipi       Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


                 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




                                                                                               18
cipi     Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche


              5. Performance Evaluation (2/2)

The results




                                                                                          19
cipi    Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche




                     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
                                                                                       20
cipi         Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche




           Thank you for
           your attention!

Michele Stecca
Follow me on Twitter: @steccami
Email: m.stecca@cipi.unige.it                                                               21

Scc2012 Scala

  • 1.
    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 Computer Platform Research Center (CIPI) University of Padova & Genova (Italy) Honolulu, HI, June 28th, 2012 Follow me on Twitter: @steccami E-mail: m.stecca@cipi.unige.it
  • 2.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche Agenda 1. Introduction 2. Mashup Execution Platform (MEP) Design 3. The Scala programming language 4. A Scala-based MEP 5. Performance evaluation 6. Conclusions 2
  • 3.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 1. Introduction (1/5) …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)
  • 4.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 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. 4
  • 5.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 1. Introduction (3/5) The Mashup Creation Platform
  • 6.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 1. Introduction (4/5) The Mashup Creation Platform Event Date: July 1st, 2012 Event Title: Final Match Check if RSS item contains “Italy defeated Germany” TweetText = RSS_Eurosport.title
  • 7.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 1. Introduction (5/5) System overview Mashup Creation Platform Mashup Repository Mashup Execution Platform (Server-side platform)
  • 8.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 2. The MEP Design (1/2) We already implemented a Java-based MEP* whose high level architecture is depicted in the figure SP=Service Proxy (i.e., a wrapper for Web APIs) *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 8
  • 9.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 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 9
  • 10.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 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 10
  • 11.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 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; … } } 11
  • 12.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 3. The Scala programming language (3/4)  Case 1: onMessage=receive primitive The concurrency model falls back to the Thread model 12
  • 13.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 3. The Scala programming language (4/4)  Case 2: onMessage=react primitive The concurrency model is event driven (a.k.a., threadless model) 13
  • 14.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 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 14
  • 15.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 4. A Scala-based MEP (2/4) 15
  • 16.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 4. A Scala-based MEP (3/4)  The reference example OAI=Orchestrator Actor Instance 16
  • 17.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 4. A Scala-based MEP (4/4) The Orchestrator component in Scala (code) 17
  • 18.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 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 18
  • 19.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 5. Performance Evaluation (2/2) The results 19
  • 20.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche 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 20
  • 21.
    cipi Centro di Ricerca sull’Ingegneria delle Piattaforme Informatiche Thank you for your attention! Michele Stecca Follow me on Twitter: @steccami Email: m.stecca@cipi.unige.it 21