SlideShare une entreprise Scribd logo
1  sur  13
Télécharger pour lire hors ligne
JSONH
An story in mobile API optimisation & how to get data
stuff faster.
Tuesday, 1 April 14
Tuesday, 1 April 14
Back in the day when I could barely pronounce API and for me,
JavaScript was some esoteric magic that induced pain and wonder.
Tuesday, 1 April 14
Mobile phones were unwieldy bricks of plastic and metal with huge antennas and then hefty
charge
W.A.P was the new kid on the block and I had to print out yet another manual to accompany my
hefty collection of mySQL 3.x and HTML / HTTP specs
I can remember that it filled me with hope & excitement period and helped cross the bridge
between our flashy web bracket plan intended bracket and these always connected devices with
screens the size of stamps
Tuesday, 1 April 14
Actually taking to where what's the point of this well today, you see, we have a
super bit, quadruple powered Infinity Gauntlet charged broadband speeds...
It's made us a little lazy KiloBytes?... pah! Peanuts four our broadband connected
society…
Tuesday, 1 April 14
But then came the iPhone followed by nestle droid sorry android and the rabbit holes
appeared we developers dived in red pill please and our complacency led us to grow home
bellies
Not really but my point is this to be really care or understand how user base not only in the
first I know we do so how can we improve our code designs technical debt and get out of a
lazy programming interface frame of mind
Cost of an API call
Tuesday, 1 April 14
I was looking for only that I wanted to increase performance speed
reducing packet size & cost of an API call. Specifically for a mobile
project talking to a node.ACS service interacting with one or more APIs
Mobile API query
TELCO WIFI
MIDDLEWARE SERVER
DATA BACKBONE
API PROVIDER DATA SOURCE
Cost of an
HTTP
REQUEST...
Tuesday, 1 April 14
EXPLAIN DIAGRAM & MULTIPLE REQUESTS
JSONH
JSON compression search
CJSON & JSON w HPack (now JSONH)
JSONH for Homogenous Collections
http://web-resource-optimization.blogspot.co.uk/2011/06/json-
compression-algorithms.html
A collection of objects with the same dynamic type. Arrays are the
most common homogeneous collection objects.
David J. Barnes
Tuesday, 1 April 14
Compression Comparison
JSONH looked best.
Tuesday, 1 April 14
Setting Up - 1
GET JSONH library
GET JSONminify (optional to strip whitespace/
comments)
Add both libraries into your project.
Add to Node.ACS & into your Ti project
Tuesday, 1 April 14
Setting Up - 2
Include the libs into your
Node.ACS/Ti App / Server
Minify & pack the data
Return string
var jsonminify = require("jsonminify");
var JSONH = require('jsonh');
! ! var resString = _minifyJS(data);
! ! resString.Contents = JSONH.pack(resString.Contents);
! ! return (JSON.stringify(resString));
Tuesday, 1 April 14
Setting Up - 3
decompress collection in
app
! function callback(e) {
! ! Ti.API.log('mobile request callback');
! ! var rJson = JSON.parse(e);
! ! // get return data and parse then unpack the JSON.
! ! rJson.Contents = JSONH.unpack(rJson.Contents);
! ! return rJson;
! }
Tuesday, 1 April 14
ACS/AWS
3rd Party
Service API Method
Stringify Reponse
Minify Reponse
pack JSONH
homogenous
collection node
Mobile Function
requires Data/ API
Call
Q
Q
Q
Parse responseText if
required
UNPACK JSONH
homogenous
collection node
API: XHR callback
API: XHR
HTTPRequest
Node.ACS
Service API Method
JSON
D
Q Decision based on query parameters
D Data response from HTTPClient
API: callback
API:
HTTPRequest
JSON / (string/min)ified
D
Mobile
JSON Compression: HPACK
using jsonh.js
Mobile > Node.ACS > ACS > Mobile
Ketan Majmudar
Tuesday, 1 April 14

Contenu connexe

