SlideShare una empresa de Scribd logo
1 de 34
Consuming HTTP at Scale

       Node Summit, Jan 24, 2012
Hello, I'm
Subbu Allamaraju
      @sallamar
http://www.subbu.org


                       2
Brought to you by


eBay's platform engineering


https://github.com/ql-io/ql.io
Open source (Apache 2)

                              3
[http://blog.programmableweb.com/2011/05/25/api-business-models-then-and-
now/]                                                                  4
A DSL for HTTP
An HTTP gateway
 Built on node.js

                    5
Make HTTP APIs easy
and fast to consume


                      6
Lines of code for API calls   Data size (k)




before



after



                                              7
Lines of code for API calls   Data size (k)




 before




 after

                                              8
How Come?
            9
// HTTP and network coding is already easy
//
var http = require('http');
var client = http.request({
    method : 'GET',
    host : 'my host',
    path : 'my path'}, function(res) {
      res.on('data', function(chunk) { ... };
      res.on('end', function() { ... });
});
client.end();



                                                10
Real code (randomized)
12
13
14
15
16
17
18
The same in ql.io
HFRwni G NIxGNs TSMeb7 A9On vtwZhQoJGnFQFqgkV9 3WFgC
93TbEBy6 Q ocpBxgpH3 Pu4ju fi
                                      (randomized)
ZsKb W RkIs5b z UAsS QK3nyJ68IhTSB0aTufR98ymV evsX7
   tUH 8i4fwR S Hut69mnCHAO
ufyx w CZLOtN 9 PvTU sPd2lMVDV42tRAfIoPM56H1hE tGz5s
kmekNeyrai5SklC 5 TstTKDhFb
   OLy 5KQ5oz A MiZzQJSCbEv
aLr068KLleE X q8cwPm 5 nZpH 3jpeWcIpkTTIjGsZovq7 fR4Hn dz3Lhl o
MfdTDqpFVdh
aiPOsj2fO9 w fWD3mv p ORHX Bq4xIMvLGjMrgnC6JpBw1S5 HDwoI
CwhI09 z 742rMEqx626
ZH0qwtN g boU4fU W QYKf F24BKGrFfg0sfhkc8U4aZfL4bn kUNmG
vm6odt 6 YaC6b0Ff4gG
Ox4Jh0 6
 aXtsEg G LUlJL3k2O
 WeRAMe d 9GlF1XJM8
 9oicQwaHnMp7n U Pjnojj5kdhD0sZzh
 Pz3HHpnBy L OlVQMpHAILCH
 RF3vwaFHarZR Q i2Ofa38U9ylvve
cE

                                                                  19
Mobile and front-end



  requests per UI paint
                        5+
[Jan 2011 ad hoc testing on an iPhone] Bing – 4, Google - 13, Mint – 26,
Netflix – 13, Amazon – 2, LinkedIn 5, Facebook - 9
                                                                           20
Client   Server-1   Server-2   Server-3   Server-4




                                                 max(max(t1+
                                                  t4),t2,t3)




            Fork/join dance
                                                               21
Parallellizing

I/O            Sequencing
               Joining
               Normalizing

Writing such code once or twice is
fun – writing tens of times is not.
                                      22
Native, mobile
Single page apps            Server-1   Server-2   Server-3   Server-4




                   Bad for far-away clients
                                                                        23
Many requests and connections, high
bandwidth use, high latency, low reliability
                                           24
Easy Button
              25
HTTP CRUD to SQLish CRUD
   create table for each resource
   select to read
   insert into to add or create
   update to update
   delete to delete

# HTTP requests with one line of code

select long_url from bitly.shorten
 where shortUrl = 'http://bit.ly/uZIvmY'

select Url from bing.soap.search
  where q = "ql.io"

                                           26
Designed for the lazy
// GET on a resource bound to SELECT
create table bing.search
 on select get from
'http://api.bing.net/xml.aspx?Appid={appid}&query={q}&sources=web'
  using defaults appid = '{config.bing.appid}'
  resultset 'SearchResponse.web:Web.web:Results.web:WebResult';


// POST on a resource bound to SELECT
create table bing.soap.search
 on select post to 'http://api.bing.net/soap.asmx'
   using defaults appid = '{config.bing.appid}'
   using bodyTemplate 'bing.soap.xml.mu'
    type 'application/xml'
   resultset
'soapenv:Envelope.soapenv:Body.SearchResponse.parameters.Web.Results.
WebResult';

                                                                     27
No Async Mind-Bending
# Sequential
minis = select * from finditems where
   keywords = 'mini cooper' limit 10;
return select PictureURL from details where
   itemId = "{minis.itemId}";

# Or parallel
keyword = "ql.io";
web = select * from bing.search where q = "{keyword}";
tweets = select id as id, from_user_name as user_name,
  text as text from twitter.search where q = "ql.io";

return {
  "keyword": "{keyword}",
  "web": "{web}",
  "tweets": "{tweets}"
}

                                                         28
Implicit Fork-Join and Routing
prodid = select ProductID[0].Value from eBay.FindProducts
  where QueryKeywords = 'macbook pro';
details = select * from eBay.ProductDetails where
  ProductID in ('{prodid}') and
  ProductType = 'Reference';
reviews = select * from eBay.ProductReviews where
  ProductID in ('{prodid}') and
  ProductType = 'Reference';

return select d.ProductID[0].Value as id,
   d.Title as title, d.ReviewCount as reviewCount,
   r.ReviewDetails.AverageRating as rating
 from details as d, reviews as r
   where d.ProductID[0].Value = r.ProductID.Value
   via route '/myapi' using method get;



                                                            29
How to Use
             30
As a Gateway
                               ql.io as an
                                  HTTP
Client apps                    Gateway       S-1   S-2   S-3   S-4




          Optional streaming
          through WebSockets




                                                                     31
Node.js Module
/> npm install ql.io-engine

var Engine = require('ql.io-engine'), fs = require('fs');
var engine = new Engine({tables : __dirname + '/../tables'});
var script = fs.readFileSync(__dirname + '/myapi.ql', 'UTF-8');
engine.execute(script, function(emitter) {
    emitter.on('prodid', function(data) {
        console.log('found ' + data.length + ' product IDs');
    });
    emitter.on('details', function(data) {
        console.log('found ' + data.length + ' details');
    });
    emitter.on('reviews', function(data) {
        console.log('found ' + data.length + ' reviews');
    });
    emitter.on('end', function(err, result) {
        console.log('Got results');
    });
});
                                                                  32
mkdir myapp
cd myapp
curl -L "http://tinyurl.com/7cgglby"| bash

bin/start.sh




                                             33
http://ql.io

Más contenido relacionado

La actualidad más candente

37562259 top-consuming-process
37562259 top-consuming-process37562259 top-consuming-process
37562259 top-consuming-process
skumner
 

La actualidad más candente (20)

RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Будь первым
Будь первымБудь первым
Будь первым
 
Go memory
Go memoryGo memory
Go memory
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
 
Comets notes
Comets notesComets notes
Comets notes
 
Kubernetes Tutorial
Kubernetes TutorialKubernetes Tutorial
Kubernetes Tutorial
 
37562259 top-consuming-process
37562259 top-consuming-process37562259 top-consuming-process
37562259 top-consuming-process
 
tdc2012
tdc2012tdc2012
tdc2012
 
All you need to know about the JavaScript event loop
All you need to know about the JavaScript event loopAll you need to know about the JavaScript event loop
All you need to know about the JavaScript event loop
 
Go Memory
Go MemoryGo Memory
Go Memory
 
EC2
EC2EC2
EC2
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Go Containers
Go ContainersGo Containers
Go Containers
 
Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFx
 
agri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertoragri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertor
 
Containers for sysadmins
Containers for sysadminsContainers for sysadmins
Containers for sysadmins
 
How to make a large C++-code base manageable
How to make a large C++-code base manageableHow to make a large C++-code base manageable
How to make a large C++-code base manageable
 

Similar a ql.io: Consuming HTTP at Scale

Making Things Work Together
Making Things Work TogetherMaking Things Work Together
Making Things Work Together
Subbu Allamaraju
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
Wesley Beary
 

Similar a ql.io: Consuming HTTP at Scale (20)

ql.io at NodePDX
ql.io at NodePDXql.io at NodePDX
ql.io at NodePDX
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance Issues
 
Making Things Work Together
Making Things Work TogetherMaking Things Work Together
Making Things Work Together
 
Service Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesService Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and Kubernetes
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
 
Skydive 5/07/2016
Skydive 5/07/2016Skydive 5/07/2016
Skydive 5/07/2016
 
ОЛЕКСАНДР ЛИПКО «Graceful Shutdown Node.js + k8s» Online WDDay 2021
ОЛЕКСАНДР ЛИПКО «Graceful Shutdown Node.js + k8s» Online WDDay 2021ОЛЕКСАНДР ЛИПКО «Graceful Shutdown Node.js + k8s» Online WDDay 2021
ОЛЕКСАНДР ЛИПКО «Graceful Shutdown Node.js + k8s» Online WDDay 2021
 
Analyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAnalyzing the Performance of Mobile Web
Analyzing the Performance of Mobile Web
 
Being HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on PurposeBeing HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on Purpose
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
 
Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM  Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM
 
(Re)discover your AEM
(Re)discover your AEM(Re)discover your AEM
(Re)discover your AEM
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 
Node azure
Node azureNode azure
Node azure
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
 
A Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLA Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQL
 

Más de Subbu Allamaraju

Más de Subbu Allamaraju (15)

Five Rules
Five RulesFive Rules
Five Rules
 
Leading a Transformation
Leading a TransformationLeading a Transformation
Leading a Transformation
 
Taming the Rate of Change
Taming the Rate of ChangeTaming the Rate of Change
Taming the Rate of Change
 
What Worked for Netflix May Not Work for You (OSCON-2018)
What Worked for Netflix May Not Work for You (OSCON-2018)What Worked for Netflix May Not Work for You (OSCON-2018)
What Worked for Netflix May Not Work for You (OSCON-2018)
 
Are We Ready for Serverless
Are We Ready for ServerlessAre We Ready for Serverless
Are We Ready for Serverless
 
How to Sell Serverless to Your Colleagues
How to Sell Serverless to Your ColleaguesHow to Sell Serverless to Your Colleagues
How to Sell Serverless to Your Colleagues
 
Turning Containers into Cattle
Turning Containers into CattleTurning Containers into Cattle
Turning Containers into Cattle
 
Keystone at the Center of Our Universe
Keystone at the Center of Our UniverseKeystone at the Center of Our Universe
Keystone at the Center of Our Universe
 
Journey and future of OpenStack eBay and PayPal
Journey and future of OpenStack eBay and PayPalJourney and future of OpenStack eBay and PayPal
Journey and future of OpenStack eBay and PayPal
 
Engineering operations
Engineering operationsEngineering operations
Engineering operations
 
Open stack@ebay
Open stack@ebayOpen stack@ebay
Open stack@ebay
 
Measuring REST
Measuring RESTMeasuring REST
Measuring REST
 
REST: Theory vs Practice
REST: Theory vs PracticeREST: Theory vs Practice
REST: Theory vs Practice
 
RESTful Web Apps - Facts vs Fiction
RESTful Web Apps - Facts vs FictionRESTful Web Apps - Facts vs Fiction
RESTful Web Apps - Facts vs Fiction
 
Pragmatic Rest
Pragmatic RestPragmatic Rest
Pragmatic Rest
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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...
 
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
 
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
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

ql.io: Consuming HTTP at Scale

  • 1. Consuming HTTP at Scale Node Summit, Jan 24, 2012
  • 2. Hello, I'm Subbu Allamaraju @sallamar http://www.subbu.org 2
  • 3. Brought to you by eBay's platform engineering https://github.com/ql-io/ql.io Open source (Apache 2) 3
  • 5. A DSL for HTTP An HTTP gateway Built on node.js 5
  • 6. Make HTTP APIs easy and fast to consume 6
  • 7. Lines of code for API calls Data size (k) before after 7
  • 8. Lines of code for API calls Data size (k) before after 8
  • 10. // HTTP and network coding is already easy // var http = require('http'); var client = http.request({ method : 'GET', host : 'my host', path : 'my path'}, function(res) { res.on('data', function(chunk) { ... }; res.on('end', function() { ... }); }); client.end(); 10
  • 12. 12
  • 13. 13
  • 14. 14
  • 15. 15
  • 16. 16
  • 17. 17
  • 18. 18
  • 19. The same in ql.io HFRwni G NIxGNs TSMeb7 A9On vtwZhQoJGnFQFqgkV9 3WFgC 93TbEBy6 Q ocpBxgpH3 Pu4ju fi (randomized) ZsKb W RkIs5b z UAsS QK3nyJ68IhTSB0aTufR98ymV evsX7 tUH 8i4fwR S Hut69mnCHAO ufyx w CZLOtN 9 PvTU sPd2lMVDV42tRAfIoPM56H1hE tGz5s kmekNeyrai5SklC 5 TstTKDhFb OLy 5KQ5oz A MiZzQJSCbEv aLr068KLleE X q8cwPm 5 nZpH 3jpeWcIpkTTIjGsZovq7 fR4Hn dz3Lhl o MfdTDqpFVdh aiPOsj2fO9 w fWD3mv p ORHX Bq4xIMvLGjMrgnC6JpBw1S5 HDwoI CwhI09 z 742rMEqx626 ZH0qwtN g boU4fU W QYKf F24BKGrFfg0sfhkc8U4aZfL4bn kUNmG vm6odt 6 YaC6b0Ff4gG Ox4Jh0 6 aXtsEg G LUlJL3k2O WeRAMe d 9GlF1XJM8 9oicQwaHnMp7n U Pjnojj5kdhD0sZzh Pz3HHpnBy L OlVQMpHAILCH RF3vwaFHarZR Q i2Ofa38U9ylvve cE 19
  • 20. Mobile and front-end requests per UI paint 5+ [Jan 2011 ad hoc testing on an iPhone] Bing – 4, Google - 13, Mint – 26, Netflix – 13, Amazon – 2, LinkedIn 5, Facebook - 9 20
  • 21. Client Server-1 Server-2 Server-3 Server-4 max(max(t1+ t4),t2,t3) Fork/join dance 21
  • 22. Parallellizing I/O Sequencing Joining Normalizing Writing such code once or twice is fun – writing tens of times is not. 22
  • 23. Native, mobile Single page apps Server-1 Server-2 Server-3 Server-4 Bad for far-away clients 23
  • 24. Many requests and connections, high bandwidth use, high latency, low reliability 24
  • 26. HTTP CRUD to SQLish CRUD  create table for each resource  select to read  insert into to add or create  update to update  delete to delete # HTTP requests with one line of code select long_url from bitly.shorten where shortUrl = 'http://bit.ly/uZIvmY' select Url from bing.soap.search where q = "ql.io" 26
  • 27. Designed for the lazy // GET on a resource bound to SELECT create table bing.search on select get from 'http://api.bing.net/xml.aspx?Appid={appid}&query={q}&sources=web' using defaults appid = '{config.bing.appid}' resultset 'SearchResponse.web:Web.web:Results.web:WebResult'; // POST on a resource bound to SELECT create table bing.soap.search on select post to 'http://api.bing.net/soap.asmx' using defaults appid = '{config.bing.appid}' using bodyTemplate 'bing.soap.xml.mu' type 'application/xml' resultset 'soapenv:Envelope.soapenv:Body.SearchResponse.parameters.Web.Results. WebResult'; 27
  • 28. No Async Mind-Bending # Sequential minis = select * from finditems where keywords = 'mini cooper' limit 10; return select PictureURL from details where itemId = "{minis.itemId}"; # Or parallel keyword = "ql.io"; web = select * from bing.search where q = "{keyword}"; tweets = select id as id, from_user_name as user_name, text as text from twitter.search where q = "ql.io"; return { "keyword": "{keyword}", "web": "{web}", "tweets": "{tweets}" } 28
  • 29. Implicit Fork-Join and Routing prodid = select ProductID[0].Value from eBay.FindProducts where QueryKeywords = 'macbook pro'; details = select * from eBay.ProductDetails where ProductID in ('{prodid}') and ProductType = 'Reference'; reviews = select * from eBay.ProductReviews where ProductID in ('{prodid}') and ProductType = 'Reference'; return select d.ProductID[0].Value as id, d.Title as title, d.ReviewCount as reviewCount, r.ReviewDetails.AverageRating as rating from details as d, reviews as r where d.ProductID[0].Value = r.ProductID.Value via route '/myapi' using method get; 29
  • 31. As a Gateway ql.io as an HTTP Client apps Gateway S-1 S-2 S-3 S-4 Optional streaming through WebSockets 31
  • 32. Node.js Module /> npm install ql.io-engine var Engine = require('ql.io-engine'), fs = require('fs'); var engine = new Engine({tables : __dirname + '/../tables'}); var script = fs.readFileSync(__dirname + '/myapi.ql', 'UTF-8'); engine.execute(script, function(emitter) { emitter.on('prodid', function(data) { console.log('found ' + data.length + ' product IDs'); }); emitter.on('details', function(data) { console.log('found ' + data.length + ' details'); }); emitter.on('reviews', function(data) { console.log('found ' + data.length + ' reviews'); }); emitter.on('end', function(err, result) { console.log('Got results'); }); }); 32
  • 33. mkdir myapp cd myapp curl -L "http://tinyurl.com/7cgglby"| bash bin/start.sh 33