SlideShare a Scribd company logo
1 of 38
SAN FRANCISCO, CA, USA




Daniele Bonetta Achille Peternier
Cesare Pautasso Walter Binder
http://sosoa.inf.unisi.ch
SOSOA
                                         Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




• Self-Organizing Service Oriented
  Architectures

• Exploring novel, self-adapting approaches
  to the design of SOAs

• Overcome limitations of current SOAs
   performance on modern infrastructures
       • Multicores
       • Cloud


  CHANGE 2012 – San Francisco, CA, USA                                                                     2
RESTful Web Services
                                           Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments



• Architectural style:
   Client/Server architecture
   Stateless interaction
   Resources               Client                                Client                      Client
      • URIs




                                                                     HTTP
   Uniform HTTP interface
      • GET, PUT, POST, DELETE
                                                            RESTful Web
                                                              Services
                                                      Resource               Resource


                                                      Resource               Resource

    CHANGE 2012 – San Francisco, CA, USA                                                                     3
HTTP uniform interface
                                                Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




    HTTP Method                        Properties                        Parallelism

                                Idempotent, safe,
          GET                                                                   Yes
                                    stateless

                                       Idempotent,
          PUT                                                            If stateless
                                       side-effects

                                       Idempotent,
        DELETE                                                           If stateless
                                       side-effects

         POST                          side-effects                      If stateless



CHANGE 2012 – San Francisco, CA, USA                                                                              4
Goal
                                        Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




 “Design a new language to develop and
   compose RESTful Web Services that
  automatically scale in the number of
clients using the available cores and safe
           implicit parallelism”




 CHANGE 2012 – San Francisco, CA, USA
                                                                                 S                        5
RESTful Web
   Services




              S framework




                   Multicore server
RESTful Web
          Services



                        S language
S compiler




                        S runtime



                     Multicore server
RESTful Web
          Services



                        S language
S compiler




                        S runtime



                     Multicore server
“Node.js is a platform built on Chrome's JavaScript
runtime for easily building fast, scalable network
applications. Node.js uses an event-driven, non-blocking
I/O model that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run across
distributed devices.”

                                   (source: www.nodejs.org)
Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




• Single process
• Based on asynchronous event-loop and
  callbacks


     on („someEvent‟, doSomething(req, res))

     on („somethingElse‟, function(req, res) {
        // ...
     })




CHANGE 2012 – San Francisco, CA, USA                                                                   10
Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




• Asynchronous non-blocking I/O ✔
• No locks/synchronization ✔

• Sequential composition: nested callbacks ✘
• Problems with long-running callbacks ✘
• Limited support for parallelism ✘




CHANGE 2012 – San Francisco, CA, USA                                                                   11
S language
S design principles
                                        Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




• High-level architectural abstractions
     Based on services and resources
     No threads/processes
          • No synchronization/locks


• Simple, clean programming model
     Allows blocking function calls
     Constructs for parallel I/O
     REST/HTTP as part of the language

 CHANGE 2012 – San Francisco, CA, USA                                                                   13
S Architecture
                                                  Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                   S language

                                       S Service
                                                                                              S code
                 S Resource            S Resource         S Resource


                 NodeJS     NodeJS       NodeJS     NodeJS         NodeJS

                                                                                          Asynchronous
                      S IPC Communication Framework                                       Non-blocking
                                                                                          NodeJS code
                                 Non-blocking I/O


                   S runtime

CHANGE 2012 – San Francisco, CA, USA                                                                              14
S Hello World
                                             Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                                       URI                           HTTP
      Resource                                                       method

                        res „/hello‟ on GET {
                          respond „World!‟
                        }
                                                   JavaScript
                                                   or S code




