SlideShare a Scribd company logo
1 of 44
@andyp1per#RealTimeMobile
Delivering Rich, Real-Time Mobile User Experiences
Dr Andy Piper
Push Technology Ltd.
@andyp1per
www.pushtechnology.com
@andyp1per#RealTimeMobile
Delivering Rich, Real-Time Mobile User
Experiences
• Dr Andy Piper
• CTO at Push Technology
• Ex-BEA/Oracle
• Architect for WebLogic Server Core
• Architect and then Engineering Director for Oracle Event Processing
• Spring contributor (Spring DM) and Author
• Contributed to many standards – OMG, JCP, OSGi Alliance
• PhD, Cambridge, Distributed Systems
• MBA, Warwick Business School
@andyp1per#RealTimeMobile
What we do
Software that enables rich real-time user experiences,
where the Right Content is delivered to the Right User,
at the Right Time, on any device, platform or application,
regardless of connectivity or location.
@andyp1per#RealTimeMobile
Introduction
• My nightmare – the app that sometimes works
• Why is it frustrating?
@andyp1per#RealTimeMobile
The problem with mobile
10Gbps pipe, reliable 99.9999%
Dedicated Network
2-50Mbps pipe
Internet
Unreliable speed
0.5-4Mbps pipe
Mobile Network
Unreliable speed  latency
@andyp1per#RealTimeMobile
If only all applications worked like this…
@YourTwitterHandle@andyp1per#RealTimeMobile
D
em
o
http://demo.pushtechnology.com/demos/draw/
@andyp1per#RealTimeMobile
Why does it work?
• We want UIs that engage us
• Immediacy is key
• Interactivity is key
• Response is based on rapid, high fidelity inbound and outbound data flows
• We want Reactive applications!
@andyp1per#RealTimeMobile
The Righteous Reactive Triangle™
UIX
Data
Network
@andyp1per#RealTimeMobile
It’s all about the Network
• Interactive applications interact with something
• Its not all angry birds
• The quality of the interaction depends on connectivity and latency
• That data gets through
• The time it takes
• The time to process
• That it returns
• The time to return
@andyp1per#RealTimeMobile
It’s all about the Data
• The network is a precious, uncontrolled resource
• What you can control is how much you use
• How much you use depends on
• How much data you transmit
• How frequently you transmit it
• You may be able to cheat!
• Only deal with what you can see
• Data often has a time dimension
• The data value decay curve
• Its not just about what you can see
• But WHEN you can see it
Value
Time
@andyp1per#RealTimeMobile
It’s all about the User Experience
• Go Reactive!
• http://www.reactivemanifesto.org/
• Event-driven, scalable, resilient, responsive
• Latency over mobile networks (and the internet) is inevitable
• Asynchronous models hide latency
• Asynchronous models are better overall
• Although harder to implement
@andyp1per#RealTimeMobile
Introducing Velocity Voting – “Vloting™”
• Stream of control data from device
• Stream of feedback data from server
• Server calculates “velocity” of votes and aggregates results
• Aggregate results are pushed back to devices
@YourTwitterHandle@andyp1per#RealTimeMobile
D
em
o
http://demo.pushtechnology.com/devoxx
@andyp1per#RealTimeMobile
Reactive UI frameworks
• Vue - http://vuejs.org/
• Component hierarchy communicates via events
• Data model declared as POJOs (JavaScript)
• Vue manages data model changes
• Async DOM updates
• Smart batching and compression
• Also considered
• React - http://facebook.github.io/react/
• Om - https://github.com/swannodette/om
@andyp1per#RealTimeMobile
Vue in Action
@andyp1per#RealTimeMobile
Key Features of the Vloting App
• Built reactively on an asynchronous, event-driven model
• Latency is obscured by asynchronicity
• Consider a plane
• Highly interactive both individually and in aggregate
• Real-time data flowing in both directions
• Asynchronous is key
@YourTwitterHandle#DVXFR14{session hashtag} @andyp1per#RealTimeMobile
How Do we Optimize the Experience?
@andyp1per#RealTimeMobile
Optimize the network?
@andyp1per#RealTimeMobile
Mobile throughput
Technology Download rate (bit/s) Upload rate (bit/s) Download rate (byte/s) Upload rate (byte/s)
GSM CSD (2G) 14.4 kbit/s[18]
14.4 kbit/s 1.8 kB/s 1.8 kB/s
HSCSD 57.6 kbit/s 14.4 kbit/s 5.4 kB/s 1.8 kB/s
GPRS (2.5G) 57.6 kbit/s 28.8 kbit/s 7.2 kB/s 3.6 kB/s
WiDEN 100 kbit/s 100 kbit/s 12.5 kB/s 12.5 kB/s
CDMA2000 1×RTT 153 kbit/s 153 kbit/s 18 kB/s 18 kB/s
EDGE (2.75G) (type 1 MS) 236.8 kbit/s 236.8 kbit/s 29.6 kB/s 29.6 kB/s
UMTS 3G 384 kbit/s 384 kbit/s 48 kB/s 48 kB/s
EDGE (type 2 MS) 473.6 kbit/s 473.6 kbit/s 59.2 kB/s 59.2 kB/s
EDGE Evolution (type 1 MS) 1,184 kbit/s 474 kbit/s 148 kB/s 59 kB/s
EDGE Evolution (type 2 MS) 1,894 kbit/s 947 kbit/s 237 kB/s 118 kB/s
1×EV-DO rev. 0 2,457 kbit/s 153 kbit/s 307.2 kB/s 19 kB/s
1×EV-DO rev. A 3.1 Mbit/s 1.8 Mbit/s 397 kB/s 230 kB/s
1×EV-DO rev. B 14.7 Mbit/s 5.4 Mbit/s 1,837 kB/s 675 kB/s
HSPA (3.5G) 13.98 Mbit/s 5.760 Mbit/s 1,706 kB/s 720 kB/s
4×EV-DO Enhancements (2×2 MIMO) 34.4 Mbit/s 12.4 Mbit/s 4.3 MB/s 1.55 MB/s
HSPA+ (2×2 MIMO) 42 Mbit/s 11.5 Mbit/s 5.25 MB/s 1.437 MB/s
15×EV-DO rev. B 73.5 Mbit/s 27 Mbit/s 9.2 MB/s 3.375 MB/s
UMB (2×2 MIMO) 140 Mbit/s 34 Mbit/s 17.5 MB/s 4.250 MB/s
LTE (2×2 MIMO) 173 Mbit/s 58 Mbit/s 21.625 MB/s 7.25 MB/s
UMB (4×4 MIMO) 280 Mbit/s 68 Mbit/s 35 MB/s 8.5 MB/s
EV-DO rev. C 280 Mbit/s 75 Mbit/s 35 MB/s 9 MB/s
LTE (4×4 MIMO) 326 Mbit/s 86 Mbit/s 40.750 MB/s 10.750 MB/s
@andyp1per#RealTimeMobile
Mobile latency
LTE latency in ms vs latencies experienced on other connection types (smaller is better)
151
629
212 172
98
@andyp1per#RealTimeMobile
Optimize the network?
• You can’t!
• Bandwidth is always limited and costly
• Latency is often poor
@andyp1per#RealTimeMobile
Optimize the data?
• Small is beautiful
• Prefer compact binary protocols
• HTTP not great (~300+ bytes/message), XML awful
• STOMP – ~100+ bytes/message
• COAP – ~4+ bytes/message
• MQTT – ~10+ bytes/message
• Binary protocols also happen to be faster – scale better
• Serialization is the killer – both for performance and the battery
• Protobuf, SBE, dpt
• Chatty protocols also poor - setup costs can be high
• Burst data in large chunks - reduces TCP/IP header cost
@andyp1per#RealTimeMobile
Making data smaller
• Information dense
• Don’t send the same information more than once
• Only send differences – snapshot-delta
• Minimum viable encoding
• Interoperability should not be a concern
• Mobile applications are an extension of the server
• Controlling both ends is important
• Coordinate optimizations
@andyp1per#RealTimeMobile
Information Density - Snapshot-delta
@andyp1per#RealTimeMobile
Deltas in Action
50% Data Reduction
@andyp1per#RealTimeMobile
Making data smaller
• Send less
• Just because you have data doesn’t mean you should send it
• Just because you have bandwidth doesn’t mean you should use it
• Throttle based on ability to consume
• Both device and human
• Throttling reduces data costs
• Throttling conserves bandwidth
• Being reactive means only sending data when you need to
• Much more efficient
@andyp1per#RealTimeMobile
What happens when the network lets you down?
• It WILL let you down
• Insufficient bandwidth
• Inconsistent bandwidth
• High latency
• Loss of network on a regular basis
• You can’t optimize but you can respond
• Go Reactive!
• You must respond to the conditions of the network
• “Mobile sympathy™”
@andyp1per#RealTimeMobile
Responding to the network
• You must get feedback – but how?
• Instrumentation is key
• What, when, how much?
• Use any and every means to understand the network conditions
• TCP is your friend!
• Reliable in the face of congestion and packet loss
• Fast connection loss detection
• Back pressure is informative
@andyp1per#RealTimeMobile
Responding to feedback
• Need in-memory working set
• Queue / buffer on the server
• Availability of the data may not match the network availability
• Fill the queue at the speed of data availability
• Drain the queue at the speed of the network
• Queuing also copes nicely with network loss – replay queue at reconnection
• Queuing has to be per-client – not all connections created equal
• Maps well to a lock-free architecture
• You need a really good queue!
• Disruptor - http://lmax-exchange.github.io/disruptor/
• JCTools - https://github.com/JCTools/JCTools
@andyp1per#RealTimeMobile
Problems with queuing
• Data in the queue is memory overhead
• Data in the queue is naturally stale
• The speed of data availability may be roughly what you want
@andyp1per#RealTimeMobile
Optimizing queuing - memory
• Store per-client references not messages
• Share messages as much as possible
• Garbage collection remove when all references expired
• Sharing references also reduces copying
• Memory churn can be a huge problem in high velocity systems
• Vital that messages are immutable – otherwise you have to mediate access
• Locking will kill you
@andyp1per#RealTimeMobile
Optimizing queuing – timeliness
• What do you do about stale data?
• Revolves around whether it is important
• If every message counts then you have no choice but to deliver
• Snapshot-delta means final state is dependent on initial conditions and
changes
• But changes != All deltas
• S + D1 + D2 – D1 = S + D2
• Why send D1 – D1 as it contributes nothing?
• Delete messages that contribute nothing
• Remove duplicates
• Merge multiple deltas into single delta
• Conflation
@andyp1per#RealTimeMobile
Optimizing queuing - Demo
@YourTwitterHandle@andyp1per#RealTimeMobile
D
em
o
http://demo.pushtechnology.com/devoxx
@andyp1per#RealTimeMobile
Optimize the User Experience?
@andyp1per#RealTimeMobile
Rich to richer User Experiences
• Real-time allows user experiences that would not otherwise be possible
• Truly rich experiences are contextual
• Contextual data often originates from the device itself
• Location
• Movement
• etc.
• Contextual information often requires access to the native capabilities of the
device
• Hard to access from JavaScript
• Apache Cordova is a framework that gives JavaScript access to native
capabilities
@andyp1per#RealTimeMobile
Apache Cordova
• Develop html/css/js apps for mobile platforms
• https://cordova.apache.org
• Run as a native (hybrid) app
• iOS, Android, Windows Phone, Blackberry, and more
• Native Web View displays the html/css/js code
• Interface with native components
• Accelerometer, Compass, GPS, etc.
• Simple command line interface
• Run on device (even iOS!) from a single command
• cordova run —device [ios|android|…]
• Largely for testing
• Deployment/packaging from command line
• Easy to use external js libraries (like Diffusion JS Client)
@andyp1per#RealTimeMobile
Putting it all together
@YourTwitterHandle@andyp1per#RealTimeMobile
D
em
o
http://demo.pushtechnology.com/flights/
@andyp1per#RealTimeMobile
Other considerations
• Like the network, device capabilities are not something necessarily to be
accessed
• Even though you can
• Battery-life is a killer
• Only want to access information you need at the fidelity you need it
• High precision location information is power intensive
• Throttling and “good enough” metrics are key
@YourTwitterHandle#DVXFR14{session hashtag} @andyp1per#RealTimeMobile
Sum
m
ar
y
@andyp1per#RealTimeMobile
Conclusion
• Rich, real-time experiences can be provided on mobile platforms through
• Data optimization
• Network optimization
• Reactive interfaces
• Contextualization
• Good experiences are dictated as much by what you don’t do as what you do
do
• Products and frameworks can take the pain out of development
• Cordova
• Diffusion
@YourTwitterHandle#DVXFR14{session hashtag} @andyp1per#RealTimeMobile
Q
&
A

