Latency - The King of the Mobile Experience

Post on 27-Jan-2015

110 views 5 download

Tags:

description

Latency, that is, how much time it takes for a packet of data to get from one designated point to another, is a top priority for the mobile development industry. With mobile applications, time is of the essence. Check out the slides from Mobile Learning Lab session and learn about this core tenet of mobile development.

Transcript of Latency - The King of the Mobile Experience

LatencyThe King of the Mobile Experience

By Jeremy WilsonCTO, Keek Inc.

Who am I?

Jeremy Wilson

•  18 years experience in administrating and scaling web-based infrastructures to millions of daily users

•  8 years experience in optimizing for mobile devices

•  Currently CTO of Keek, a social video startup in Toronto

What is Latency?

la·ten·cy [leyt-n-see]:A measure of time delay experienced in a system or network

due to various limitations in those systems or networks

What is Latency?

Person to Device•  User Input•  Screen Refresh•  Transitions•  Gestures

What is Latency?

Device to Network•  Signal Strength•  Connection type (3G, LTE)•  Device Resources•  Distance•  Buffering

What is Latency?

Network to Internet•  Bandwidth•  Traffic Shaping•  Routing•  Buffering

What is Latency?

Internet to Server•  Service Type•  Caching•  Physical Resources (Disk/CPU)•  Databases•  Clustering•  Networking

What is Latency?

Then double it for the response time

Maximum total response time considered acceptable by serviceproviders such as Google

1 secondSource: https://developers.google.com/speed/docs/insights/mobile

People

Minimum duration for perception of an event to have occurred

100 millisecondsBelow this, events are perceived as instantaneous

Source: http://www.nngroup.com/articles/response-times-3-important-limits/

People

Maximum time for flow of thought to stay uninterrupted

1 second

Source: http://www.nngroup.com/articles/response-times-3-important-limits/

People

Maximum attention span without feedback

10 seconds

Source: http://www.nngroup.com/articles/response-times-3-important-limits/

People

Traffic drop when a page takes 500ms longer to load

20%Sales lost for every 100ms of delay

1%Source: http://glinden.blogspot.ca/2006/11/marissa-mayer-at-web-20.html http://blog.gigaspaces.com/amazon-found-every-100ms-of-latency-cost-them-1-in-sales/

People

are impatient and easily distracted

•  Make your UI responsive•  Minimize delays in switching screens

•  Do work in the background•  Provide feedback (like spinners) during

long operations•  Avoid long operations altogether

Devices

CPU power and RAM strongly effect page load and display times

Page Load Times for iPhone Devices

iPhone 5 (3G) iPhone 5 (EDGE) iPhone 4 (3G)

4.3s 4.6s 12.1s

Response Time from US AT&T Network

Devices

are slow, have unpredictable resources and rely onremote systems you may not control

•  Use local assets•  Cache everything

•  Offload slow jobs to APIs•  Test on multiple devices

•  Develop for the lowest powereddevice you plan to support

NetworksiPhone 5 on Rogers LTE Network to Google DNS Servers

Total routing hops Ping time

20 58msLaptop on 1Gb LAN to Google DNS Servers

Total routing hops Ping time

9 26msMobile networks have inefficient packet routing and highly throttled traffic shaping

Networks

Even on fast WiFi networks, each connection you make hasoverhead, which includes the response speed of the service

Source: https://developers.google.com/speed/docs/insights/mobile

Networks

have highly variable performance and significantconnection overhead

•  Keep packets small•  Avoid transferring large data - send multiple

chunks of small data instead•  Try to maintain persistent connections - avoid

making new connections•  Test on as many networks as possible

Internet

Security means latency

•  SSL / HTTPS requires 3 or more send/receivetransactions to establish a connection•  Encryption and decryption can add up to

20% additional connection overhead•  Authentication methods require additional

data be transferred for each transactionSource: http://revocation-report.x509labs.com

Internet

security is important, but use it intelligently

•  Consider SSL when designing your app andbuild the delays it imposes in from thebeginning•  Restrict SSL connections to sensitivecommunication only, such as login or userupdates

•  Use more efficient ciphers

Servers

Maximum speed means maintaining control and doing it yourself

•  SaaS/PaaS systems are optimized for generalperformance, not specific to your app

•  Managed servers are maintained by generalstaff and usually have 24 hour response times

•  Self-managed Cloud servers are hosted onshared systems and do not offer consistentperformance

Servers

The Cloud is slow compared to physical hardware

Amazon EC2 Eight Extra Large (8 core)Max Requests / second Response Time

180,000 2,000msSoftlayer dual Intel Xeon X5670 (6 core)

Max Requests / second Response Time

500,000 1,500msSource: http://lowlatencyweb.wordpress.com/2012/03/21/modern-http-servers-are-fast-ec2-is-not/

Servers

Internal networking between servers takes time and is highly variable in the Cloud

Amazon t1.micro US-East-1c Zone (100 packets)Average Ping Time Maximum Ping Time

0.941ms 8.985msDedicated 10Gb Ethernet Network (100 packets)

Average Ping Time Maximum Ping Time

0.136ms 0.204msSource: http://lowlatencyweb.wordpress.com/2012/03/21/modern-http-servers-are-fast-ec2-is-not/

Servers

perform best on real hardware, but there is abalance between cost and maintainability

•  Physical servers require administration andmaintenance and the skilled personnel toperform it

•  Cloud is cheaper to start but more expensiveas you grow - consider hybrid or migratingafter gaining market traction

Hate Latency?

We’re hiring.

jobs@keek.com