how to deliver rich, real-time apps - appsworld 2014
TRANSCRIPT
Dr Andy Piper
Push Technology
{DELIVERING RICH, REAL-TIME APPLICATIONS}
Reappt, a Push Technology product offers enterprise grade Diffusion technology as a service.
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per {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.
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per Introduction
My nightmare – the app that sometimes works
Why is it frustrating?
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per The problem with mobile
10Gbps pipe, reliable 99.9999%
2-50Mbps pipeUnreliable speed
0.5-4Mbps pipeUnreliable speed \ latency
Internet
Mobile Network
Dedicated Network
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per If only all applications worked like this…
Copyright Push Technology 2014
{Demo}http://demo2.pushtechnology.com/demos/dra
w/
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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!
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per The Righteous Reactive Triangle™
UIX
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Valu
e
Time
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Copyright Push Technology 2014
{Demo}http://demo2.pushtechnology.com/vloting
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per How Do we Optimize the Experience?
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per Optimize the network?
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per Mobile latency
LTE latency in ms vs latencies experienced on other connection types (smaller is
better)
151
629
212 172
98
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per Optimize the network?
You can’t!
Bandwidth is always limited and costly
Latency is often poor
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per Making data smaller
Information dense
• Don’t send the same information more than once
• Only send differences – snapshot-delta
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
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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™”
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per Optimize the User Experience?
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
• Develop html/css/js apps for mobile platforms
• https://cordova.apache.org
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per Putting it all together
Copyright Push Technology 2014
{Demo}http://demo2.pushtechnology.com/flights/
Copyright Push Technology 2014 #RealTimeMobile
@andyp1per 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
Copyright Push Technology 2014
@andyp1per
{Q&A}