Download - Latency - The King of the Mobile Experience

Transcript
Page 1: Latency - The King of the Mobile Experience

LatencyThe King of the Mobile Experience

By Jeremy WilsonCTO, Keek Inc.

Page 2: Latency - The King of the Mobile Experience

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

Page 3: Latency - The King of the Mobile Experience

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

Page 4: Latency - The King of the Mobile Experience

What is Latency?

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

Page 5: Latency - The King of the Mobile Experience

What is Latency?

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

Page 6: Latency - The King of the Mobile Experience

What is Latency?

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

Page 7: Latency - The King of the Mobile Experience

What is Latency?

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

Page 8: Latency - The King of the Mobile Experience

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

Page 9: Latency - The King of the Mobile Experience

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/

Page 10: Latency - The King of the Mobile Experience

People

Maximum time for flow of thought to stay uninterrupted

1 second

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

Page 11: Latency - The King of the Mobile Experience

People

Maximum attention span without feedback

10 seconds

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

Page 12: Latency - The King of the Mobile Experience

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/

Page 13: Latency - The King of the Mobile Experience

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

Page 14: Latency - The King of the Mobile Experience

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

Page 15: Latency - The King of the Mobile Experience

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

Page 16: Latency - The King of the Mobile Experience

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

Page 17: Latency - The King of the Mobile Experience

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

Page 18: Latency - The King of the Mobile Experience

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

Page 19: Latency - The King of the Mobile Experience

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

Page 20: Latency - The King of the Mobile Experience

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

Page 21: Latency - The King of the Mobile Experience

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

Page 22: Latency - The King of the Mobile Experience

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/

Page 23: Latency - The King of the Mobile Experience

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/

Page 24: Latency - The King of the Mobile Experience

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

Page 25: Latency - The King of the Mobile Experience

Hate Latency?

We’re hiring.

[email protected]