SlideShare uma empresa Scribd logo
1 de 44
Feb 24, 2012
Hello, I'm
Subbu Allamaraju
      @sallamar
http://www.subbu.org


                       2
3
http://ql.io

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



                             4
Consumers




                             Producers
            XX,000,000,000




                                APIs
                req/day


                                  5
Consumers




       XX,000,000,000




     APIs
     Many
6




     Producers
Consumers




       XX,000,000,000




    Dialects
     Many
7




     Producers
Producers
                        Dialects
Q1: Make them RESTful




                         Many
and consistent?



                                  8
Consumers




                          Producers
            > 1 req per
            user action




                               9
Consumers



            Q2: Optimize
            producers for every
            consumer?


                                  10
Real code (randomized)
12
13
14
15
16
17
18
Client         Server-1   Server-2   Server-3



t1



t2
                                            (t1+t2+t3)


t3



     Sprint 1: Blocking IO code with
          sequential requests
                                                         19
Client       Server-1   Server-2   Server-3




                                               max(t1,t2,t3)




Sprint 4: Parallelize independent requests

                                                               20
Client      Server-1   Server-2   Server-3   Server-4




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




         Sprint "n": 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
24
Easy and fast HTTP
   consumption


                     25
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

                                                                  26
Lines of code for 5 API calls   Data size (k)




before




after


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




      before




      after


                                              28
What is ql.io


                29
A DSL for HTTP
An HTTP gateway
 Built on node.js

                    30
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"

                                           31
HTTP Resources as Tables
create table bitly.shorten
  on insert get from
'http://api.bitly.com/v3/shorten?login={^login}&apiKey={^apikey}&longUrl={^longUrl}&f
ormat={format}'
   using defaults apikey = "…", login = "…",
   format = "json"
   resultset 'data.url'
  on select get from
http://api.bitly.com/v3/expand?login={^login}&apiKey={^apikey}&shortUrl={^shortUrl}&
format={format}
   using defaults apikey = "…", login = "…",
   format = "json"
   resultset 'data.expand'




                                                                               32
Any HTTP Method
// 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 = '…'
    using bodyTemplate 'bing.soap.xml.mu'
        type 'application/xml'
   resultset
'soapenv:Envelope.soapenv:Body.SearchResponse.parameters.Web.Results.
WebResult';




                                                                  33
Body Templates
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
 <soapenv:Header/>
 <soapenv:Body>
  <SearchRequest
xmlns="http://schemas.microsoft.com/LiveSearch/2008/03/Search">
    <parameters>
    {{#params}}
    <Query>{{q}}</Query>
    <AppId>{{appid}}</AppId>
    {{/params}}
    <Sources>
     <SourceType>Web</SourceType>
    </Sources>
    </parameters>
  </SearchRequest>
 </soapenv:Body>
</soapenv:Envelope>
                                                                  34
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}"
}

                                                         35
Implicit Fork-Join
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




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




          Optional streaming
          through WebSockets




                                                                     38
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;



                                                            39
-- Show daily deals - use siteId=0 for US
-- and siteId=3 for UK.

dailyDealsResponse = select * from dailydeals
   where siteId="{siteId}";
dailyDeals = "{dailyDealsResponse.$..Item}";
itemDetails = select ItemID as itemId,
              Title as title,
              GalleryURL as pic,
              Seller.UserID as sellerUserId,
              Seller.FeedbackScore as feedback,
              HitCount as pageViews
   from details where itemId in (dailyDeals.ItemID);

return itemDetails
   via route '/deals/{siteId}' using method get;




                                                       40
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(result.body);
    });
});
                                                                  41
mkdir myapp
cd myapp
curl -L "http://tinyurl.com/7cgglby"| bash

bin/start.sh




                                             42
We're Hiring
   DM @sallamar


                  43
http://ql.io

Mais conteúdo relacionado

Mais procurados

JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)Anders Jönsson
 
Rich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 ApplicationRich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 ApplicationKirill Chebunin
 
