SlideShare a Scribd company logo
Real-time API consumptionReal-time API consumption
what? why? how?
Eric Horesnyi
@StreamdataIO
Paris, Dec'15
@ApidaysGlobal
Our brain is Real-timeOur brain is Real-time
Amazon found every 100 milliseconds of apps latency cost
them 1% in
sales http://perspectives.mvdirona.com/2009/10/31/Th
eCostOfLatency.aspx
Google found an extra 0.5 seconds in search page generation
time dropped traffic by
20%. http://highscalability.com/latency-everywhere-and-
it-costs-you-sales-how-crush-it
Real-time UX i$...Real-time UX i$...
Rea£ Mon€¥Rea£ Mon€¥
Blockbuster apps: 1% only
2,000 apps2,000 apps
1m+ downloads - 10m d.API calls
App rating
Dwell time
Sharing in
Real-time
{API}{API}(UX)(UX)
UX-focus / API-focusUX-focus / API-focus
2012/Single European
Railway Area
Real-time is relativeReal-time is relative
On informationOn information
symmetrysymmetry
-Nanosec Millisec X00ms Seconds Minutes+
High
Frequency
Trading
Algorithmic
Trading
Day
Trading
Retail
Traders
Investors
Real-time sharingReal-time sharing
busting insidersbusting insiders
GD Saxton, SUNY, 2013: 90-day insider profit
4.4% > 0.9%
The End of Information Assymmetry
Latency x5Latency x5
Bandwidth /10Bandwidth /10
Data updates x60Data updates x60
Devices x10Devices x10
Data volume x2Data volume x2
Polling/Long-PollingPolling/Long-Polling
HTTP HackHTTP Hack Don't use it anymoreDon't use it anymore
WebSocketsWebSockets Server-SentServer-Sent
EventsEvents
var websocket =
new WebSocket('ws://websocketserver/echo');
websocket.onopen = function () {
...
};
websocket.onmessage = function (e) {
...
};
websocket.onerror = function (error) {
...
};
var eventSource =
new EventSource('http://sseserver/echo');
eventSource.onopen = function () {
...
};
eventSource.onmessage = function (e) {
...
};
eventSource.onerror = function (error) {
...
};
eventSource.addEventListener('foo', function(e) {
...
}, false);
WebSocketsWebSockets Server-SentServer-Sent
EventsEvents
TCP
Error Handling : TBD
Protocol upgrade
GET /chat HTTP/1.1
Host: example.com:8000
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13
GET /stream HTTP/1.1 1
Host: example.com
Accept: text/event-stream
HTTP=Standard
HTTP/2 leverage
No Loadbalancer, Proxy, or
FW reconfig
LatencyLatency
Use case: Pre-load of 500 Tweets on a web page web
Source http://matthiasnehlsen.com/blog/2013/05/01/server-sent-events-vs-websockets/
WebSocketsWebSockets
Server-SentServer-Sent
EventsEvents
Reactive+HTTP/2+SSE=Reactive+HTTP/2+SSE=
UX-API end-to-end event-driven data stream
.OnData()
.OnPatch()
.OnClose()
#REST API
JSON
{"EURUSD",
"1.1233123"}
{"EURGBP",
"0.9233123"}
{"EURJPY",
"98.456788"}
{"EURAUD",
"1.4828679"}
#JSON PATCH
{
"EURUSD",
"1.1233123"
}
#HashMap
{"EURUSD",
"1.1233123"}
{"EURGBP",
"0.9233123"}
{"EURJPY",
"98.456788"}
{"EURAUD",
"1.4828679"}
#Observables
.Mount(tag)
JSON-Patch (RFC 6902)JSON-Patch (RFC 6902)
[{"title":"Value 0","price":66,"param1":"1","param2":"22","param3":"33"},
{"title":"Value 1","price":63,"param1":"11","param2":"2","param3":"53"},
{"title":"Value 2","price":85,"param1":"1","param2":"22","param3":"33"},
{"title":"Value 3","price":21,"param1":"31","param2":"12","param3":"4"},
{"title":"Value 4","price":10,"param1":"151","param2":"22","param3":"33"},
{"title":"Value 5","price":6,"param1":"11","param2":"21","param3":"33"},
{"title":"Value 6","price":60,"param1":"11","param2":"222","param3":"33"}]
[{"op":"replace","path":"/2/price","value":5},
{"op":"replace","path":"/3/param2","value":"32"}]
[{"title":"Value 0","price":66,"param1":"1","param2":"22","param3":"33"},
{"title":"Value 1","price":63,"param1":"11","param2":"2","param3":"53"},
{"title":"Value 2","price":5,"param1":"1","param2":"22","param3":"33"},
{"title":"Value 3","price":21,"param1":"31","param2":"32","param3":"4"},
{"title":"Value 4","price":10,"param1":"151","param2":"22","param3":"33"},
{"title":"Value 5","price":6,"param1":"11","param2":"21","param3":"33"},
{"title":"Value 6","price":60,"param1":"11","param2":"222","param3":"33"}]
UI speed with Json PatchUI speed with Json Patch
http://streamdata.io/blog/ui-latency-json-patch/
Patch
x20 faster
Coding Session this AfternoonCoding Session this Afternoon
DevopsDevops
RecipesRecipes
Latency
Scalability
ErlangErlang
E=λh
λ: intensity
h: hold time
A.K. Erlang
M/M/c/c queue
aka Little's Law
//US Equity broker
// Audience: 1 million
Var a = 1000000
// Engagement: 10%
Var e = 0.1
// Hold: 3 minutes
Var h = 180
// Intensity: 25% during last 30' market close
// Total day : 8 hours a day (trading day)
Var i = 0.25 * 8 / 0.5
Var E = a * e * h * i
>>> print (E)
>>> 2500 # E erlang traffic
// Cluster: 80% on S&P500
Var c = 0.8
// Frequency: update/sec
Var f = 1
// Non-blocking Erlang Pb (E, m) 99.99% non-blocking
#recursive search m in range (5 * E) until Pb ( E, m ) > 0.0001
>>>print (m)
>>>2650 #streams w/out cache
>>>2650*(1-c)=265 #API streams w/cache
Sizing APISizing API
trunkstrunks
API Server & Network LoadAPI Server & Network Load
pollingpolling w/ streamdata.iow/ streamdata.io
10,000 concurrent clients
API Server CPUAPI Server CPU
Battery UsageBattery Usage
Regular APIRegular API Diff Streamed APIDiff Streamed API
75 to 99% savings75 to 99% savings
APIs in BPA & IoTAPIs in BPA & IoT
real-time statesreal-time states
Real-time UX i$ Rea£ Mon€¥
Symmetry of information = fairness & real-time sharing
HTTP/2+SSE=scalable web standard
End-to-end reactive/event-driven architecture can scale
Stream your API above 10m calls/day - #100k audience
ConclusionConclusion
Thank you!Thank you!
ReferencesReferences
What is Server-Sent Events?
WebSockets vs SSE
Getting started with WebSockets and SSE
Server-Sent Events: The simplest realtime
browser spec
WebSockets / SSEWebSockets / SSE
CreditsCredits
GIFs: giphy
Photos: mostly Wiki

