• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
S: a Scripting Language for High-Performance RESTful Web Services
 

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

on

  • 741 views

Invited presentation given at DAC Change Workshop 2012 in Moscone Center, San Francisco, California.

Invited presentation given at DAC Change Workshop 2012 in Moscone Center, San Francisco, California.

Statistics

Views

Total Views
741
Views on SlideShare
510
Embed Views
231

Actions

Likes
1
Downloads
0
Comments
0

6 Embeds 231

http://sosoa.inf.unisi.ch 103
http://www.peternier.com 101
http://peternier.com 22
https://twitter.com 3
http://nodeslide.herokuapp.com 1
http://192.168.1.64 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

    • SAN FRANCISCO, CA, USADaniele Bonetta Achille PeternierCesare Pautasso Walter Binderhttp://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 statelessCHANGE 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 ofclients 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 languageS compiler S runtime Multicore server
    • RESTful Web Services S languageS compiler S runtime Multicore server
    • “Node.js is a platform built on Chromes JavaScriptruntime for easily building fast, scalable networkapplications. Node.js uses an event-driven, non-blockingI/O model that makes it lightweight and efficient, perfect fordata-intensive real-time applications that run acrossdistributed 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 runtimeCHANGE 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 codeCHANGE 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.hostCHANGE 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 EnvironmentsFrom otherworkers Request handler processor S S Worker S Responses WorkerWorker Worker #1 HTTP ClientRequests /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 Environmentshttp.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 agencyI/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 serverCHANGE 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 controllerCHANGE 2012 – San Francisco, CA, USA 34
    • Challenges Computing in Heterogeneous, Autonomous N Goal-oriented EnvironmentsCHANGE 2012 – San Francisco, CA, USA 35
    • Challenges Computing in Heterogeneous, Autonomous N Goal-oriented Environments Client HTTPCHANGE 2012 – San Francisco, CA, USA 36
    • Challenges Computing in Heterogeneous, Autonomous N Goal-oriented Environments ClientCHANGE 2012 – San Francisco, CA, USA 37
    • Thank you Computing in Heterogeneous, Autonomous N Goal-oriented Environmentshttp://sosoa.inf.unisi.chD. Bonetta, A. Peternier, C. Pautasso, W. BinderS: a Scripting Language for High-Performance RESTful WebServices17th ACM SIGPLAN Symposium on Principles and Practice of ParallelProgramming (PPoPP 2012), pp. 97-106, New Orleans, LA, USA, 2012 CHANGE 2012 – San Francisco, CA, USA S 38