Similaire à Mobile API Optimization with JSONH Compression

Apachecon 2011 stanbol_ogrisel
Apachecon 2011 stanbol_ogriselApachecon 2011 stanbol_ogrisel
Apachecon 2011 stanbol_ogriselNuxeo
 
NPR - NewMediaDays2010 - Flexible Content
NPR - NewMediaDays2010 - Flexible ContentNPR - NewMediaDays2010 - Flexible Content
NPR - NewMediaDays2010 - Flexible Contentzachbrand
 
Apache Stanbol 
and the Web of Data - ApacheCon 2011
Apache Stanbol 
and the Web of Data - ApacheCon 2011Apache Stanbol 
and the Web of Data - ApacheCon 2011
Apache Stanbol 
and the Web of Data - ApacheCon 2011Nuxeo
 
Introducing Riak and Ripple
Introducing Riak and RippleIntroducing Riak and Ripple
Introducing Riak and RippleSean Cribbs
 
W2E NY 2010 NPR Everywhere
W2E NY 2010 NPR EverywhereW2E NY 2010 NPR Everywhere
W2E NY 2010 NPR Everywherezachbrand
 
Ebook undisturbed rest-v1 [res_tful apis]
Ebook undisturbed rest-v1 [res_tful apis]Ebook undisturbed rest-v1 [res_tful apis]
Ebook undisturbed rest-v1 [res_tful apis]johnkbutcher
 
Linked data driven EPCIS Event-based Traceability across Supply chain busine...
Linked data driven EPCIS Event-based Traceability across  Supply chain busine...Linked data driven EPCIS Event-based Traceability across  Supply chain busine...
Linked data driven EPCIS Event-based Traceability across Supply chain busine...Monika Solanki
 
Mashups and data portals where next? (spatial@gov)
Mashups and data portals where next? (spatial@gov)Mashups and data portals where next? (spatial@gov)
Mashups and data portals where next? (spatial@gov)josediacono
 
Open Annotation Collaboration Briefing
Open Annotation Collaboration BriefingOpen Annotation Collaboration Briefing
Open Annotation Collaboration BriefingTimothy Cole
 
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009Boris Mann
 
Web2expo 2011u
Web2expo 2011uWeb2expo 2011u
Web2expo 2011uzachbrand
 
OpenData, Web Semântica e afins.
OpenData, Web Semântica e afins.OpenData, Web Semântica e afins.
OpenData, Web Semântica e afins.Alexandre Gomes
 
One Page, One App -or- How to Write a Crawlable Single Page Web App
One Page, One App -or- How to Write a Crawlable Single Page Web AppOne Page, One App -or- How to Write a Crawlable Single Page Web App
One Page, One App -or- How to Write a Crawlable Single Page Web Apptechnicolorenvy
 
Hadoop webinar-130808141030-phpapp01
Hadoop webinar-130808141030-phpapp01Hadoop webinar-130808141030-phpapp01
Hadoop webinar-130808141030-phpapp01Kaushik Dey
 
Hateoas APIs are about relationships
Hateoas APIs are about relationshipsHateoas APIs are about relationships
Hateoas APIs are about relationshipsMatt Bishop
 
NPR API: Create Once Publish Everywhere
NPR API: Create Once Publish EverywhereNPR API: Create Once Publish Everywhere
NPR API: Create Once Publish Everywherezachbrand
 
Shifting from a newspapermindset to an information perspective
Shifting from a newspapermindset to an information perspectiveShifting from a newspapermindset to an information perspective
Shifting from a newspapermindset to an information perspectiveWAN-IFRA
 

Similaire à Mobile API Optimization with JSONH Compression (20)

Apachecon 2011 stanbol_ogrisel
Apachecon 2011 stanbol_ogriselApachecon 2011 stanbol_ogrisel
Apachecon 2011 stanbol_ogrisel
 