More Related Content

What's hot

Polyglottany Is Not A Sin
Polyglottany Is Not A SinPolyglottany Is Not A Sin
Polyglottany Is Not A Sin
Eric Lubow
 
DOES15 - Joshua Corman & John Willis - Immutable Awesomeness?
DOES15 - Joshua Corman & John Willis - Immutable Awesomeness?DOES15 - Joshua Corman & John Willis - Immutable Awesomeness?
DOES15 - Joshua Corman & John Willis - Immutable Awesomeness?
Gene Kim
 
The challenges of live events scalability
The challenges of live events scalabilityThe challenges of live events scalability
The challenges of live events scalability
Guy Tomer
 
Five Early Challenges Of Building Streaming Fast Data Applications
Five Early Challenges Of Building Streaming Fast Data ApplicationsFive Early Challenges Of Building Streaming Fast Data Applications
Five Early Challenges Of Building Streaming Fast Data Applications
Lightbend
 

What's hot (18)

Elm - Could this be the Future of Web Dev?
Elm - Could this be the Future of Web Dev?Elm - Could this be the Future of Web Dev?
Elm - Could this be the Future of Web Dev?
 
Operations for databases – The DevOps journey
Operations for databases – The DevOps journey Operations for databases – The DevOps journey
Operations for databases – The DevOps journey
 
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
 
