velocity building a performance lab for mobile apps in a day - final

51
Building a Performance Lab for Mobile Apps in a Day Ashray Mathur Venkatesh Katari Susie Xia

Upload: ashray-mathur

Post on 05-Dec-2014

1.131 views

Category:

Technology


0 download

DESCRIPTION

velocity mobile performance lab

TRANSCRIPT

Page 1: Velocity   building a performance lab for mobile apps in a day - final

Building a Performance Lab for Mobile Apps in a Day

Ashray Mathur Venkatesh Katari

Susie Xia

Page 2: Velocity   building a performance lab for mobile apps in a day - final

Salesforce Mobile Apps

Mobile CRM (Hybrid)

Chatter (iOS & Android)

Touch (HTML5 & Hybrid)

Page 3: Velocity   building a performance lab for mobile apps in a day - final

Mobile Performance Challenges

iOS Android

War Stories

Mobile Web

Page 4: Velocity   building a performance lab for mobile apps in a day - final

Mobile Performance Challenges

Page 5: Velocity   building a performance lab for mobile apps in a day - final

Mobile Performance - The Challenges

http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/

Page 6: Velocity   building a performance lab for mobile apps in a day - final

Mobile Performance - The Challenges

Page 7: Velocity   building a performance lab for mobile apps in a day - final

Mobile Performance - The Challenges

Page 8: Velocity   building a performance lab for mobile apps in a day - final

Mobile Performance - The Challenges

Page 9: Velocity   building a performance lab for mobile apps in a day - final

Build your own mobile performance lab !

Page 10: Velocity   building a performance lab for mobile apps in a day - final
Page 11: Velocity   building a performance lab for mobile apps in a day - final
Page 12: Velocity   building a performance lab for mobile apps in a day - final
Page 13: Velocity   building a performance lab for mobile apps in a day - final

Setting Baselines and Targets

Page 14: Velocity   building a performance lab for mobile apps in a day - final

Mobile Usability Engineering 101

Delay User Reaction

< 1s Feels Instant

1 - 3s App is working

3s+ Mental context switch

10s+ I'll come back later ...

Breaking the 1s mobile barrier : http://bit.ly/mobile-barrier

Page 15: Velocity   building a performance lab for mobile apps in a day - final

Mobile Web Apps

Page 16: Velocity   building a performance lab for mobile apps in a day - final

Key Performance Metrics

Page Load Times

Server / Client Metrics

Network Metrics

Nav Timing Metrics

Page 17: Velocity   building a performance lab for mobile apps in a day - final

App  Instrumenta-on  

Mobile  Infrastructure  

Mobile  Automa-on  

3 Essential Steps for Building a Performance Lab

Page 18: Velocity   building a performance lab for mobile apps in a day - final

•  WebDriver is the standard for browser automation o  Extensively used for functional testing o  Libraries in almost every language o  W3C working draft

•  Plain functional test, nothing special

o  Device Driver o  iOS – iWebDriver, iOS Driver o  Android - AndroidDriver, ChromeDriver

Mobile Web Automation

•  Don't reinvent the wheel !

Page 19: Velocity   building a performance lab for mobile apps in a day - final

App Instrumentation : boomerang.js

•  Steps:  •  Git:    

•  h9ps://github.com/lognormal/boomerang/  

•  Include:  

•  Ini-alize:  

BOOMR.init({      beacon_url:  "h9p://beacons.yoursite.com/path/to/beacon.gif",      site_domain:  "yoursite.com”  

});  

<script  src="/javascript/boomerang.js"  type="text/javascript"></script>  

Documentation - http://lognormal.github.io/boomerang/doc/

Page 20: Velocity   building a performance lab for mobile apps in a day - final

App Instrumentation : boomerang.js

•  Page  Load  Times  •  Bandwidth  and  Latency  •  Perceived  Performance  

•  Page  Components  Load  Time  

 

•  Custom  Measurements  BOOMR.plugins.RT.startTimer(“t_-mer”);  

 //some  foo  BOOMR.plugins.RT.endTimer(“t_-mer”);    

BOOMR.plugins.RT.startTimer("t_head");!...!BOOMR.plugins.RT.endTimer(“t_head”).startTimer(“t_body”);!!!  

BOOMR.page_ready();!  

Page 21: Velocity   building a performance lab for mobile apps in a day - final

Mobile Infrastructure

Page 22: Velocity   building a performance lab for mobile apps in a day - final

•  Webdriver for interactive scenarios o  Multi page flows

•  No Webdriver within instrumented intervals o  Click -> Wait -> Measure

•  Real device performance metrics o  Beacon to server / logging o  Webdriver to collect json

•  Aggregate over multiple iterations ! •  Simulate Network

o  Bandwidth/Latency/Packet Loss •  Visualize Data •  Test -> Measure -> Analyze -> Fix -> Repeat

Testing Methodology

Page 23: Velocity   building a performance lab for mobile apps in a day - final

Continuous Integration