NPR - NewMediaDays2010 - Flexible Content
NPR - NewMediaDays2010 - Flexible ContentNPR - NewMediaDays2010 - Flexible Content
NPR - NewMediaDays2010 - Flexible Content
 
Apache Stanbol 
and the Web of Data - ApacheCon 2011
Apache Stanbol 
and the Web of Data - ApacheCon 2011Apache Stanbol 
and the Web of Data - ApacheCon 2011
Apache Stanbol 
and the Web of Data - ApacheCon 2011
 
Introducing Riak and Ripple
Introducing Riak and RippleIntroducing Riak and Ripple
Introducing Riak and Ripple
 
W2E NY 2010 NPR Everywhere
W2E NY 2010 NPR EverywhereW2E NY 2010 NPR Everywhere
W2E NY 2010 NPR Everywhere
 
Ebook undisturbed rest-v1 [res_tful apis]
Ebook undisturbed rest-v1 [res_tful apis]Ebook undisturbed rest-v1 [res_tful apis]
Ebook undisturbed rest-v1 [res_tful apis]
 
Linked data driven EPCIS Event-based Traceability across Supply chain busine...
Linked data driven EPCIS Event-based Traceability across  Supply chain busine...Linked data driven EPCIS Event-based Traceability across  Supply chain busine...
Linked data driven EPCIS Event-based Traceability across Supply chain busine...
 
Mashups and data portals where next? (spatial@gov)
Mashups and data portals where next? (spatial@gov)Mashups and data portals where next? (spatial@gov)
Mashups and data portals where next? (spatial@gov)
 
Open Annotation Collaboration Briefing
Open Annotation Collaboration BriefingOpen Annotation Collaboration Briefing
Open Annotation Collaboration Briefing
 
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
 
Web2expo 2011u
Web2expo 2011uWeb2expo 2011u
Web2expo 2011u
 
OpenData, Web Semântica e afins.
OpenData, Web Semântica e afins.OpenData, Web Semântica e afins.
OpenData, Web Semântica e afins.
 
Introducing Placemaker
Introducing PlacemakerIntroducing Placemaker
Introducing Placemaker
 
20100714accel
20100714accel20100714accel
20100714accel
 
One Page, One App -or- How to Write a Crawlable Single Page Web App
One Page, One App -or- How to Write a Crawlable Single Page Web AppOne Page, One App -or- How to Write a Crawlable Single Page Web App
One Page, One App -or- How to Write a Crawlable Single Page Web App
 
Hadoop webinar-130808141030-phpapp01
Hadoop webinar-130808141030-phpapp01Hadoop webinar-130808141030-phpapp01
Hadoop webinar-130808141030-phpapp01
 
Hateoas APIs are about relationships
Hateoas APIs are about relationshipsHateoas APIs are about relationships
Hateoas APIs are about relationships
 
2010 Sopac Cosugi
2010 Sopac Cosugi2010 Sopac Cosugi
2010 Sopac Cosugi
 
NPR API: Create Once Publish Everywhere
NPR API: Create Once Publish EverywhereNPR API: Create Once Publish Everywhere
NPR API: Create Once Publish Everywhere
 
Shifting from a newspapermindset to an information perspective
Shifting from a newspapermindset to an information perspectiveShifting from a newspapermindset to an information perspective
Shifting from a newspapermindset to an information perspective
 

Plus de Ket Majmudar

Ti.connect Awesome UX/UI Strategy with T-10
Ti.connect  Awesome UX/UI Strategy with T-10 Ti.connect  Awesome UX/UI Strategy with T-10
Ti.connect Awesome UX/UI Strategy with T-10 Ket Majmudar
 
T-10 Presentation TiConf EU
T-10 Presentation TiConf EU T-10 Presentation TiConf EU
T-10 Presentation TiConf EU Ket Majmudar
 
T-10 Session at Over The Air 2013
T-10 Session at Over The Air 2013T-10 Session at Over The Air 2013
T-10 Session at Over The Air 2013Ket Majmudar
 