Polyglottany Is Not A Sin
Polyglottany Is Not A SinPolyglottany Is Not A Sin
Polyglottany Is Not A Sin
 
Operations for databases: the agile/devops journey
Operations for databases: the agile/devops journeyOperations for databases: the agile/devops journey
Operations for databases: the agile/devops journey
 
Engineering Netflix Global Operations in the Cloud
Engineering Netflix Global Operations in the CloudEngineering Netflix Global Operations in the Cloud
Engineering Netflix Global Operations in the Cloud
 
Message Architectures in Distributed Systems - Data Day Texas 2013-01-11
Message Architectures in Distributed Systems - Data Day Texas 2013-01-11Message Architectures in Distributed Systems - Data Day Texas 2013-01-11
Message Architectures in Distributed Systems - Data Day Texas 2013-01-11
 
The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
The Hardest Part of Microservices: Your Data - Christian Posta, Red HatThe Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
 
DOES15 - Joshua Corman & John Willis - Immutable Awesomeness?
DOES15 - Joshua Corman & John Willis - Immutable Awesomeness?DOES15 - Joshua Corman & John Willis - Immutable Awesomeness?
DOES15 - Joshua Corman & John Willis - Immutable Awesomeness?
 
What's beyond Virtualization - The Future of Cloud Platforms
What's beyond Virtualization - The Future of Cloud PlatformsWhat's beyond Virtualization - The Future of Cloud Platforms
What's beyond Virtualization - The Future of Cloud Platforms
 