Python高级编程(二)
Python高级编程(二)Python高级编程(二)
Python高级编程(二)Qiangning Hong
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 
The Ring programming language version 1.2 book - Part 80 of 84
The Ring programming language version 1.2 book - Part 80 of 84The Ring programming language version 1.2 book - Part 80 of 84
The Ring programming language version 1.2 book - Part 80 of 84Mahmoud Samir Fayed
 
자바스크립트 비동기 코드(Javascript asyncronous code)
자바스크립트 비동기 코드(Javascript asyncronous code)자바스크립트 비동기 코드(Javascript asyncronous code)
자바스크립트 비동기 코드(Javascript asyncronous code)Kongson Park
 
JavaScript and the AST
JavaScript and the ASTJavaScript and the AST
JavaScript and the ASTJarrod Overson
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploySimon Su
 
Apigility reloaded
Apigility reloadedApigility reloaded
Apigility reloadedRalf Eggert
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013aleks-f
 
CoffeeScript - TechTalk 21/10/2013
CoffeeScript - TechTalk 21/10/2013CoffeeScript - TechTalk 21/10/2013
CoffeeScript - TechTalk 21/10/2013Spyros Ioakeimidis
 
The Ring programming language version 1.3 book - Part 85 of 88
The Ring programming language version 1.3 book - Part 85 of 88The Ring programming language version 1.3 book - Part 85 of 88
The Ring programming language version 1.3 book - Part 85 of 88Mahmoud Samir Fayed
 
Effecient javascript
Effecient javascriptEffecient javascript
Effecient javascriptmpnkhan
 
C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴명신 김
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for CassandraEdward Capriolo
 

Mais procurados (20)

JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)
 
Virtual Machine Constructions for Dummies
Virtual Machine Constructions for DummiesVirtual Machine Constructions for Dummies
Virtual Machine Constructions for Dummies
 
Rich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 ApplicationRich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 Application
 
OpenXR 0.90 Overview Guide
OpenXR 0.90 Overview GuideOpenXR 0.90 Overview Guide
OpenXR 0.90 Overview Guide
 
OpenMAX AL 1.0 Reference Card
OpenMAX AL 1.0 Reference CardOpenMAX AL 1.0 Reference Card
OpenMAX AL 1.0 Reference Card
 
Python高级编程(二)
Python高级编程(二)Python高级编程(二)
Python高级编程(二)
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
The Ring programming language version 1.2 book - Part 80 of 84
The Ring programming language version 1.2 book - Part 80 of 84The Ring programming language version 1.2 book - Part 80 of 84
The Ring programming language version 1.2 book - Part 80 of 84
 
C++ Programs
C++ ProgramsC++ Programs
C++ Programs
 
자바스크립트 비동기 코드(Javascript asyncronous code)
자바스크립트 비동기 코드(Javascript asyncronous code)자바스크립트 비동기 코드(Javascript asyncronous code)
자바스크립트 비동기 코드(Javascript asyncronous code)
 
JavaScript and the AST
JavaScript and the ASTJavaScript and the AST
JavaScript and the AST
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploy
 
Apigility reloaded
Apigility reloadedApigility reloaded
Apigility reloaded
 
Dlr
DlrDlr
Dlr
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
 
CoffeeScript - TechTalk 21/10/2013
CoffeeScript - TechTalk 21/10/2013CoffeeScript - TechTalk 21/10/2013
CoffeeScript - TechTalk 21/10/2013
 
The Ring programming language version 1.3 book - Part 85 of 88
The Ring programming language version 1.3 book - Part 85 of 88The Ring programming language version 1.3 book - Part 85 of 88
The Ring programming language version 1.3 book - Part 85 of 88
 
Effecient javascript
Effecient javascriptEffecient javascript
Effecient javascript
 
C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 

Destaque

Diário Oficial - Museu do Instituto Biológico
Diário Oficial - Museu do Instituto BiológicoDiário Oficial - Museu do Instituto Biológico
Diário Oficial - Museu do Instituto BiológicoAgricultura Sao Paulo
 
Learn The Basics Of Machine Shops
Learn The Basics Of Machine ShopsLearn The Basics Of Machine Shops
Learn The Basics Of Machine ShopsWhitney Mike Segura
 
Basic shop safety rules
Basic shop safety rulesBasic shop safety rules
Basic shop safety rulesManny Daleon
 