More Related Content

Similar to Real-time API consumption / API streaming: why? what? how?

Chaos engineering applied
Chaos engineering appliedChaos engineering applied
Chaos engineering applied
Ramon Anger
 
Scaling APIs: Predict, Prepare for, Overcome the Challenges
Scaling APIs: Predict, Prepare for, Overcome the ChallengesScaling APIs: Predict, Prepare for, Overcome the Challenges
Scaling APIs: Predict, Prepare for, Overcome the ChallengesApigee | Google Cloud
 
Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Pros and Cons of a MicroServices Architecture talk at AWS ReInventPros and Cons of a MicroServices Architecture talk at AWS ReInvent
Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Sudhir Tonse
 
As Software eats the World, APIs eat Software
As Software eats the World, APIs eat SoftwareAs Software eats the World, APIs eat Software
As Software eats the World, APIs eat Software3scale
 
Données animées
Données animéesDonnées animées
Données animées
PALO IT
 
Crushing Latency with Vert.x
Crushing Latency with Vert.xCrushing Latency with Vert.x
Crushing Latency with Vert.x
Paulo Lopes
 
Jabber 101
Jabber 101Jabber 101
Jabber 101
stpeter
 
The present and future of serverless observability (QCon London)
The present and future of serverless observability (QCon London)The present and future of serverless observability (QCon London)
The present and future of serverless observability (QCon London)
Yan Cui
 