Titanium London - URLs & Alloy vs CommonJS
Titanium London - URLs & Alloy vs CommonJSTitanium London - URLs & Alloy vs CommonJS
Titanium London - URLs & Alloy vs CommonJSKet Majmudar
 
T-10 International Space Apps Challenge Presentation in London 2013
T-10 International Space Apps Challenge Presentation in London 2013T-10 International Space Apps Challenge Presentation in London 2013
T-10 International Space Apps Challenge Presentation in London 2013Ket Majmudar
 
London Titanium July 2012 Intro
London Titanium July 2012 IntroLondon Titanium July 2012 Intro
London Titanium July 2012 IntroKet Majmudar
 
London Titanium July 2012 Intro
London Titanium July 2012 IntroLondon Titanium July 2012 Intro
London Titanium July 2012 IntroKet Majmudar
 
SQLite - Dynamic Data in Titanium
SQLite - Dynamic Data in TitaniumSQLite - Dynamic Data in Titanium
SQLite - Dynamic Data in TitaniumKet Majmudar
 
Kitchen Sink to App
Kitchen Sink to AppKitchen Sink to App
Kitchen Sink to AppKet Majmudar
 
Getting Started with Titanium Studio
Getting Started with Titanium StudioGetting Started with Titanium Studio
Getting Started with Titanium StudioKet Majmudar
 
Titanium London - Going Social - June 2011
Titanium London - Going Social - June 2011Titanium London - Going Social - June 2011
Titanium London - Going Social - June 2011Ket Majmudar
 
How to build your own 3D Digital Camera rig
How to build your own 3D Digital Camera rig How to build your own 3D Digital Camera rig
How to build your own 3D Digital Camera rig Ket Majmudar
 

Plus de Ket Majmudar (13)

Ti.connect Awesome UX/UI Strategy with T-10
Ti.connect  Awesome UX/UI Strategy with T-10 Ti.connect  Awesome UX/UI Strategy with T-10
Ti.connect Awesome UX/UI Strategy with T-10
 
T-10 Presentation TiConf EU
T-10 Presentation TiConf EU T-10 Presentation TiConf EU
T-10 Presentation TiConf EU
 
T-10 Session at Over The Air 2013
T-10 Session at Over The Air 2013T-10 Session at Over The Air 2013
T-10 Session at Over The Air 2013
 
Titanium London - URLs & Alloy vs CommonJS
Titanium London - URLs & Alloy vs CommonJSTitanium London - URLs & Alloy vs CommonJS
Titanium London - URLs & Alloy vs CommonJS
 
T-10 International Space Apps Challenge Presentation in London 2013
T-10 International Space Apps Challenge Presentation in London 2013T-10 International Space Apps Challenge Presentation in London 2013
T-10 International Space Apps Challenge Presentation in London 2013
 
London Titanium July 2012 Intro
London Titanium July 2012 IntroLondon Titanium July 2012 Intro
London Titanium July 2012 Intro
 
London Titanium July 2012 Intro
London Titanium July 2012 IntroLondon Titanium July 2012 Intro
London Titanium July 2012 Intro
 
SQLite - Dynamic Data in Titanium
SQLite - Dynamic Data in TitaniumSQLite - Dynamic Data in Titanium
SQLite - Dynamic Data in Titanium
 
Titanium setup
Titanium setupTitanium setup
Titanium setup
 
Kitchen Sink to App
Kitchen Sink to AppKitchen Sink to App
Kitchen Sink to App
 
Getting Started with Titanium Studio
Getting Started with Titanium StudioGetting Started with Titanium Studio
Getting Started with Titanium Studio
 
Titanium London - Going Social - June 2011
Titanium London - Going Social - June 2011Titanium London - Going Social - June 2011
Titanium London - Going Social - June 2011
 
How to build your own 3D Digital Camera rig
How to build your own 3D Digital Camera rig How to build your own 3D Digital Camera rig
How to build your own 3D Digital Camera rig
 

