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

2,737 views

Published on

Presentation of the paper:

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

More information available at http://sosoa.inf.unisi.ch/s

Published in: Technology, Health & Medicine
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,737
On SlideShare
0
From Embeds
0
Number of Embeds
218
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

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

  1. 1. Università Faculty della of Informatics Svizzera Italiana S A Scripting Language for High-Performance RESTful Web Services Daniele Bonetta Achille Peternier, Cesare Pautasso, Walter Binder Faculty of Informatics University of Lugano - USI Switzerland http://sosoa.inf.usi.ch/s 1Monday, February 27, 12
  2. 2. Università Faculty della of Informatics RESTful Web Services Svizzera Italiana Services using the HTTP protocol HTTP HTTP HTTP Client Client Client REST Architectural Style Client-Server Architecture Stateless Interaction Resources (Stateful, URIs) RESTful service Uniform Interface (GET,PUT,DELETE,POST, ...) resource resource resource resource 2Monday, February 27, 12
  3. 3. Università Faculty della of Informatics Goal Svizzera Italiana Develop and compose RESTful services that scale 3Monday, February 27, 12
  4. 4. Università Faculty della of Informatics Goal Svizzera Italiana Develop and compose RESTful services that scale #clients 3Monday, February 27, 12
  5. 5. Università Faculty della of Informatics Goal Svizzera Italiana Develop and compose RESTful services that scale #clients #cores 3Monday, February 27, 12
  6. 6. Università Faculty della of Informatics Goal Svizzera Italiana Develop and compose RESTful services that scale #clients #cores using safe implicit parallelism 3Monday, February 27, 12
  7. 7. Università Faculty della of Informatics Node.JS Svizzera Italiana Asynchronous Event-loop based solution 4Monday, February 27, 12
  8. 8. Università Faculty della of Informatics Node.JS Svizzera Italiana Asynchronous Event-loop based solution on(‘request’, function(req,res) { // ... }) on(‘response’, function(req,res) { // ... }) 4Monday, February 27, 12
  9. 9. Università Faculty della of Informatics Node.JS Svizzera Italiana Asynchronous Event-loop based solution on(‘request’, function(req,res) { // ... }) on(‘response’, function(req,res) { // ... }) Asynchronous nonblocking I/O ✔ 4Monday, February 27, 12
  10. 10. Università Faculty della of Informatics Node.JS Svizzera Italiana Asynchronous Event-loop based solution on(‘request’, function(req,res) { // ... }) on(‘response’, function(req,res) { // ... }) Asynchronous nonblocking I/O ✔ No locks/synchronization ✔ 4Monday, February 27, 12
  11. 11. Università Faculty della of Informatics Node.JS Svizzera Italiana Asynchronous Event-loop based solution on(‘request’, function(req,res) { // ... }) on(‘response’, function(req,res) { // ... }) Asynchronous nonblocking I/O ✔ No locks/synchronization ✔ Sequential composition: nested callbacks ✘ 4Monday, February 27, 12
  12. 12. Università Faculty della of Informatics Node.JS Svizzera Italiana Asynchronous Event-loop based solution on(‘request’, function(req,res) { // ... }) on(‘response’, function(req,res) { // ... }) Asynchronous nonblocking I/O ✔ No locks/synchronization ✔ Sequential composition: nested callbacks ✘ Callbacks need to be short: never block ✘ 4Monday, February 27, 12
  13. 13. Università Faculty della of Informatics Node.JS Svizzera Italiana Asynchronous Event-loop based solution on(‘request’, function(req,res) { // ... }) on(‘response’, function(req,res) { // ... }) Asynchronous nonblocking I/O ✔ No locks/synchronization ✔ Sequential composition: nested callbacks ✘ Callbacks need to be short: never block ✘ Master worker parallelism ✘ 4Monday, February 27, 12
  14. 14. Università Faculty della of Informatics Svizzera Italiana The S Scripting Language A DSL for RESTful Web Services Development and Composition 5Monday, February 27, 12
  15. 15. Università Faculty della of Informatics Svizzera Italiana S erv ices S tate ful The S Scripting Language A DSL for RESTful Web Services Development and Composition 5Monday, February 27, 12
  16. 16. Università Faculty della of Informatics Svizzera Italiana ab le ca l S erv ices teful S Sta The S Scripting Language A DSL for RESTful Web Services Development and Composition 5Monday, February 27, 12
  17. 17. Università Faculty della of Informatics S: Design Principles Svizzera Italiana High-level architectural abstractions Simple, clean programming model 6Monday, February 27, 12
  18. 18. Università Faculty della of Informatics S: Design Principles Svizzera Italiana High-level architectural abstractions Services compose resources No threads/processes, no synchronization/locks Stateful services Simple, clean programming model 6Monday, February 27, 12
  19. 19. Università Faculty della of Informatics S: Design Principles Svizzera Italiana High-level architectural abstractions Services compose resources No threads/processes, no synchronization/locks Stateful services Simple, clean programming model Allow blocking function calls Synchronous I/O + parallel constructs Uniform interface and URIs 6Monday, February 27, 12
  20. 20. Università Faculty della of Informatics S: Architecture Svizzera Italiana S service 7Monday, February 27, 12
  21. 21. Università Faculty della of Informatics S: Architecture Svizzera Italiana S service S resource S resource S resource 7Monday, February 27, 12
  22. 22. Università Faculty della of Informatics S: Architecture Svizzera Italiana S service S resource S resource S resource Node Node Node Node Node .JS .JS .JS .JS .JS 7Monday, February 27, 12
  23. 23. Università Faculty della of Informatics S: Architecture Svizzera Italiana S service S resource S resource S resource Node Node Node Node Node .JS .JS .JS .JS .JS S IPC Communication framework 7Monday, February 27, 12
  24. 24. Università Faculty della of Informatics S: Architecture Svizzera Italiana S service S resource S resource S resource Node Node Node Node Node .JS .JS .JS .JS .JS S IPC Communication framework Nonblocking I/O 7Monday, February 27, 12
  25. 25. Università Faculty della of Informatics S: Architecture Svizzera Italiana S service Synchronous blocking S resource S resource S resource S code Node Node Node Node Node .JS .JS .JS .JS .JS S IPC Communication framework Nonblocking I/O 7Monday, February 27, 12
  26. 26. Università Faculty della of Informatics S: Architecture Svizzera Italiana S service Synchronous blocking S resource S resource S resource S code Node Node Node Node Node .JS .JS .JS .JS .JS Asynchronous nonblocking S IPC Communication framework Node.JS code Nonblocking I/O 7Monday, February 27, 12
  27. 27. Università Faculty della of Informatics S: Architecture Svizzera Italiana S service No processes/threads S resource S resource S resource locks/sync Node Node Node Node Node .JS .JS .JS .JS .JS Multiple Node.JS processes S IPC Communication framework (IPC + shared state) Nonblocking I/O 8Monday, February 27, 12
  28. 28. Università Faculty della of Informatics Hello S Svizzera Italiana res ‘/hello’ on GET { respond ‘World!’ } 9Monday, February 27, 12
  29. 29. Università Faculty della of Informatics Hello S Svizzera Italiana Request Handler res ‘/hello’ on GET { respond ‘World!’ } 9Monday, February 27, 12
  30. 30. Università Faculty della of Informatics Hello S Svizzera Italiana URI Request Handler res ‘/hello’ on GET { respond ‘World!’ } 9Monday, February 27, 12
  31. 31. Università Faculty della of Informatics Hello S Svizzera Italiana URI HTTP Verb Request Handler res ‘/hello’ on GET { respond ‘World!’ } 9Monday, February 27, 12
  32. 32. Università Faculty della of Informatics Hello S Svizzera Italiana URI HTTP Verb Request Handler res ‘/hello’ on GET { respond ‘World!’ } Any valid JavaScript statement + S specific constructs 9Monday, February 27, 12
  33. 33. Università Faculty della of Informatics Hello S Svizzera Italiana res ‘/hello’ on GET { respond ‘World!’ } HTTP S Client Service 10Monday, February 27, 12
  34. 34. Università Faculty della of Informatics Hello S Svizzera Italiana res ‘/hello’ on GET { respond ‘World!’ } HTTP S Client Service GET /hello HTTP/1.1 User-Agent: curl Accept: */* Host: your.host 10Monday, February 27, 12
  35. 35. Università Faculty della of Informatics Hello S Svizzera Italiana res ‘/hello’ on GET { respond ‘World!’ } HTTP S Client Service HTTP/1.1 200 OK Content-Type: text/plain World! 11Monday, February 27, 12
  36. 36. Università Faculty della of Informatics Compositions Svizzera Italiana res ‘/hello1’ on GET { respond get ‘http://www.a.b’ } res ‘/hello2’ on GET { respond get ‘/hello1’ } 12Monday, February 27, 12
  37. 37. Università Faculty della of Informatics Compositions Svizzera Italiana res ‘/hello1’ on GET { respond get ‘http://www.a.b’ } res ‘/hello2’ on GET { respond get ‘/hello1’ } Native HTTP support 12Monday, February 27, 12
  38. 38. Università Faculty della of Informatics Compositions Svizzera Italiana res ‘/hello1’ on GET { respond get ‘http://www.a.b’ } res ‘/hello2’ on GET { respond get ‘/hello1’ } HTTP Client 13Monday, February 27, 12
  39. 39. Università Faculty della of Informatics Compositions Svizzera Italiana res ‘/hello1’ on GET { respond get ‘http://www.a.b’ } res ‘/hello2’ on GET { respond get ‘/hello1’ } HTTP /hello2 Client 13Monday, February 27, 12
  40. 40. Università Faculty della of Informatics Compositions Svizzera Italiana res ‘/hello1’ on GET { respond get ‘http://www.a.b’ } res ‘/hello2’ on GET { respond get ‘/hello1’ } HTTP /hello2 /hello1 Client 13Monday, February 27, 12
  41. 41. Università Faculty della of Informatics Compositions Svizzera Italiana res ‘/hello1’ on GET { respond get ‘http://www.a.b’ } res ‘/hello2’ on GET { respond get ‘/hello1’ } HTTP /hello2 /hello1 www.a.b Client 13Monday, February 27, 12
  42. 42. Università Faculty della of Informatics Compositions Svizzera Italiana res ‘/hello1’ on GET { respond get ‘http://www.a.b’ } res ‘/hello2’ on GET { respond get ‘/hello1’ } HTTP /hello2 /hello1 www.a.b Client 13Monday, February 27, 12
  43. 43. Università Faculty della of Informatics Concurrency & Parallelism Svizzera Italiana res ‘/res1‘ on GET { // ... // CPU/bound blocking call var a = foo() respond a } res ‘/res2’ on GET { // ... res r = ‘http://www.google.ch/search=@’ // I/O bound operation boo = r.get(‘key’) respond boo } 14Monday, February 27, 12
  44. 44. Università Faculty della of Informatics Concurrency & Parallelism Svizzera Italiana res ‘/res1‘ on GET { // ... Atomically // CPU/bound blocking call executed var a = foo() blocks respond a } res ‘/res2’ on GET { // ... res r = ‘http://www.google.ch/search=@’ // I/O bound operation boo = r.get(‘key’) respond boo } 14Monday, February 27, 12
  45. 45. Università Faculty della of Informatics Concurrency & Parallelism Svizzera Italiana res ‘/res1‘ on GET { // ... // CPU/bound blocking call Parallel var a = foo() resources respond a } res ‘/res2’ on GET { // ... res r = ‘http://www.google.ch/search=@’ // I/O bound operation boo = r.get(‘key’) respond boo } 15Monday, February 27, 12
  46. 46. Università Faculty della of Informatics Concurrency & Parallelism Svizzera Italiana res ‘/res1‘ on GET { // ... // CPU/bound blocking call Synchronous var a = foo() operations respond a } res ‘/res2’ on GET { // ... res r = ‘http://www.google.ch/search=@’ // I/O bound operation boo = r.get(‘key’) respond boo } 16Monday, February 27, 12
  47. 47. Università Faculty della of Informatics (1) CPU-bound Operations Svizzera Italiana Request Handler Processor /res Worker #1 Router Worker #n 17Monday, February 27, 12
  48. 48. Università Faculty della of Informatics (1) CPU-bound Operations Svizzera Italiana Request Handler Processor /res Worker #1 Router Worker #n 17Monday, February 27, 12
  49. 49. Università Faculty della of Informatics (1) CPU-bound Operations Svizzera Italiana Request Handler Processor /res Worker #1 To clients (HTTP response) Router Worker #n From clients (HTTP requests) 17Monday, February 27, 12
  50. 50. Università Faculty della of Informatics (1) CPU-bound Operations Svizzera Italiana (2) I/O-bound Operations Request Handler Processor /res Worker #1 To clients (HTTP response) Router Worker #n From clients Parallelism degree (HTTP requests) controller (PI) 17Monday, February 27, 12
  51. 51. Università Faculty della of Informatics (1) CPU-bound Operations Svizzera Italiana (2) I/O-bound Operations To external resources Request Handler Processor (through HTTP) From other workers /res Worker #1 To clients (HTTP response) Router Worker #n To internal resources (through IPC) From clients Parallelism degree (HTTP requests) controller (PI) 17Monday, February 27, 12
  52. 52. Università Faculty della of Informatics (2) I/O-bound Operations Svizzera Italiana Event-based compilation output targeting Node.JS 18Monday, February 27, 12
  53. 53. Università Faculty della of Informatics (2) I/O-bound Operations Svizzera Italiana Event-based compilation output targeting Node.JS • Synchronous I/O operations are desynchronized by the compiler using multiple callbacks 18Monday, February 27, 12
  54. 54. Università Faculty della of Informatics (2) I/O-bound Operations Svizzera Italiana Event-based compilation output targeting Node.JS • Synchronous I/O operations are desynchronized by the compiler using multiple callbacks • Callbacks are scheduled by the runtime using an event-based approach. 18Monday, February 27, 12
  55. 55. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana S vs. Node.JS 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 } 19Monday, February 27, 12
  56. 56. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana S vs. Node.JS res ‘/example’ on GET { http.createServer(function(creq,cres){ var a = get ‘www.google.com’ if(creq.method==‘GET’&&creq.url==‘/example’) { var b = get ‘www.bing.com’ var a,b,c = ‘’ var c = get ‘www.yahoo.com’ respond a+b+c startGet(‘www.google.com’, } function(req,res) { a = res.body startGet(‘www.bing.com’, function(req,res) { b = res.body startGet(‘www.yahoo.com’, function(req,res) { c = res.body cres.end(a+b+c) }) }) }) } }) 19Monday, February 27, 12
  57. 57. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana S vs. Node.JS res ‘/example’ on GET { par { var a = get ‘www.google.com’ var b = get ‘www.bing.com’ var c = put ‘www.a.b/?d=’+b respond a+c }} 20Monday, February 27, 12
  58. 58. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana S vs. Node.JS res ‘/example’ on GET { http.createServer(function(req,res) { par { if(creq.method==‘GET’&&creq.url==‘/example’) { var a = get ‘www.google.com’ var G = {} var b = get ‘www.bing.com’ var c = put ‘www.a.b/?d=’+b on(‘done1’, function(result){ respond a+c G.a = result; emit(‘done3’)}) }} on(‘done2’, function(result){ G.b = result; get get startPut(‘www.a.b/d?=‘+G.b, ‘done4’) }) on(‘done4’, function(result) { var b = ... G.c = result; emit(‘done5’) var a = ... }) put onAll([‘done3’,‘done5’], function() { res.end(G.a+G.c) var c = ... }) startGet(‘www.google.com’, ‘done1’) startGet(‘www.bing.com’, ‘done2’) respond } }) 20Monday, February 27, 12
  59. 59. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana http.createServer(function(req,res) { if(creq.method==‘GET’&&creq.url==‘/example’) { var G = {} on(‘done1’, function(result){ get get G.a = result; emit(‘done3’)}) on(‘done2’, function(result){ var b G.b = result; startPut(‘www.a.b/d?=‘+G.b, ‘done4’) var a }) put on(‘done4’, function(result) { G.c = result; var c emit(‘done5’) }) respond onAll([‘done3’,‘done5’], function() { res.end(G.a+G.c) }) startGet(‘www.google.com’, ‘done1’) startGet(‘www.bing.com’, ‘done2’) } }) 21Monday, February 27, 12
  60. 60. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana Callbacks registration http.createServer(function(req,res) { if(creq.method==‘GET’&&creq.url==‘/example’) { var G = {} on(‘done1’, function(result){ get get G.a = result; emit(‘done3’)}) on(‘done2’, function(result){ var b G.b = result; startPut(‘www.a.b/d?=‘+G.b, ‘done4’) var a }) put on(‘done4’, function(result) { G.c = result; var c emit(‘done5’) }) respond onAll([‘done3’,‘done5’], function() { res.end(G.a+G.c) }) startGet(‘www.google.com’, ‘done1’) startGet(‘www.bing.com’, ‘done2’) } }) 21Monday, February 27, 12
  61. 61. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana Callbacks registration http.createServer(function(req,res) { if(creq.method==‘GET’&&creq.url==‘/example’) { var G = {} on(‘done1’, function(result){ get get G.a = result; emit(‘done3’)}) on(‘done2’, function(result){ var b G.b = result; startPut(‘www.a.b/d?=‘+G.b, ‘done4’) var a }) put on(‘done4’, function(result) { G.c = result; var c emit(‘done5’) }) respond onAll([‘done3’,‘done5’], function() { res.end(G.a+G.c) }) startGet(‘www.google.com’, ‘done1’) startGet(‘www.bing.com’, ‘done2’) } }) 21Monday, February 27, 12
  62. 62. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana http.createServer(function(req,res) { if(creq.method==‘GET’&&creq.url==‘/example’) { var G = {} on(‘done1’, function(result){ get get G.a = result; emit(‘done3’)}) on(‘done2’, function(result){ var b G.b = result; startPut(‘www.a.b/d?=‘+G.b, ‘done4’) var a }) put on(‘done4’, function(result) { G.c = result; var c emit(‘done5’) }) respond onAll([‘done3’,‘done5’], function() { res.end(G.a+G.c) }) startGet(‘www.google.com’, ‘done1’) startGet(‘www.bing.com’, ‘done2’) } }) 22Monday, February 27, 12
  63. 63. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana http.createServer(function(req,res) { if(creq.method==‘GET’&&creq.url==‘/example’) { var G = {} on(‘done1’, function(result){ get get G.a = result; emit(‘done3’)}) on(‘done2’, function(result){ var b G.b = result; startPut(‘www.a.b/d?=‘+G.b, ‘done4’) var a }) put on(‘done4’, function(result) { G.c = result; var c emit(‘done5’) }) respond onAll([‘done3’,‘done5’], function() { res.end(G.a+G.c) }) startGet(‘www.google.com’, ‘done1’) startGet(‘www.bing.com’, ‘done2’) } }) 23Monday, February 27, 12
  64. 64. Università Faculty della of Informatics Sync to Async Compilation Svizzera Italiana http.createServer(function(req,res) { if(creq.method==‘GET’&&creq.url==‘/example’) { var G = {} on(‘done1’, function(result){ get get G.a = result; emit(‘done3’)}) on(‘done2’, function(result){ var b G.b = result; startPut(‘www.a.b/d?=‘+G.b, ‘done4’) var a }) put on(‘done4’, function(result) { G.c = result; var c emit(‘done5’) }) respond onAll([‘done3’,‘done5’], function() { res.end(G.a+G.c) }) startGet(‘www.google.com’, ‘done1’) startGet(‘www.bing.com’, ‘done2’) } }) 23Monday, February 27, 12
  65. 65. Università Faculty della of Informatics Other Constructs Svizzera Italiana pfor res creation res ‘/pfor’ on GET { res ‘/example’ { var L = [1,2,3] state s = 0 var a = ‘’ on POST { res r = ‘www.a.b/val=@’ s++ pfor (var i in L) { res ‘/newResource’+s { a += r.get(L[i]) on GET { respond s } } on DELETE {} respond a } } } } } 24Monday, February 27, 12
  66. 66. Università Faculty della of Informatics Stateful Services Svizzera Italiana res ‘/helloState’ { state s = ‘world’ on GET { respond ‘hello’ + s } on PUT { s = req.name } } 25Monday, February 27, 12
  67. 67. Università Faculty della of Informatics Stateful Services Svizzera Italiana res ‘/helloState’ { state s = ‘world’ Shared state on GET { respond ‘hello’ + s } on PUT { s = req.name } } 25Monday, February 27, 12
  68. 68. Università Faculty della of Informatics Stateful Services Svizzera Italiana res ‘/helloState’ { state s = ‘world’ Shared state on GET { respond ‘hello’ + s Read-only operations } on PUT { s = req.name } } 25Monday, February 27, 12
  69. 69. Università Faculty della of Informatics Stateful Services Svizzera Italiana res ‘/helloState’ { state s = ‘world’ Shared state on GET { respond ‘hello’ + s Read-only operations } on PUT { s = req.name } Write operation } 25Monday, February 27, 12
  70. 70. Università Faculty della of Informatics Uniform Interface and Parallelism Svizzera Italiana HTTP’s Uniform Interface HTTP Verb Properties Parallelism HTTP GET Idempotent, safe, Yes stateless HTTP PUT Idempotent, Side- If stateless effects HTTP DELETE Idempotent, Side- If stateless effects HTTP POST Side-effects If stateless 26Monday, February 27, 12
  71. 71. Università Faculty della of Informatics Versioned State Management Svizzera Italiana res ‘/res’ state s Guarantees: on GET { } // read s • Eventual (C)onsistency on PUT { • (A)vailability } // alter s • (P)artition Tolerance } S V. n Worker #1 SLR Worker #n S V. n S V. n 27Monday, February 27, 12
  72. 72. Università Faculty della of Informatics Versioned State Management Svizzera Italiana res ‘/res’ state s Guarantees: on GET { } // read s • Eventual (C)onsistency on PUT { • (A)vailability } // alter s • (P)artition Tolerance } S V. n Worker #1 GET /res SLR Worker #n S V. n S V. n 27Monday, February 27, 12
  73. 73. Università Faculty della of Informatics Versioned State Management Svizzera Italiana res ‘/res’ state s Guarantees: on GET { } // read s • Eventual (C)onsistency on PUT { • (A)vailability } // alter s • (P)artition Tolerance } V. n-1 S Worker #1 SLR Worker #n S S V. n V. n-1 28Monday, February 27, 12
  74. 74. Università Faculty della of Informatics Versioned State Management Svizzera Italiana res ‘/res’ state s Guarantees: on GET { } // read s • Eventual (C)onsistency on PUT { • (A)vailability } // alter s • (P)artition Tolerance } V. n-1 S Worker #1 PUT /res SLR Worker #n S S V. n V. n-1 28Monday, February 27, 12
  75. 75. Università Faculty della of Informatics Versioned State Management Svizzera Italiana res ‘/res’ state s Guarantees: on GET { } // read s • Eventual (C)onsistency on PUT { • (A)vailability } // alter s • (P)artition Tolerance } S V. n-1 Worker #1 V. n GET /res SLR Worker #n S V. n S V. n-1 29Monday, February 27, 12
  76. 76. Università Faculty della of Informatics Example: // Crawler Svizzera Italiana 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) { var list = filter(get req.list[i]) par { store.put(list) crawl.put(list) } } } res ‘/store‘ { state s = ‘’ on PUT { s += req.value } on GET { respond s } } } 30Monday, February 27, 12
  77. 77. Università Faculty della of Informatics Example: // Crawler Svizzera Italiana service crawl { res ‘/crawl‘ on PUT { var filter = require(‘HTMLparser.js’).filter res store = ‘/store?value=@’ JavaScript res crawl = ‘/crawl?list=@’ import pfor(var i in req.list) { var list = filter(get req.list[i]) par { store.put(list) crawl.put(list) } } } res ‘/store‘ { state s = ‘’ on PUT { s += req.value } on GET { respond s } } } 30Monday, February 27, 12
  78. 78. Università Faculty della of Informatics Example: // Crawler Svizzera Italiana service crawl { res ‘/crawl‘ on PUT { var filter = require(‘HTMLparser.js’).filter res store = ‘/store?value=@’ JavaScript res crawl = ‘/crawl?list=@’ import pfor(var i in req.list) { var list = filter(get req.list[i]) par { External store.put(list) resources crawl.put(list) } declaration } } res ‘/store‘ { state s = ‘’ on PUT { s += req.value } on GET { respond s } } } 30Monday, February 27, 12
  79. 79. Università Faculty della of Informatics Example: // Crawler Svizzera Italiana service crawl { res ‘/crawl‘ on PUT { var filter = require(‘HTMLparser.js’).filter res store = ‘/store?value=@’ JavaScript res crawl = ‘/crawl?list=@’ import pfor(var i in req.list) { var list = filter(get req.list[i]) par { External store.put(list) resources crawl.put(list) } declaration } } res ‘/store‘ { state s = ‘’ Parallel on PUT { s += req.value recursive } crawling on GET { respond s } } } 30Monday, February 27, 12
  80. 80. Università Faculty della of Informatics Example: // Crawler Svizzera Italiana service crawl { res ‘/crawl‘ on PUT { var filter = require(‘HTMLparser.js’).filter res store = ‘/store?value=@’ JavaScript res crawl = ‘/crawl?list=@’ import pfor(var i in req.list) { var list = filter(get req.list[i]) par { External store.put(list) resources crawl.put(list) } declaration } } res ‘/store‘ { state s = ‘’ Parallel on PUT { s += req.value recursive } crawling on GET { respond s } Result } accumulation } 30Monday, February 27, 12
  81. 81. Università Faculty della of Informatics Crawler Runtime Svizzera Italiana res ‘/crawl’ on PUT { res ‘/store’ on PUT { // ... // ... } } Worker #1 /store /crawl SLR SLR S 31Monday, February 27, 12
  82. 82. Università Faculty della of Informatics Crawler Runtime Svizzera Italiana res ‘/crawl’ on PUT { res ‘/store’ on PUT { // ... // ... } } Worker #1 /store /crawl L = [...] SLR SLR S 31Monday, February 27, 12
  83. 83. Università Faculty della of Informatics Crawler Runtime Svizzera Italiana res ‘/crawl’ on PUT { res ‘/store’ on PUT { // ... // ... } } /url1 /url2 ... Worker #1 /store /crawl L = [...] SLR SLR S 31Monday, February 27, 12
  84. 84. Università Faculty della of Informatics Crawler Runtime Svizzera Italiana res ‘/crawl’ on PUT { res ‘/store’ on PUT { // ... // ... } } /url1 /url2 L = [...] ... Worker #1 /store /crawl L = [...] SLR SLR S 31Monday, February 27, 12
  85. 85. Università Faculty della of Informatics Crawler Runtime Svizzera Italiana res ‘/crawl’ on PUT { res ‘/store’ on PUT { // ... // ... } } /url1 /url2 L = [...] ... Worker #1 /store /crawl L = [...] SLR SLR S 31Monday, February 27, 12
  86. 86. Università Faculty della of Informatics Crawler Runtime Svizzera Italiana res ‘/crawl’ on PUT { res ‘/store’ on PUT { // ... // ... } } /url1 /url2 L = [...] ... Worker #1 /store /crawl ... L = [...] SLR SLR S Worker #n-1 31Monday, February 27, 12
  87. 87. Università Faculty della of Informatics Crawler Runtime Svizzera Italiana res ‘/crawl’ on PUT { res ‘/store’ on PUT { // ... // ... } } /url1 /url2 L = [...] ... Worker #1 /store /crawl ... L = [...] SLR SLR S Worker #n-1 Worker #n /url1 /url2 ... 31Monday, February 27, 12
  88. 88. Università Faculty della of Informatics Crawler Performance (24cores) Svizzera Italiana 32Monday, February 27, 12
  89. 89. Università Faculty della of Informatics Crawler Performance Svizzera Italiana 33Monday, February 27, 12
  90. 90. Università Faculty della of Informatics Conclusion Svizzera Italiana What is S ? 34Monday, February 27, 12
  91. 91. Università Faculty della of Informatics Conclusion Svizzera Italiana What is S ? Simple language for composing RESTful services Scalable parallel runtime system JavaScript compatible 34Monday, February 27, 12
  92. 92. Università Faculty della of Informatics Conclusion Svizzera Italiana What is S ? Simple language for composing RESTful services Scalable parallel runtime system JavaScript compatible Safe parallelism is possible for scripting stateful Web services if they are RESTful 34Monday, February 27, 12
  93. 93. Università Faculty della of Informatics Conclusion Svizzera Italiana Future work JVM (Rhino Engine) REST + Streaming services Distributed deployment (Cloud) 35Monday, February 27, 12
  94. 94. Università Faculty della of Informatics Svizzera Italiana Thank You http://sosoa.inf.usi.ch/S daniele.bonetta@usi.ch Daniele Bonetta Achille Peternier, Cesare Pautasso, Walter Binder Faculty of Informatics University of Lugano - USI Switzerland 36Monday, February 27, 12

×