The present and future of Serverless observability
The present and future of Serverless observabilityThe present and future of Serverless observability
The present and future of Serverless observability
Yan Cui
 
The present and future of Serverless observability
The present and future of Serverless observabilityThe present and future of Serverless observability
The present and future of Serverless observability
Yan Cui
 
APIs and Services for Fleet Management - Talks given @ APIDays Berlin and Ba...
APIs and Services for  Fleet Management - Talks given @ APIDays Berlin and Ba...APIs and Services for  Fleet Management - Talks given @ APIDays Berlin and Ba...
APIs and Services for Fleet Management - Talks given @ APIDays Berlin and Ba...
Toralf Richter
 
[MBF2] APIs Orange Partner par Thierry Gaillet
[MBF2] APIs Orange Partner par Thierry Gaillet[MBF2] APIs Orange Partner par Thierry Gaillet
[MBF2] APIs Orange Partner par Thierry Gaillet
BeMyApp
 
Orange APIs as presented at Mobile Banking Factory 2
Orange APIs as presented at Mobile Banking Factory 2Orange APIs as presented at Mobile Banking Factory 2
Orange APIs as presented at Mobile Banking Factory 2
Orange Dev
 
Erlang real time
Erlang real timeErlang real time
Erlang real time
Akshar Desai
 
Apache Flink - a Gentle Start
Apache Flink - a Gentle StartApache Flink - a Gentle Start
Apache Flink - a Gentle Start
Liangjun Jiang
 
Grammarly AI-NLP Club #2 - Recent advances in applied chatbot technology - Jo...
Grammarly AI-NLP Club #2 - Recent advances in applied chatbot technology - Jo...Grammarly AI-NLP Club #2 - Recent advances in applied chatbot technology - Jo...
Grammarly AI-NLP Club #2 - Recent advances in applied chatbot technology - Jo...
Grammarly
 
[Solace] Open Data Movement for Connected Vehicles
[Solace] Open Data Movement for Connected Vehicles[Solace] Open Data Movement for Connected Vehicles
[Solace] Open Data Movement for Connected Vehicles
Tomo Yamaguchi
 
QConSF2016-JoshEvans-MasteringChaosANetflixGuidetoMicroservices-compressed.pdf
QConSF2016-JoshEvans-MasteringChaosANetflixGuidetoMicroservices-compressed.pdfQConSF2016-JoshEvans-MasteringChaosANetflixGuidetoMicroservices-compressed.pdf
QConSF2016-JoshEvans-MasteringChaosANetflixGuidetoMicroservices-compressed.pdf
SimranjyotSuri
 
Creating an Effective Mobile API
Creating an Effective Mobile API Creating an Effective Mobile API
Creating an Effective Mobile API
Nick DeNardis
 
Mastering Chaos - A Netflix Guide to Microservices
Mastering Chaos - A Netflix Guide to MicroservicesMastering Chaos - A Netflix Guide to Microservices
Mastering Chaos - A Netflix Guide to Microservices
Josh Evans
 

Similar to Real-time API consumption / API streaming: why? what? how? (20)

Chaos engineering applied
Chaos engineering appliedChaos engineering applied
Chaos engineering applied
 
Scaling APIs: Predict, Prepare for, Overcome the Challenges
Scaling APIs: Predict, Prepare for, Overcome the ChallengesScaling APIs: Predict, Prepare for, Overcome the Challenges
Scaling APIs: Predict, Prepare for, Overcome the Challenges
 
Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Pros and Cons of a MicroServices Architecture talk at AWS ReInventPros and Cons of a MicroServices Architecture talk at AWS ReInvent
Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
 
As Software eats the World, APIs eat Software
As Software eats the World, APIs eat SoftwareAs Software eats the World, APIs eat Software
As Software eats the World, APIs eat Software
 
Données animées
Données animéesDonnées animées
Données animées
 
Crushing Latency with Vert.x
Crushing Latency with Vert.xCrushing Latency with Vert.x
Crushing Latency with Vert.x
 
Jabber 101
Jabber 101Jabber 101
Jabber 101
 
The present and future of serverless observability (QCon London)
The present and future of serverless observability (QCon London)The present and future of serverless observability (QCon London)
The present and future of serverless observability (QCon London)
 
The present and future of Serverless observability
The present and future of Serverless observabilityThe present and future of Serverless observability
The present and future of Serverless observability
 