Page 24: Velocity   building a performance lab for mobile apps in a day - final

Simulator Based CI

Page 25: Velocity   building a performance lab for mobile apps in a day - final

Code Checkin Build/deploy Warmup Launch Simulator and run tests

Simulator Based CI

Page 26: Velocity   building a performance lab for mobile apps in a day - final

iOS

Page 27: Velocity   building a performance lab for mobile apps in a day - final

Automation

UI Automation Framework

Frank Testing Framework

iOS-Driver (selenium based!!)

Page 28: Velocity   building a performance lab for mobile apps in a day - final

Logging

Time spent in server + network

Total time spent on client Side

Time to first actionable screen

Page 29: Velocity   building a performance lab for mobile apps in a day - final

Caching metrics: Time spent in storing/retrieving data, size of cache, cache eviction counter.

Page 30: Velocity   building a performance lab for mobile apps in a day - final

Data processing metrics: Time spent in serializing/de-serializing JSON response, massaging data etc.

Page 31: Velocity   building a performance lab for mobile apps in a day - final

Time spent in Controller/data layer, massaging the data etc

Page 32: Velocity   building a performance lab for mobile apps in a day - final

My precious….

Page 33: Velocity   building a performance lab for mobile apps in a day - final

Stress /longevity testing

-Apple script to generate memory warnings <git repo>

-UI Automation script to continuously go over all the most used scenarios

-Monkey script <git repo>

Stress/longevity testing

Simulator longevity tests with synthetic memory warnings using

apple script

Monkey Script! It goes berserk on your UI!

Repeated user scenarios test on physical device

Page 34: Velocity   building a performance lab for mobile apps in a day - final

Instruments –iOS Profiling

Memory Leaks !

CPU monitor

Profiling

Page 35: Velocity   building a performance lab for mobile apps in a day - final

Android

Page 36: Velocity   building a performance lab for mobile apps in a day - final

Build an Android lab that can collect real device performance metrics in a fully automatic way!

Page 37: Velocity   building a performance lab for mobile apps in a day - final

With Selendroid + iWebDriver/ChromeDriver

Web

Native

Page 38: Velocity   building a performance lab for mobile apps in a day - final

Heap Usage on Android

•  Dalvik runtime is garbage collected

•  Heap size limit is increasing on devices o  Device specific o  16MB, 48MB, 64MB... o  android:largeHeap="true"

•  We are good, right?

Page 39: Velocity   building a performance lab for mobile apps in a day - final

Never tell a woman that she will get a larger wardrobe…

Page 40: Velocity   building a performance lab for mobile apps in a day - final

GC Log Message is NOT enough!

Page 41: Velocity   building a performance lab for mobile apps in a day - final

Heap Dumps •  Get a heap dump:

o  Dump hprof File in DDMS o  android.os.Debug.dumpHprofData()

•  Convert hprof file to standard format o  hprof-conv android.hprof standard.hprof

•  Analyze hprof file o  Eclipse Memory Analyzer (MAT)

Page 42: Velocity   building a performance lab for mobile apps in a day - final

War Stories

Page 43: Velocity   building a performance lab for mobile apps in a day - final

Perceived Performance

Page 44: Velocity   building a performance lab for mobile apps in a day - final

Do Things Early or Late!

•  Early: o  Important element o  Viewpoint content o  Start actions early

•  Late: o  Async cleanup

Page 45: Velocity   building a performance lab for mobile apps in a day - final

Preloading Login

Fool your browser for faster speed.

Page 46: Velocity   building a performance lab for mobile apps in a day - final

Fool your browser for faster speed

•  Request Javascript as images while user typing password!

•  Observation: o  Typing password on mobile devices takes time!

•  Fact in Browser: o  Images, CSS are downloaded in parallel o  Javascript is downloaded single-threaded

Page 47: Velocity   building a performance lab for mobile apps in a day - final

Mobile Lab Evolution

What the heck is mobile

performance?

Can I try with stop clock?

Haha, I have custom

instrumentation.

I am building an automated

mobile lab.

Automated everything, off to get a BEER !

Page 48: Velocity   building a performance lab for mobile apps in a day - final

Takeaways

•  Mobile Performance is hard, but exciting

•  Decide what and how to measure your apps

•  Consider the app stability

•  Set up automation, get rid of stopclock

Page 49: Velocity   building a performance lab for mobile apps in a day - final

Future Series

•  Building a Performance Lab for Mobile Apps in a Day o  Tutorial Session at Velocity New York, 3:30pm Oct 14 o  http://velocityconf.com/velocityny2013/public/schedule/detail/30135

•  Don't Let Me Wait: Client-side Optimization o  Workshop Session at Grace Hopper Conference, 5:15pm Oct 3 o  http://gracehopper.org/2013/schedule-at-a-glance/10-3/

Page 50: Velocity   building a performance lab for mobile apps in a day - final

Booth #215

Page 51: Velocity   building a performance lab for mobile apps in a day - final