CHANGE 2012 – San Francisco, CA, USA                                                                         15
S Hello World
                                              Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                        res „/hello‟ on GET {
                          respond „World!‟
                        }


                                                           S
                    Client             HTTP
                                                         Service

                               GET /hello HTTP/1.1
                               User-Agent: curl
                               Accept: */*
                               Host: your.host
CHANGE 2012 – San Francisco, CA, USA                                                                          16
S Hello World
                                              Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                        res „/hello‟ on GET {
                          respond „World!‟
                        }


                                                           S
                    Client             HTTP
                                                         Service

                              HTTP/1.1 200 OK
                              Content-Type: text/plain

                              World!
CHANGE 2012 – San Francisco, CA, USA                                                                          17
S Compositions
                                       Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




   res „/hello1‟ on GET {
     respond get „http://www.site.com‟
   }

                                                                Native HTTP
                                                                  support

   res „/hello2‟ on GET {
     respond get „/hello1‟
   }

CHANGE 2012 – San Francisco, CA, USA                                                                   18
S Compositions
                                                  Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




         res „/hello1‟ on GET {
           respond get „http://www.site.com‟
         }

Client      HTTP          /hello2          HTTP      /hello1              HTTP             www.site.com



         res „/hello2‟ on GET {
           respond get „/hello1‟
         }

    CHANGE 2012 – San Francisco, CA, USA                                                                          19
S Parallelism
                                            Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




              res „/res1‟ on GET {
                // ...                                                    Parallel
                // CPU-bound blocking call:                              resources
                var a = foo()
                respond a
              }


              res „/res2‟ on GET {
                // ...
                res r = „http://www.google.ch/search=@‟
                                                                                Atomic and
                  // I/O bound operation:
                  boo = r.get(„key‟)                                            consistent
                  respond boo                                                     blocks
              }
 CHANGE 2012 – San Francisco, CA, USA                                                                       20
Adaptivity
                                               Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




From other
workers                       Request handler processor
    S
   S
  Worker
  S                                                                                    Responses
 Worker
Worker
                                            Worker #1                   HTTP                 Client
Requests                 /res                                                                 Client
                                                                                                Client
  Client
 Client
               HTTP           Router                …
Client
                                               Worker #n



                          Parallelism degree
                            controller (PI)

    CHANGE 2012 – San Francisco, CA, USA                                                                       21
S compiler
Stateful services
                                          Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                                                    State shared
       res „/helloState‟ {                            between
         state s = „world‟                           callbacks
         on GET {
           respond „hello‟ + s
                                                      Read-only
         }
                                                      operations
         on PUT {
           s = req.name
         }
                                          Write
       }
                                        operations




 CHANGE 2012 – San Francisco, CA, USA                                                                     23
I/O-bound operations
                                         Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




• Synchronous I/O operations are
  desynchronized by the S compiler using
  multiple callbacks




  CHANGE 2012 – San Francisco, CA, USA                                                                   24
Sequential composition
                                       Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




             res „/example‟ on GET {
               var a = get „www.google.com‟
               var b = get „www.bing.com‟
               var c = get „www.yahoo.com‟
               respond a+b+c
             }




CHANGE 2012 – San Francisco, CA, USA
                                                                                S                      25
Sequential composition
                                       Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments

       http.createServer(function(creq, cres) {
          if (creq.method == „GET‟ && creq.url == „/example‟) {
              var a, b, c = „‟
              startGet(„www.google.com‟,
                function(req, res) {
                  a = res.body
                  startGet(„www.bing.com‟,
                    function(req, res) {




                                                                   S
                       b = res.body
                         startGet(„www.yahoo.com‟,
                           function(req, res) {
                              c = res.body
                              cres.end(a+b+c)
                           })
                     })
                 })
           }
       })
CHANGE 2012 – San Francisco, CA, USA                                                                   26
Parallel composition
                                       Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




   res „/example‟ on GET {
     par {
       var a = get „www.google.com‟
       var b = get „www.bing.com‟
       var c = put „www.site.com/?d=‟+b
       respond a+c
     }




                                                                                S
   }




CHANGE 2012 – San Francisco, CA, USA                                                                   27
Parallel composition
                                                    Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                                          get                get



                                       var a=…         var b=…


res „/example‟ on GET {                                      put
  par {
    var a = get „www.google.com‟
    var b = get „www.bing.com‟
    var c = put „www.site.com/?d=‟+b                    var c=…
    respond a+c
  }
}
                                                respond


       CHANGE 2012 – San Francisco, CA, USA                                                                         28
Parallel composition
                                             Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments



http.createServer(function(req, res) {
  if (creq.method == „GET‟ && creq.url == „/example‟) {
    var G = {}
    on („done1‟, function(result) {
       G.a = result; emit(„done3‟) })
    on („done2‟, function(result) {
       G.b = result;
       startPut(„www.site.com./d?=„ + G.b, „done4‟)




                                                                         S
    })
    on („done4‟, function(result) {
       G.c = result;
       emit(„done5‟)
    })
    onAll([„done3‟,„done5‟], function() {
       res.end(G.a + G.c)
    })
    startGet(„www.google.com‟, „done1‟)
    startGet(„www.bing.com‟, „done2‟)
  }
})
 CHANGE 2012 – San Francisco, CA, USA                                                                        29
Two levels of parallelism
                                                 Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                           e.g.: travel
               Async I/O     agency




I/O-bound



                                                                                     e.g.: Fibonacci
                                                                                          series

                                          Number of Workers
                                             CPU-bound
    CHANGE 2012 – San Francisco, CA, USA                                                                         30
Example: Crawler
                                                         Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments


  service crawl {
    res „/crawl„ on PUT {
       var filter = require(„HTMLparser.js‟).filter
       res store = „/store?value=@‟
       res crawl = „/crawl?list=@‟

          pfor(var i in req.list) {
                                                           Parallel
            var list = filter(get req.list[i])            recursive
            par {                                          crawling
               store.put(list)
               crawl.put(list)
            }
          }
      }

      res „/store„ {
        state s = „‟
        on PUT {
            s += req.value                          Result
        }
        on GET {
                                                 accumulation
            respond s
        }
      }
  }

CHANGE 2012 – San Francisco, CA, USA                                                                                     31
Example: Crawler RT
                                             Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                                                                                            /url
                                                                                              /url
                                                                                                /url


                                              Worker #1
                         /crawl               Worker #2
      L=
[url1, url2, …]
                               Router                …
                                              Worker #n                            /store
                                                                                         Router

                                                                                                  State


      CHANGE 2012 – San Francisco, CA, USA                                                                   32
Crawler performance
                                         Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                               24 cores server




CHANGE 2012 – San Francisco, CA, USA                                                                     33
Challenges
                                               Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




                                              Worker #1
                                /res
                                  Router         …
                                              Worker #n




                                       Monitor and
               Worker #1
                                        controller                                          Worker #1
/res                                                                  /res
  Router          …                                                      Router                 …
                Worker #n                                                                    Worker #n




       Monitor and                     CPU I/O                               Monitor and
        controller                                                            controller



CHANGE 2012 – San Francisco, CA, USA                                                                           34
Challenges
                                       Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




CHANGE 2012 – San Francisco, CA, USA                                                                   35
Challenges
                                       Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




      Client               HTTP




CHANGE 2012 – San Francisco, CA, USA                                                                   36
Challenges
                                       Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




      Client




CHANGE 2012 – San Francisco, CA, USA                                                                   37
Thank you
                                         Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments




http://sosoa.inf.unisi.ch

D. Bonetta, A. Peternier, C. Pautasso, W. Binder
S: a Scripting Language for High-Performance RESTful Web
Services
17th ACM SIGPLAN Symposium on Principles and Practice of Parallel
Programming (PPoPP 2012), pp. 97-106, New Orleans, LA, USA, 2012




  CHANGE 2012 – San Francisco, CA, USA
                                                                                  S                      38

More Related Content

Similar to S: a Scripting Language for High-Performance RESTful Web Services

AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...Bojan Veljanovski
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)Sascha Wenninger
 
Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Chris Richardson
 
Connect js nodejs_api_shubhra
Connect js nodejs_api_shubhraConnect js nodejs_api_shubhra
Connect js nodejs_api_shubhraShubhra Kar
 
Enterprise Mashups With Soa
Enterprise Mashups With SoaEnterprise Mashups With Soa
Enterprise Mashups With Soaumityalcinalp
 
Utilizing Open Data for interactive knowledge transfer
Utilizing Open Data for interactive knowledge transferUtilizing Open Data for interactive knowledge transfer
Utilizing Open Data for interactive knowledge transferMonika Steinberg
 
Applications of the REST Principle
Applications of the REST PrincipleApplications of the REST Principle
Applications of the REST Principleelliando dias
 
Java, BA,UI resumes
Java, BA,UI resumesJava, BA,UI resumes
Java, BA,UI resumesNeel A
 
Apurva.hp(July) copy
Apurva.hp(July) copyApurva.hp(July) copy
Apurva.hp(July) copyApurva Hp
 
RESTful Architecture
RESTful ArchitectureRESTful Architecture
RESTful ArchitectureKabir Baidya
 
Abhishek Kumar - Resume - Software Engineer
Abhishek Kumar - Resume - Software EngineerAbhishek Kumar - Resume - Software Engineer
Abhishek Kumar - Resume - Software EngineerAbhishek Kumar
 

Similar to S: a Scripting Language for High-Performance RESTful Web Services (20)

AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
 
Radhakrishnan Moni
Radhakrishnan MoniRadhakrishnan Moni
Radhakrishnan Moni
 
Ranjith_Reddy Yallampalli Resume
Ranjith_Reddy Yallampalli ResumeRanjith_Reddy Yallampalli Resume
Ranjith_Reddy Yallampalli Resume
 
LinkedInResume
LinkedInResumeLinkedInResume
LinkedInResume
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
 
Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)
 
Anoop Saxena
Anoop SaxenaAnoop Saxena
Anoop Saxena
 
Unit 01 - Introduction
Unit 01 - IntroductionUnit 01 - Introduction
Unit 01 - Introduction
 
Connect js nodejs_api_shubhra
Connect js nodejs_api_shubhraConnect js nodejs_api_shubhra
Connect js nodejs_api_shubhra
 
Resume
ResumeResume
Resume
 
Iottoolkit osiot
Iottoolkit osiotIottoolkit osiot
Iottoolkit osiot
 
Enterprise Mashups With Soa
Enterprise Mashups With SoaEnterprise Mashups With Soa
Enterprise Mashups With Soa
 
Os Pittaro
Os PittaroOs Pittaro
Os Pittaro
 
Utilizing Open Data for interactive knowledge transfer
Utilizing Open Data for interactive knowledge transferUtilizing Open Data for interactive knowledge transfer
Utilizing Open Data for interactive knowledge transfer
 
Applications of the REST Principle
Applications of the REST PrincipleApplications of the REST Principle
Applications of the REST Principle
 
Java, BA,UI resumes
Java, BA,UI resumesJava, BA,UI resumes
Java, BA,UI resumes
 
Apurva.hp(July) copy
Apurva.hp(July) copyApurva.hp(July) copy
Apurva.hp(July) copy
 
RESTful Architecture
RESTful ArchitectureRESTful Architecture
RESTful Architecture
 
Abhishek Kumar - Resume - Software Engineer
Abhishek Kumar - Resume - Software EngineerAbhishek Kumar - Resume - Software Engineer
Abhishek Kumar - Resume - Software Engineer
 
Sanjay_shaw
Sanjay_shawSanjay_shaw
Sanjay_shaw
 

Recently uploaded

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

S: a Scripting Language for High-Performance RESTful Web Services

  • 1. SAN FRANCISCO, CA, USA Daniele Bonetta Achille Peternier Cesare Pautasso Walter Binder http://sosoa.inf.unisi.ch
  • 2. SOSOA Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments • Self-Organizing Service Oriented Architectures • Exploring novel, self-adapting approaches to the design of SOAs • Overcome limitations of current SOAs  performance on modern infrastructures • Multicores • Cloud CHANGE 2012 – San Francisco, CA, USA 2
  • 3. RESTful Web Services Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments • Architectural style:  Client/Server architecture  Stateless interaction  Resources Client Client Client • URIs HTTP  Uniform HTTP interface • GET, PUT, POST, DELETE RESTful Web Services Resource Resource Resource Resource CHANGE 2012 – San Francisco, CA, USA 3
  • 4. HTTP uniform interface Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments HTTP Method Properties Parallelism Idempotent, safe, GET Yes stateless Idempotent, PUT If stateless side-effects Idempotent, DELETE If stateless side-effects POST side-effects If stateless CHANGE 2012 – San Francisco, CA, USA 4
  • 5. Goal Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments “Design a new language to develop and compose RESTful Web Services that automatically scale in the number of clients using the available cores and safe implicit parallelism” CHANGE 2012 – San Francisco, CA, USA S 5
  • 6. RESTful Web Services S framework Multicore server
  • 7. RESTful Web Services S language S compiler S runtime Multicore server
  • 8. RESTful Web Services S language S compiler S runtime Multicore server
  • 9. “Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.” (source: www.nodejs.org)
  • 10. Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments • Single process • Based on asynchronous event-loop and callbacks on („someEvent‟, doSomething(req, res)) on („somethingElse‟, function(req, res) { // ... }) CHANGE 2012 – San Francisco, CA, USA 10
  • 11. Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments • Asynchronous non-blocking I/O ✔ • No locks/synchronization ✔ • Sequential composition: nested callbacks ✘ • Problems with long-running callbacks ✘ • Limited support for parallelism ✘ CHANGE 2012 – San Francisco, CA, USA 11
  • 13. S design principles Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments • High-level architectural abstractions  Based on services and resources  No threads/processes • No synchronization/locks • Simple, clean programming model  Allows blocking function calls  Constructs for parallel I/O  REST/HTTP as part of the language CHANGE 2012 – San Francisco, CA, USA 13
  • 14. S Architecture Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments S language S Service S code S Resource S Resource S Resource NodeJS NodeJS NodeJS NodeJS NodeJS Asynchronous S IPC Communication Framework Non-blocking NodeJS code Non-blocking I/O S runtime CHANGE 2012 – San Francisco, CA, USA 14
  • 15. S Hello World Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments URI HTTP Resource method res „/hello‟ on GET { respond „World!‟ } JavaScript or S code CHANGE 2012 – San Francisco, CA, USA 15
  • 16. S Hello World Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments res „/hello‟ on GET { respond „World!‟ } S Client HTTP Service GET /hello HTTP/1.1 User-Agent: curl Accept: */* Host: your.host CHANGE 2012 – San Francisco, CA, USA 16
  • 17. S Hello World Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments res „/hello‟ on GET { respond „World!‟ } S Client HTTP Service HTTP/1.1 200 OK Content-Type: text/plain World! CHANGE 2012 – San Francisco, CA, USA 17
  • 18. S Compositions Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments res „/hello1‟ on GET { respond get „http://www.site.com‟ } Native HTTP support res „/hello2‟ on GET { respond get „/hello1‟ } CHANGE 2012 – San Francisco, CA, USA 18
  • 19. S Compositions Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments res „/hello1‟ on GET { respond get „http://www.site.com‟ } Client HTTP /hello2 HTTP /hello1 HTTP www.site.com res „/hello2‟ on GET { respond get „/hello1‟ } CHANGE 2012 – San Francisco, CA, USA 19
  • 20. S Parallelism Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments res „/res1‟ on GET { // ... Parallel // CPU-bound blocking call: resources var a = foo() respond a } res „/res2‟ on GET { // ... res r = „http://www.google.ch/search=@‟ Atomic and // I/O bound operation: boo = r.get(„key‟) consistent respond boo blocks } CHANGE 2012 – San Francisco, CA, USA 20
  • 21. Adaptivity Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments From other workers Request handler processor S S Worker S Responses Worker Worker Worker #1 HTTP Client Requests /res Client Client Client Client HTTP Router … Client Worker #n Parallelism degree controller (PI) CHANGE 2012 – San Francisco, CA, USA 21
  • 23. Stateful services Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments State shared res „/helloState‟ { between state s = „world‟ callbacks on GET { respond „hello‟ + s Read-only } operations on PUT { s = req.name } Write } operations CHANGE 2012 – San Francisco, CA, USA 23
  • 24. I/O-bound operations Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments • Synchronous I/O operations are desynchronized by the S compiler using multiple callbacks CHANGE 2012 – San Francisco, CA, USA 24
  • 25. Sequential composition Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments res „/example‟ on GET { var a = get „www.google.com‟ var b = get „www.bing.com‟ var c = get „www.yahoo.com‟ respond a+b+c } CHANGE 2012 – San Francisco, CA, USA S 25
  • 26. Sequential composition Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments http.createServer(function(creq, cres) { if (creq.method == „GET‟ && creq.url == „/example‟) { var a, b, c = „‟ startGet(„www.google.com‟, function(req, res) { a = res.body startGet(„www.bing.com‟, function(req, res) { S b = res.body startGet(„www.yahoo.com‟, function(req, res) { c = res.body cres.end(a+b+c) }) }) }) } }) CHANGE 2012 – San Francisco, CA, USA 26
  • 27. Parallel composition Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments res „/example‟ on GET { par { var a = get „www.google.com‟ var b = get „www.bing.com‟ var c = put „www.site.com/?d=‟+b respond a+c } S } CHANGE 2012 – San Francisco, CA, USA 27
  • 28. Parallel composition Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments get get var a=… var b=… res „/example‟ on GET { put par { var a = get „www.google.com‟ var b = get „www.bing.com‟ var c = put „www.site.com/?d=‟+b var c=… respond a+c } } respond CHANGE 2012 – San Francisco, CA, USA 28
  • 29. Parallel composition Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments http.createServer(function(req, res) { if (creq.method == „GET‟ && creq.url == „/example‟) { var G = {} on („done1‟, function(result) { G.a = result; emit(„done3‟) }) on („done2‟, function(result) { G.b = result; startPut(„www.site.com./d?=„ + G.b, „done4‟) S }) on („done4‟, function(result) { G.c = result; emit(„done5‟) }) onAll([„done3‟,„done5‟], function() { res.end(G.a + G.c) }) startGet(„www.google.com‟, „done1‟) startGet(„www.bing.com‟, „done2‟) } }) CHANGE 2012 – San Francisco, CA, USA 29
  • 30. Two levels of parallelism Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments e.g.: travel Async I/O agency I/O-bound e.g.: Fibonacci series Number of Workers CPU-bound CHANGE 2012 – San Francisco, CA, USA 30
  • 31. Example: Crawler Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments service crawl { res „/crawl„ on PUT { var filter = require(„HTMLparser.js‟).filter res store = „/store?value=@‟ res crawl = „/crawl?list=@‟ pfor(var i in req.list) { Parallel var list = filter(get req.list[i]) recursive par { crawling store.put(list) crawl.put(list) } } } res „/store„ { state s = „‟ on PUT { s += req.value Result } on GET { accumulation respond s } } } CHANGE 2012 – San Francisco, CA, USA 31
  • 32. Example: Crawler RT Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments /url /url /url Worker #1 /crawl Worker #2 L= [url1, url2, …] Router … Worker #n /store Router State CHANGE 2012 – San Francisco, CA, USA 32
  • 33. Crawler performance Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments 24 cores server CHANGE 2012 – San Francisco, CA, USA 33
  • 34. Challenges Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments Worker #1 /res Router … Worker #n Monitor and Worker #1 controller Worker #1 /res /res Router … Router … Worker #n Worker #n Monitor and CPU I/O Monitor and controller controller CHANGE 2012 – San Francisco, CA, USA 34
  • 35. Challenges Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments CHANGE 2012 – San Francisco, CA, USA 35
  • 36. Challenges Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments Client HTTP CHANGE 2012 – San Francisco, CA, USA 36
  • 37. Challenges Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments Client CHANGE 2012 – San Francisco, CA, USA 37
  • 38. Thank you Computing in Heterogeneous, Autonomous 'N' Goal-oriented Environments http://sosoa.inf.unisi.ch D. Bonetta, A. Peternier, C. Pautasso, W. Binder S: a Scripting Language for High-Performance RESTful Web Services 17th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP 2012), pp. 97-106, New Orleans, LA, USA, 2012 CHANGE 2012 – San Francisco, CA, USA S 38