The present and future of Serverless observability
The present and future of Serverless observabilityThe present and future of Serverless observability
The present and future of Serverless observability
 
APIs and Services for Fleet Management - Talks given @ APIDays Berlin and Ba...
APIs and Services for  Fleet Management - Talks given @ APIDays Berlin and Ba...APIs and Services for  Fleet Management - Talks given @ APIDays Berlin and Ba...
APIs and Services for Fleet Management - Talks given @ APIDays Berlin and Ba...
 
[MBF2] APIs Orange Partner par Thierry Gaillet
[MBF2] APIs Orange Partner par Thierry Gaillet[MBF2] APIs Orange Partner par Thierry Gaillet
[MBF2] APIs Orange Partner par Thierry Gaillet
 
Orange APIs as presented at Mobile Banking Factory 2
Orange APIs as presented at Mobile Banking Factory 2Orange APIs as presented at Mobile Banking Factory 2
Orange APIs as presented at Mobile Banking Factory 2
 
Erlang real time
Erlang real timeErlang real time
Erlang real time
 
Apache Flink - a Gentle Start
Apache Flink - a Gentle StartApache Flink - a Gentle Start
Apache Flink - a Gentle Start
 
Grammarly AI-NLP Club #2 - Recent advances in applied chatbot technology - Jo...
Grammarly AI-NLP Club #2 - Recent advances in applied chatbot technology - Jo...Grammarly AI-NLP Club #2 - Recent advances in applied chatbot technology - Jo...
Grammarly AI-NLP Club #2 - Recent advances in applied chatbot technology - Jo...
 
[Solace] Open Data Movement for Connected Vehicles
[Solace] Open Data Movement for Connected Vehicles[Solace] Open Data Movement for Connected Vehicles
[Solace] Open Data Movement for Connected Vehicles
 
QConSF2016-JoshEvans-MasteringChaosANetflixGuidetoMicroservices-compressed.pdf
QConSF2016-JoshEvans-MasteringChaosANetflixGuidetoMicroservices-compressed.pdfQConSF2016-JoshEvans-MasteringChaosANetflixGuidetoMicroservices-compressed.pdf
QConSF2016-JoshEvans-MasteringChaosANetflixGuidetoMicroservices-compressed.pdf
 
Creating an Effective Mobile API
Creating an Effective Mobile API Creating an Effective Mobile API
Creating an Effective Mobile API
 
Mastering Chaos - A Netflix Guide to Microservices
Mastering Chaos - A Netflix Guide to MicroservicesMastering Chaos - A Netflix Guide to Microservices
Mastering Chaos - A Netflix Guide to Microservices
 

More from Eric Horesnyi

Evolution of Banks in the Digital Age - Apidays.io London 2019
Evolution of Banks in the Digital Age - Apidays.io London 2019Evolution of Banks in the Digital Age - Apidays.io London 2019
Evolution of Banks in the Digital Age - Apidays.io London 2019
Eric Horesnyi
 
2018 12-10 apidays.io eric horesnyi streamdata.io event-driven ap is
2018 12-10 apidays.io eric horesnyi streamdata.io event-driven ap is2018 12-10 apidays.io eric horesnyi streamdata.io event-driven ap is
2018 12-10 apidays.io eric horesnyi streamdata.io event-driven ap is
Eric Horesnyi
 
Laplace Daemon: from a math theory to AI practice
Laplace Daemon: from a math theory to AI practiceLaplace Daemon: from a math theory to AI practice
Laplace Daemon: from a math theory to AI practice
Eric Horesnyi
 
A Modern API Toolbox
A Modern API ToolboxA Modern API Toolbox
A Modern API Toolbox
Eric Horesnyi
 
A blueprint for open banking standards in the United Kingdom
A blueprint for open banking standards in the United KingdomA blueprint for open banking standards in the United Kingdom
A blueprint for open banking standards in the United Kingdom
Eric Horesnyi
 
Elements of the Fintech revolution - JAX Finance Keynote - April 2016
Elements of the Fintech revolution - JAX Finance Keynote - April 2016Elements of the Fintech revolution - JAX Finance Keynote - April 2016
Elements of the Fintech revolution - JAX Finance Keynote - April 2016
Eric Horesnyi
 

More from Eric Horesnyi (6)