Cloudstate - Towards Stateful Serverless
Cloudstate - Towards Stateful ServerlessCloudstate - Towards Stateful Serverless
Cloudstate - Towards Stateful Serverless
 
The Future of Services: Building Asynchronous, Resilient and Elastic Systems
The Future of Services: Building Asynchronous, Resilient and Elastic SystemsThe Future of Services: Building Asynchronous, Resilient and Elastic Systems
The Future of Services: Building Asynchronous, Resilient and Elastic Systems
 
The challenges of live events scalability
The challenges of live events scalabilityThe challenges of live events scalability
The challenges of live events scalability
 
Five Early Challenges Of Building Streaming Fast Data Applications
Five Early Challenges Of Building Streaming Fast Data ApplicationsFive Early Challenges Of Building Streaming Fast Data Applications
Five Early Challenges Of Building Streaming Fast Data Applications
 
Cloud-based video Production of High-end Content
Cloud-based video Production of High-end ContentCloud-based video Production of High-end Content
Cloud-based video Production of High-end Content
 
Scaling on DigitalOcean
Scaling on DigitalOceanScaling on DigitalOcean
Scaling on DigitalOcean
 
Digital Transformation with Kubernetes, Containers, and Microservices
Digital Transformation with Kubernetes, Containers, and MicroservicesDigital Transformation with Kubernetes, Containers, and Microservices
Digital Transformation with Kubernetes, Containers, and Microservices
 