General shop safety
General shop safetyGeneral shop safety
General shop safetyAdam Smith
 
A presentation on mechanical workshop norh east railway
A presentation on mechanical workshop norh east railwayA presentation on mechanical workshop norh east railway
A presentation on mechanical workshop norh east railwayGALGOTIAS UNIVERSITY
 
Basic Machine Shop Safety And Maintenance Tips
Basic Machine Shop Safety And Maintenance TipsBasic Machine Shop Safety And Maintenance Tips
Basic Machine Shop Safety And Maintenance TipsWhitney Mike Segura
 
Gorakhpur mechanical workshop summer training report
Gorakhpur mechanical workshop summer training reportGorakhpur mechanical workshop summer training report
Gorakhpur mechanical workshop summer training reportGALGOTIAS UNIVERSITY
 
Classroom Management Presentation
Classroom Management PresentationClassroom Management Presentation
Classroom Management Presentationlorenwilliams
 
Gear Cutting Presentation for Polytechnic College Students of India
Gear Cutting Presentation for Polytechnic College Students of IndiaGear Cutting Presentation for Polytechnic College Students of India
Gear Cutting Presentation for Polytechnic College Students of Indiakichu
 
Classroom Management Techniques
Classroom Management TechniquesClassroom Management Techniques
Classroom Management TechniquesBaita Sapad
 

Destaque (12)

Diário Oficial - Museu do Instituto Biológico
Diário Oficial - Museu do Instituto BiológicoDiário Oficial - Museu do Instituto Biológico
Diário Oficial - Museu do Instituto Biológico
 
Learn The Basics Of Machine Shops
Learn The Basics Of Machine ShopsLearn The Basics Of Machine Shops
Learn The Basics Of Machine Shops
 
Basic shop safety rules
Basic shop safety rulesBasic shop safety rules
Basic shop safety rules
 
General shop safety
General shop safetyGeneral shop safety
General shop safety
 
A presentation on mechanical workshop norh east railway
A presentation on mechanical workshop norh east railwayA presentation on mechanical workshop norh east railway
A presentation on mechanical workshop norh east railway
 
Basic Machine Shop Processes
Basic Machine Shop ProcessesBasic Machine Shop Processes
Basic Machine Shop Processes
 
Basic Machine Shop Safety And Maintenance Tips
Basic Machine Shop Safety And Maintenance TipsBasic Machine Shop Safety And Maintenance Tips
Basic Machine Shop Safety And Maintenance Tips
 
Gorakhpur mechanical workshop summer training report
Gorakhpur mechanical workshop summer training reportGorakhpur mechanical workshop summer training report
Gorakhpur mechanical workshop summer training report
 
Machine shop notes.pdf
Machine shop notes.pdfMachine shop notes.pdf
Machine shop notes.pdf
 
Classroom Management Presentation
Classroom Management PresentationClassroom Management Presentation
Classroom Management Presentation
 
Gear Cutting Presentation for Polytechnic College Students of India
Gear Cutting Presentation for Polytechnic College Students of IndiaGear Cutting Presentation for Polytechnic College Students of India
Gear Cutting Presentation for Polytechnic College Students of India
 
Classroom Management Techniques
Classroom Management TechniquesClassroom Management Techniques
Classroom Management Techniques
 

Semelhante a Optimize APIs and parallelize requests with ql.io

ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale Subbu Allamaraju
 
Making Things Work Together
Making Things Work TogetherMaking Things Work Together
Making Things Work TogetherSubbu Allamaraju
 
Up and Running with Angular
Up and Running with AngularUp and Running with Angular
Up and Running with AngularJustin James
 
Norikra: SQL Stream Processing In Ruby
Norikra: SQL Stream Processing In RubyNorikra: SQL Stream Processing In Ruby
Norikra: SQL Stream Processing In RubySATOSHI TAGOMORI
 
Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.Keshav Murthy
 
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 Mark Rees
 
Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...
Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...
Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...Amazon Web Services
 
