SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Dernier

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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Dernier (20)

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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

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