Evolution of Banks in the Digital Age - Apidays.io London 2019
Evolution of Banks in the Digital Age - Apidays.io London 2019Evolution of Banks in the Digital Age - Apidays.io London 2019
Evolution of Banks in the Digital Age - Apidays.io London 2019
 
2018 12-10 apidays.io eric horesnyi streamdata.io event-driven ap is
2018 12-10 apidays.io eric horesnyi streamdata.io event-driven ap is2018 12-10 apidays.io eric horesnyi streamdata.io event-driven ap is
2018 12-10 apidays.io eric horesnyi streamdata.io event-driven ap is
 
Laplace Daemon: from a math theory to AI practice
Laplace Daemon: from a math theory to AI practiceLaplace Daemon: from a math theory to AI practice
Laplace Daemon: from a math theory to AI practice
 
A Modern API Toolbox
A Modern API ToolboxA Modern API Toolbox
A Modern API Toolbox
 
A blueprint for open banking standards in the United Kingdom
A blueprint for open banking standards in the United KingdomA blueprint for open banking standards in the United Kingdom
A blueprint for open banking standards in the United Kingdom
 
Elements of the Fintech revolution - JAX Finance Keynote - April 2016
Elements of the Fintech revolution - JAX Finance Keynote - April 2016Elements of the Fintech revolution - JAX Finance Keynote - April 2016
Elements of the Fintech revolution - JAX Finance Keynote - April 2016
 

Recently uploaded

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 

Recently uploaded (20)

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 