Application Monitoring using Open Source: VictoriaMetrics - ClickHouse
Application Monitoring using Open Source: VictoriaMetrics - ClickHouseApplication Monitoring using Open Source: VictoriaMetrics - ClickHouse
Application Monitoring using Open Source: VictoriaMetrics - ClickHouseVictoriaMetrics
 
Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...
Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...
Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...Altinity Ltd
 
Docker Voting App Orientation
Docker Voting App OrientationDocker Voting App Orientation
Docker Voting App OrientationTony Pujals
 
Big Data-Driven Applications with Cassandra and Spark
Big Data-Driven Applications  with Cassandra and SparkBig Data-Driven Applications  with Cassandra and Spark
Big Data-Driven Applications with Cassandra and SparkArtem Chebotko
 
MongoDB Days UK: Using MongoDB and Python for Data Analysis Pipelines
MongoDB Days UK: Using MongoDB and Python for Data Analysis PipelinesMongoDB Days UK: Using MongoDB and Python for Data Analysis Pipelines
MongoDB Days UK: Using MongoDB and Python for Data Analysis PipelinesMongoDB
 
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS SummitAutomatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS SummitAmazon Web Services
 
Managing Large-scale Networks with Trigger
Managing Large-scale Networks with TriggerManaging Large-scale Networks with Trigger
Managing Large-scale Networks with Triggerjathanism
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCLFastly
 
MongoDB Days Silicon Valley: MongoDB and the Hadoop Connector
MongoDB Days Silicon Valley: MongoDB and the Hadoop ConnectorMongoDB Days Silicon Valley: MongoDB and the Hadoop Connector
MongoDB Days Silicon Valley: MongoDB and the Hadoop ConnectorMongoDB
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuningAOE
 
Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)DoiT International
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Jen Andre
 

Semelhante a Optimize APIs and parallelize requests with ql.io (20)

ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale
 
Making Things Work Together
Making Things Work TogetherMaking Things Work Together
Making Things Work Together
 
Up and Running with Angular
Up and Running with AngularUp and Running with Angular
Up and Running with Angular
 
Norikra: SQL Stream Processing In Ruby
Norikra: SQL Stream Processing In RubyNorikra: SQL Stream Processing In Ruby
Norikra: SQL Stream Processing In Ruby
 
Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.
 
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
 
Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...
Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...
Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...
 
Application Monitoring using Open Source: VictoriaMetrics - ClickHouse
Application Monitoring using Open Source: VictoriaMetrics - ClickHouseApplication Monitoring using Open Source: VictoriaMetrics - ClickHouse
Application Monitoring using Open Source: VictoriaMetrics - ClickHouse
 
Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...
Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...
Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHo...
 
Docker Voting App Orientation
Docker Voting App OrientationDocker Voting App Orientation
Docker Voting App Orientation
 
Big Data-Driven Applications with Cassandra and Spark
Big Data-Driven Applications  with Cassandra and SparkBig Data-Driven Applications  with Cassandra and Spark
Big Data-Driven Applications with Cassandra and Spark
 
Docker In Bank Unrated
Docker In Bank UnratedDocker In Bank Unrated
Docker In Bank Unrated
 
MongoDB Days UK: Using MongoDB and Python for Data Analysis Pipelines
MongoDB Days UK: Using MongoDB and Python for Data Analysis PipelinesMongoDB Days UK: Using MongoDB and Python for Data Analysis Pipelines
MongoDB Days UK: Using MongoDB and Python for Data Analysis Pipelines
 
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS SummitAutomatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
 
Managing Large-scale Networks with Trigger
Managing Large-scale Networks with TriggerManaging Large-scale Networks with Trigger
Managing Large-scale Networks with Trigger
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 
MongoDB Days Silicon Valley: MongoDB and the Hadoop Connector
MongoDB Days Silicon Valley: MongoDB and the Hadoop ConnectorMongoDB Days Silicon Valley: MongoDB and the Hadoop Connector
MongoDB Days Silicon Valley: MongoDB and the Hadoop Connector
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
 
Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 

Mais de Subbu Allamaraju

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)Subbu Allamaraju
 
Are We Ready for Serverless
Are We Ready for ServerlessAre We Ready for Serverless
Are We Ready for ServerlessSubbu Allamaraju
 
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 ColleaguesSubbu Allamaraju
 