Managing Data in Microservices
Managing Data in MicroservicesManaging Data in Microservices
Managing Data in Microservices
 

Similar to Rich, Real-time Mobile User Experiences @Devoxx UK

How DreamHost builds a public cloud with OpenStack.pdf
How DreamHost builds a public cloud with OpenStack.pdfHow DreamHost builds a public cloud with OpenStack.pdf
How DreamHost builds a public cloud with OpenStack.pdf
OpenStack Foundation
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
Newlink
 

Similar to Rich, Real-time Mobile User Experiences @Devoxx UK (20)

How to deliver rich, real-time apps - AppsWorld 2014
How to deliver rich, real-time apps - AppsWorld 2014How to deliver rich, real-time apps - AppsWorld 2014
How to deliver rich, real-time apps - AppsWorld 2014
 
Joyent circa 2006 (Scale with Rails)
Joyent circa 2006 (Scale with Rails)Joyent circa 2006 (Scale with Rails)
Joyent circa 2006 (Scale with Rails)
 
What ya gonna do?
What ya gonna do?What ya gonna do?
What ya gonna do?
 
Asynchronous design with Spring and RTI: 1M events per second
Asynchronous design with Spring and RTI: 1M events per secondAsynchronous design with Spring and RTI: 1M events per second
Asynchronous design with Spring and RTI: 1M events per second
 
Building data intensive applications
Building data intensive applicationsBuilding data intensive applications
Building data intensive applications
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes
 
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
DataEngConf SF16 - Scalable and Reliable Logging at PinterestDataEngConf SF16 - Scalable and Reliable Logging at Pinterest
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
 
Scalable and Reliable Logging at Pinterest
Scalable and Reliable Logging at PinterestScalable and Reliable Logging at Pinterest
Scalable and Reliable Logging at Pinterest
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best Practices
 
Building a Database for the End of the World
Building a Database for the End of the WorldBuilding a Database for the End of the World
Building a Database for the End of the World
 
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
 
Micro Services Architecture
Micro Services ArchitectureMicro Services Architecture
Micro Services Architecture
 
How DreamHost builds a Public Cloud with OpenStack
How DreamHost builds a Public Cloud with OpenStackHow DreamHost builds a Public Cloud with OpenStack
How DreamHost builds a Public Cloud with OpenStack
 
How DreamHost builds a public cloud with OpenStack.pdf
How DreamHost builds a public cloud with OpenStack.pdfHow DreamHost builds a public cloud with OpenStack.pdf
How DreamHost builds a public cloud with OpenStack.pdf
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling Twitter
 