Real-time API consumption / API streaming: why? what? how?

  • 1. Real-time API consumptionReal-time API consumption what? why? how? Eric Horesnyi @StreamdataIO Paris, Dec'15 @ApidaysGlobal
  • 2. Our brain is Real-timeOur brain is Real-time
  • 3.
  • 4. Amazon found every 100 milliseconds of apps latency cost them 1% in sales http://perspectives.mvdirona.com/2009/10/31/Th eCostOfLatency.aspx Google found an extra 0.5 seconds in search page generation time dropped traffic by 20%. http://highscalability.com/latency-everywhere-and- it-costs-you-sales-how-crush-it Real-time UX i$...Real-time UX i$... Rea£ Mon€¥Rea£ Mon€¥ Blockbuster apps: 1% only 2,000 apps2,000 apps 1m+ downloads - 10m d.API calls App rating Dwell time Sharing in Real-time
  • 5. {API}{API}(UX)(UX) UX-focus / API-focusUX-focus / API-focus 2012/Single European Railway Area
  • 6. Real-time is relativeReal-time is relative On informationOn information symmetrysymmetry
  • 7. -Nanosec Millisec X00ms Seconds Minutes+ High Frequency Trading Algorithmic Trading Day Trading Retail Traders Investors
  • 8. Real-time sharingReal-time sharing busting insidersbusting insiders GD Saxton, SUNY, 2013: 90-day insider profit 4.4% > 0.9% The End of Information Assymmetry
  • 9.
  • 10. Latency x5Latency x5 Bandwidth /10Bandwidth /10 Data updates x60Data updates x60 Devices x10Devices x10 Data volume x2Data volume x2
  • 11.
  • 12. Polling/Long-PollingPolling/Long-Polling HTTP HackHTTP Hack Don't use it anymoreDon't use it anymore
  • 13. WebSocketsWebSockets Server-SentServer-Sent EventsEvents var websocket = new WebSocket('ws://websocketserver/echo'); websocket.onopen = function () { ... }; websocket.onmessage = function (e) { ... }; websocket.onerror = function (error) { ... }; var eventSource = new EventSource('http://sseserver/echo'); eventSource.onopen = function () { ... }; eventSource.onmessage = function (e) { ... }; eventSource.onerror = function (error) { ... }; eventSource.addEventListener('foo', function(e) { ... }, false);
  • 14. WebSocketsWebSockets Server-SentServer-Sent EventsEvents TCP Error Handling : TBD Protocol upgrade GET /chat HTTP/1.1 Host: example.com:8000 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Sec-WebSocket-Version: 13 GET /stream HTTP/1.1 1 Host: example.com Accept: text/event-stream HTTP=Standard HTTP/2 leverage No Loadbalancer, Proxy, or FW reconfig
  • 15. LatencyLatency Use case: Pre-load of 500 Tweets on a web page web Source http://matthiasnehlsen.com/blog/2013/05/01/server-sent-events-vs-websockets/
  • 17.
  • 18. Reactive+HTTP/2+SSE=Reactive+HTTP/2+SSE= UX-API end-to-end event-driven data stream .OnData() .OnPatch() .OnClose() #REST API JSON {"EURUSD", "1.1233123"} {"EURGBP", "0.9233123"} {"EURJPY", "98.456788"} {"EURAUD", "1.4828679"} #JSON PATCH { "EURUSD", "1.1233123" } #HashMap {"EURUSD", "1.1233123"} {"EURGBP", "0.9233123"} {"EURJPY", "98.456788"} {"EURAUD", "1.4828679"} #Observables .Mount(tag)
  • 19. JSON-Patch (RFC 6902)JSON-Patch (RFC 6902) [{"title":"Value 0","price":66,"param1":"1","param2":"22","param3":"33"}, {"title":"Value 1","price":63,"param1":"11","param2":"2","param3":"53"}, {"title":"Value 2","price":85,"param1":"1","param2":"22","param3":"33"}, {"title":"Value 3","price":21,"param1":"31","param2":"12","param3":"4"}, {"title":"Value 4","price":10,"param1":"151","param2":"22","param3":"33"}, {"title":"Value 5","price":6,"param1":"11","param2":"21","param3":"33"}, {"title":"Value 6","price":60,"param1":"11","param2":"222","param3":"33"}] [{"op":"replace","path":"/2/price","value":5}, {"op":"replace","path":"/3/param2","value":"32"}] [{"title":"Value 0","price":66,"param1":"1","param2":"22","param3":"33"}, {"title":"Value 1","price":63,"param1":"11","param2":"2","param3":"53"}, {"title":"Value 2","price":5,"param1":"1","param2":"22","param3":"33"}, {"title":"Value 3","price":21,"param1":"31","param2":"32","param3":"4"}, {"title":"Value 4","price":10,"param1":"151","param2":"22","param3":"33"}, {"title":"Value 5","price":6,"param1":"11","param2":"21","param3":"33"}, {"title":"Value 6","price":60,"param1":"11","param2":"222","param3":"33"}]
  • 20. UI speed with Json PatchUI speed with Json Patch http://streamdata.io/blog/ui-latency-json-patch/ Patch x20 faster
  • 21. Coding Session this AfternoonCoding Session this Afternoon
  • 23.
  • 25. ErlangErlang E=λh λ: intensity h: hold time A.K. Erlang M/M/c/c queue aka Little's Law
  • 26. //US Equity broker // Audience: 1 million Var a = 1000000 // Engagement: 10% Var e = 0.1 // Hold: 3 minutes Var h = 180 // Intensity: 25% during last 30' market close // Total day : 8 hours a day (trading day) Var i = 0.25 * 8 / 0.5 Var E = a * e * h * i >>> print (E) >>> 2500 # E erlang traffic // Cluster: 80% on S&P500 Var c = 0.8 // Frequency: update/sec Var f = 1 // Non-blocking Erlang Pb (E, m) 99.99% non-blocking #recursive search m in range (5 * E) until Pb ( E, m ) > 0.0001 >>>print (m) >>>2650 #streams w/out cache >>>2650*(1-c)=265 #API streams w/cache Sizing APISizing API trunkstrunks
  • 27. API Server & Network LoadAPI Server & Network Load pollingpolling w/ streamdata.iow/ streamdata.io 10,000 concurrent clients API Server CPUAPI Server CPU
  • 28. Battery UsageBattery Usage Regular APIRegular API Diff Streamed APIDiff Streamed API 75 to 99% savings75 to 99% savings
  • 29. APIs in BPA & IoTAPIs in BPA & IoT real-time statesreal-time states
  • 30. Real-time UX i$ Rea£ Mon€¥ Symmetry of information = fairness & real-time sharing HTTP/2+SSE=scalable web standard End-to-end reactive/event-driven architecture can scale Stream your API above 10m calls/day - #100k audience ConclusionConclusion Thank you!Thank you!
  • 31. ReferencesReferences What is Server-Sent Events? WebSockets vs SSE Getting started with WebSockets and SSE Server-Sent Events: The simplest realtime browser spec WebSockets / SSEWebSockets / SSE