Turning Containers into Cattle
Turning Containers into CattleTurning Containers into Cattle
Turning Containers into CattleSubbu Allamaraju
 
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 UniverseSubbu Allamaraju
 
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 PayPalSubbu Allamaraju
 
RESTful Web Apps - Facts vs Fiction
RESTful Web Apps - Facts vs FictionRESTful Web Apps - Facts vs Fiction
RESTful Web Apps - Facts vs FictionSubbu Allamaraju
 

Mais 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

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

Optimize APIs and parallelize requests with ql.io

  • 2. Hello, I'm Subbu Allamaraju @sallamar http://www.subbu.org 2
  • 3. 3
  • 5. Consumers Producers XX,000,000,000 APIs req/day 5
  • 6. Consumers XX,000,000,000 APIs Many 6 Producers
  • 7. Consumers XX,000,000,000 Dialects Many 7 Producers
  • 8. Producers Dialects Q1: Make them RESTful Many and consistent? 8
  • 9. Consumers Producers > 1 req per user action 9
  • 10. Consumers Q2: Optimize producers for every consumer? 10
  • 12. 12
  • 13. 13
  • 14. 14
  • 15. 15
  • 16. 16
  • 17. 17
  • 18. 18
  • 19. Client Server-1 Server-2 Server-3 t1 t2 (t1+t2+t3) t3 Sprint 1: Blocking IO code with sequential requests 19
  • 20. Client Server-1 Server-2 Server-3 max(t1,t2,t3) Sprint 4: Parallelize independent requests 20
  • 21. Client Server-1 Server-2 Server-3 Server-4 max(max(t1+ t4),t2,t3) Sprint "n": 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. 24
  • 25. Easy and fast HTTP consumption 25
  • 26. 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 26
  • 27. Lines of code for 5 API calls Data size (k) before after 27
  • 28. Lines of code for API calls Data size (k) before after 28
  • 30. A DSL for HTTP An HTTP gateway Built on node.js 30
  • 31. 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" 31
  • 32. HTTP Resources as Tables create table bitly.shorten on insert get from 'http://api.bitly.com/v3/shorten?login={^login}&apiKey={^apikey}&longUrl={^longUrl}&f ormat={format}' using defaults apikey = "…", login = "…", format = "json" resultset 'data.url' on select get from http://api.bitly.com/v3/expand?login={^login}&apiKey={^apikey}&shortUrl={^shortUrl}& format={format} using defaults apikey = "…", login = "…", format = "json" resultset 'data.expand' 32
  • 33. Any HTTP Method // 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 = '…' using bodyTemplate 'bing.soap.xml.mu' type 'application/xml' resultset 'soapenv:Envelope.soapenv:Body.SearchResponse.parameters.Web.Results. WebResult'; 33
  • 34. Body Templates <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <SearchRequest xmlns="http://schemas.microsoft.com/LiveSearch/2008/03/Search"> <parameters> {{#params}} <Query>{{q}}</Query> <AppId>{{appid}}</AppId> {{/params}} <Sources> <SourceType>Web</SourceType> </Sources> </parameters> </SearchRequest> </soapenv:Body> </soapenv:Envelope> 34
  • 35. 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}" } 35
  • 36. Implicit Fork-Join 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 36
  • 38. As a Gateway ql.io as an HTTP Client apps Gateway S-1 S-2 S-3 S-4 Optional streaming through WebSockets 38
  • 39. 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; 39
  • 40. -- Show daily deals - use siteId=0 for US -- and siteId=3 for UK. dailyDealsResponse = select * from dailydeals where siteId="{siteId}"; dailyDeals = "{dailyDealsResponse.$..Item}"; itemDetails = select ItemID as itemId, Title as title, GalleryURL as pic, Seller.UserID as sellerUserId, Seller.FeedbackScore as feedback, HitCount as pageViews from details where itemId in (dailyDeals.ItemID); return itemDetails via route '/deals/{siteId}' using method get; 40
  • 41. 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(result.body); }); }); 41
  • 42. mkdir myapp cd myapp curl -L "http://tinyurl.com/7cgglby"| bash bin/start.sh 42
  • 43. We're Hiring DM @sallamar 43