Dernier

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profileakrivarotava
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 

Dernier (20)

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profile
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 

Mobile API Optimization with JSONH Compression

  • 1. JSONH An story in mobile API optimisation & how to get data stuff faster. Tuesday, 1 April 14
  • 2. Tuesday, 1 April 14 Back in the day when I could barely pronounce API and for me, JavaScript was some esoteric magic that induced pain and wonder.
  • 3. Tuesday, 1 April 14 Mobile phones were unwieldy bricks of plastic and metal with huge antennas and then hefty charge W.A.P was the new kid on the block and I had to print out yet another manual to accompany my hefty collection of mySQL 3.x and HTML / HTTP specs I can remember that it filled me with hope & excitement period and helped cross the bridge between our flashy web bracket plan intended bracket and these always connected devices with screens the size of stamps
  • 4. Tuesday, 1 April 14 Actually taking to where what's the point of this well today, you see, we have a super bit, quadruple powered Infinity Gauntlet charged broadband speeds... It's made us a little lazy KiloBytes?... pah! Peanuts four our broadband connected society…
  • 5. Tuesday, 1 April 14 But then came the iPhone followed by nestle droid sorry android and the rabbit holes appeared we developers dived in red pill please and our complacency led us to grow home bellies Not really but my point is this to be really care or understand how user base not only in the first I know we do so how can we improve our code designs technical debt and get out of a lazy programming interface frame of mind
  • 6. Cost of an API call Tuesday, 1 April 14 I was looking for only that I wanted to increase performance speed reducing packet size & cost of an API call. Specifically for a mobile project talking to a node.ACS service interacting with one or more APIs
  • 7. Mobile API query TELCO WIFI MIDDLEWARE SERVER DATA BACKBONE API PROVIDER DATA SOURCE Cost of an HTTP REQUEST... Tuesday, 1 April 14 EXPLAIN DIAGRAM & MULTIPLE REQUESTS
  • 8. JSONH JSON compression search CJSON & JSON w HPack (now JSONH) JSONH for Homogenous Collections http://web-resource-optimization.blogspot.co.uk/2011/06/json- compression-algorithms.html A collection of objects with the same dynamic type. Arrays are the most common homogeneous collection objects. David J. Barnes Tuesday, 1 April 14
  • 9. Compression Comparison JSONH looked best. Tuesday, 1 April 14
  • 10. Setting Up - 1 GET JSONH library GET JSONminify (optional to strip whitespace/ comments) Add both libraries into your project. Add to Node.ACS & into your Ti project Tuesday, 1 April 14
  • 11. Setting Up - 2 Include the libs into your Node.ACS/Ti App / Server Minify & pack the data Return string var jsonminify = require("jsonminify"); var JSONH = require('jsonh'); ! ! var resString = _minifyJS(data); ! ! resString.Contents = JSONH.pack(resString.Contents); ! ! return (JSON.stringify(resString)); Tuesday, 1 April 14
  • 12. Setting Up - 3 decompress collection in app ! function callback(e) { ! ! Ti.API.log('mobile request callback'); ! ! var rJson = JSON.parse(e); ! ! // get return data and parse then unpack the JSON. ! ! rJson.Contents = JSONH.unpack(rJson.Contents); ! ! return rJson; ! } Tuesday, 1 April 14
  • 13. ACS/AWS 3rd Party Service API Method Stringify Reponse Minify Reponse pack JSONH homogenous collection node Mobile Function requires Data/ API Call Q Q Q Parse responseText if required UNPACK JSONH homogenous collection node API: XHR callback API: XHR HTTPRequest Node.ACS Service API Method JSON D Q Decision based on query parameters D Data response from HTTPClient API: callback API: HTTPRequest JSON / (string/min)ified D Mobile JSON Compression: HPACK using jsonh.js Mobile > Node.ACS > ACS > Mobile Ketan Majmudar Tuesday, 1 April 14