Development of concurrent services using In-Memory Data Grids
Development of concurrent services using In-Memory Data GridsDevelopment of concurrent services using In-Memory Data Grids
Development of concurrent services using In-Memory Data Grids
 
Design for Scale / Surge 2010
Design for Scale / Surge 2010Design for Scale / Surge 2010
Design for Scale / Surge 2010
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 

Recently uploaded

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Recently uploaded (20)

Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 

Rich, Real-time Mobile User Experiences @Devoxx UK

  • 1. @andyp1per#RealTimeMobile Delivering Rich, Real-Time Mobile User Experiences Dr Andy Piper Push Technology Ltd. @andyp1per www.pushtechnology.com
  • 2. @andyp1per#RealTimeMobile Delivering Rich, Real-Time Mobile User Experiences • Dr Andy Piper • CTO at Push Technology • Ex-BEA/Oracle • Architect for WebLogic Server Core • Architect and then Engineering Director for Oracle Event Processing • Spring contributor (Spring DM) and Author • Contributed to many standards – OMG, JCP, OSGi Alliance • PhD, Cambridge, Distributed Systems • MBA, Warwick Business School
  • 3. @andyp1per#RealTimeMobile What we do Software that enables rich real-time user experiences, where the Right Content is delivered to the Right User, at the Right Time, on any device, platform or application, regardless of connectivity or location.
  • 4. @andyp1per#RealTimeMobile Introduction • My nightmare – the app that sometimes works • Why is it frustrating?
  • 5. @andyp1per#RealTimeMobile The problem with mobile 10Gbps pipe, reliable 99.9999% Dedicated Network 2-50Mbps pipe Internet Unreliable speed 0.5-4Mbps pipe Mobile Network Unreliable speed latency
  • 6. @andyp1per#RealTimeMobile If only all applications worked like this…
  • 8. @andyp1per#RealTimeMobile Why does it work? • We want UIs that engage us • Immediacy is key • Interactivity is key • Response is based on rapid, high fidelity inbound and outbound data flows • We want Reactive applications!
  • 10. @andyp1per#RealTimeMobile It’s all about the Network • Interactive applications interact with something • Its not all angry birds • The quality of the interaction depends on connectivity and latency • That data gets through • The time it takes • The time to process • That it returns • The time to return
  • 11. @andyp1per#RealTimeMobile It’s all about the Data • The network is a precious, uncontrolled resource • What you can control is how much you use • How much you use depends on • How much data you transmit • How frequently you transmit it • You may be able to cheat! • Only deal with what you can see • Data often has a time dimension • The data value decay curve • Its not just about what you can see • But WHEN you can see it Value Time
  • 12. @andyp1per#RealTimeMobile It’s all about the User Experience • Go Reactive! • http://www.reactivemanifesto.org/ • Event-driven, scalable, resilient, responsive • Latency over mobile networks (and the internet) is inevitable • Asynchronous models hide latency • Asynchronous models are better overall • Although harder to implement
  • 13. @andyp1per#RealTimeMobile Introducing Velocity Voting – “Vloting™” • Stream of control data from device • Stream of feedback data from server • Server calculates “velocity” of votes and aggregates results • Aggregate results are pushed back to devices
  • 15. @andyp1per#RealTimeMobile Reactive UI frameworks • Vue - http://vuejs.org/ • Component hierarchy communicates via events • Data model declared as POJOs (JavaScript) • Vue manages data model changes • Async DOM updates • Smart batching and compression • Also considered • React - http://facebook.github.io/react/ • Om - https://github.com/swannodette/om
  • 17. @andyp1per#RealTimeMobile Key Features of the Vloting App • Built reactively on an asynchronous, event-driven model • Latency is obscured by asynchronicity • Consider a plane • Highly interactive both individually and in aggregate • Real-time data flowing in both directions • Asynchronous is key
  • 20. @andyp1per#RealTimeMobile Mobile throughput Technology Download rate (bit/s) Upload rate (bit/s) Download rate (byte/s) Upload rate (byte/s) GSM CSD (2G) 14.4 kbit/s[18] 14.4 kbit/s 1.8 kB/s 1.8 kB/s HSCSD 57.6 kbit/s 14.4 kbit/s 5.4 kB/s 1.8 kB/s GPRS (2.5G) 57.6 kbit/s 28.8 kbit/s 7.2 kB/s 3.6 kB/s WiDEN 100 kbit/s 100 kbit/s 12.5 kB/s 12.5 kB/s CDMA2000 1×RTT 153 kbit/s 153 kbit/s 18 kB/s 18 kB/s EDGE (2.75G) (type 1 MS) 236.8 kbit/s 236.8 kbit/s 29.6 kB/s 29.6 kB/s UMTS 3G 384 kbit/s 384 kbit/s 48 kB/s 48 kB/s EDGE (type 2 MS) 473.6 kbit/s 473.6 kbit/s 59.2 kB/s 59.2 kB/s EDGE Evolution (type 1 MS) 1,184 kbit/s 474 kbit/s 148 kB/s 59 kB/s EDGE Evolution (type 2 MS) 1,894 kbit/s 947 kbit/s 237 kB/s 118 kB/s 1×EV-DO rev. 0 2,457 kbit/s 153 kbit/s 307.2 kB/s 19 kB/s 1×EV-DO rev. A 3.1 Mbit/s 1.8 Mbit/s 397 kB/s 230 kB/s 1×EV-DO rev. B 14.7 Mbit/s 5.4 Mbit/s 1,837 kB/s 675 kB/s HSPA (3.5G) 13.98 Mbit/s 5.760 Mbit/s 1,706 kB/s 720 kB/s 4×EV-DO Enhancements (2×2 MIMO) 34.4 Mbit/s 12.4 Mbit/s 4.3 MB/s 1.55 MB/s HSPA+ (2×2 MIMO) 42 Mbit/s 11.5 Mbit/s 5.25 MB/s 1.437 MB/s 15×EV-DO rev. B 73.5 Mbit/s 27 Mbit/s 9.2 MB/s 3.375 MB/s UMB (2×2 MIMO) 140 Mbit/s 34 Mbit/s 17.5 MB/s 4.250 MB/s LTE (2×2 MIMO) 173 Mbit/s 58 Mbit/s 21.625 MB/s 7.25 MB/s UMB (4×4 MIMO) 280 Mbit/s 68 Mbit/s 35 MB/s 8.5 MB/s EV-DO rev. C 280 Mbit/s 75 Mbit/s 35 MB/s 9 MB/s LTE (4×4 MIMO) 326 Mbit/s 86 Mbit/s 40.750 MB/s 10.750 MB/s
  • 21. @andyp1per#RealTimeMobile Mobile latency LTE latency in ms vs latencies experienced on other connection types (smaller is better) 151 629 212 172 98
  • 22. @andyp1per#RealTimeMobile Optimize the network? • You can’t! • Bandwidth is always limited and costly • Latency is often poor
  • 23. @andyp1per#RealTimeMobile Optimize the data? • Small is beautiful • Prefer compact binary protocols • HTTP not great (~300+ bytes/message), XML awful • STOMP – ~100+ bytes/message • COAP – ~4+ bytes/message • MQTT – ~10+ bytes/message • Binary protocols also happen to be faster – scale better • Serialization is the killer – both for performance and the battery • Protobuf, SBE, dpt • Chatty protocols also poor - setup costs can be high • Burst data in large chunks - reduces TCP/IP header cost
  • 24. @andyp1per#RealTimeMobile Making data smaller • Information dense • Don’t send the same information more than once • Only send differences – snapshot-delta • Minimum viable encoding • Interoperability should not be a concern • Mobile applications are an extension of the server • Controlling both ends is important • Coordinate optimizations
  • 27. @andyp1per#RealTimeMobile Making data smaller • Send less • Just because you have data doesn’t mean you should send it • Just because you have bandwidth doesn’t mean you should use it • Throttle based on ability to consume • Both device and human • Throttling reduces data costs • Throttling conserves bandwidth • Being reactive means only sending data when you need to • Much more efficient
  • 28. @andyp1per#RealTimeMobile What happens when the network lets you down? • It WILL let you down • Insufficient bandwidth • Inconsistent bandwidth • High latency • Loss of network on a regular basis • You can’t optimize but you can respond • Go Reactive! • You must respond to the conditions of the network • “Mobile sympathy™”
  • 29. @andyp1per#RealTimeMobile Responding to the network • You must get feedback – but how? • Instrumentation is key • What, when, how much? • Use any and every means to understand the network conditions • TCP is your friend! • Reliable in the face of congestion and packet loss • Fast connection loss detection • Back pressure is informative
  • 30. @andyp1per#RealTimeMobile Responding to feedback • Need in-memory working set • Queue / buffer on the server • Availability of the data may not match the network availability • Fill the queue at the speed of data availability • Drain the queue at the speed of the network • Queuing also copes nicely with network loss – replay queue at reconnection • Queuing has to be per-client – not all connections created equal • Maps well to a lock-free architecture • You need a really good queue! • Disruptor - http://lmax-exchange.github.io/disruptor/ • JCTools - https://github.com/JCTools/JCTools
  • 31. @andyp1per#RealTimeMobile Problems with queuing • Data in the queue is memory overhead • Data in the queue is naturally stale • The speed of data availability may be roughly what you want
  • 32. @andyp1per#RealTimeMobile Optimizing queuing - memory • Store per-client references not messages • Share messages as much as possible • Garbage collection remove when all references expired • Sharing references also reduces copying • Memory churn can be a huge problem in high velocity systems • Vital that messages are immutable – otherwise you have to mediate access • Locking will kill you
  • 33. @andyp1per#RealTimeMobile Optimizing queuing – timeliness • What do you do about stale data? • Revolves around whether it is important • If every message counts then you have no choice but to deliver • Snapshot-delta means final state is dependent on initial conditions and changes • But changes != All deltas • S + D1 + D2 – D1 = S + D2 • Why send D1 – D1 as it contributes nothing? • Delete messages that contribute nothing • Remove duplicates • Merge multiple deltas into single delta • Conflation
  • 37. @andyp1per#RealTimeMobile Rich to richer User Experiences • Real-time allows user experiences that would not otherwise be possible • Truly rich experiences are contextual • Contextual data often originates from the device itself • Location • Movement • etc. • Contextual information often requires access to the native capabilities of the device • Hard to access from JavaScript • Apache Cordova is a framework that gives JavaScript access to native capabilities
  • 38. @andyp1per#RealTimeMobile Apache Cordova • Develop html/css/js apps for mobile platforms • https://cordova.apache.org • Run as a native (hybrid) app • iOS, Android, Windows Phone, Blackberry, and more • Native Web View displays the html/css/js code • Interface with native components • Accelerometer, Compass, GPS, etc. • Simple command line interface • Run on device (even iOS!) from a single command • cordova run —device [ios|android|…] • Largely for testing • Deployment/packaging from command line • Easy to use external js libraries (like Diffusion JS Client)
  • 41. @andyp1per#RealTimeMobile Other considerations • Like the network, device capabilities are not something necessarily to be accessed • Even though you can • Battery-life is a killer • Only want to access information you need at the fidelity you need it • High precision location information is power intensive • Throttling and “good enough” metrics are key
  • 43. @andyp1per#RealTimeMobile Conclusion • Rich, real-time experiences can be provided on mobile platforms through • Data optimization • Network optimization • Reactive interfaces • Contextualization • Good experiences are dictated as much by what you don’t do as what you do do • Products and frameworks can take the pain out of development • Cordova • Diffusion

Editor's Notes

  1. Get Pete to talk about how we built this
  2. We can see the effects of sending the full data versus sending a snapshot and deltas in these animations. Here’s the full data going through every time.
  3. And now here’s the same thing with using snapshot and deltas. As you can see substantial bandwidth savings can be made.
  4. So the network is slow or non-existent – now what?