33
Bay Area Android Meetup How to Achieve Mobile App Performance and Monitoring to Ensure Great User Experiences 6:30pm: Food & Drinks 7:00pm: Performance Monitoring – Alex Gaber 7:40pm: Test Automation and CI – Melvin Laguren

Android Performance and Monitoring - Meetup 3 25-14

Embed Size (px)

DESCRIPTION

Android app performance optimization and performance monitoring.

Citation preview

Page 1: Android Performance and Monitoring - Meetup 3 25-14

Bay Area Android MeetupHow to Achieve

Mobile App Performance

and Monitoring to Ensure Great

User Experiences

6:30pm: Food & Drinks7:00pm: Performance Monitoring – Alex Gaber7:40pm: Test Automation and CI – Melvin Laguren

Page 2: Android Performance and Monitoring - Meetup 3 25-14

Bay Area Android MeetupHow to Achieve Mobile App

Performance and Monitoring to Ensure Great

User Experiences

Crittercism 3-25-2014

Page 3: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 4: Android Performance and Monitoring - Meetup 3 25-14

How Users React to Poor App Performance

Source: Crittercism end-user survey Q4’2013

Did not do anything

Shared the experience via social media

Left a negative review on the app store

Contacted support or told the vendor

Told a friend in person

Uninstalled the app

0% 10% 20% 30% 40% 50% 60% 70%

26%

9%

10%

21%

26%

65%

What Do Users Do When the App is Slow?

Page 5: Android Performance and Monitoring - Meetup 3 25-14

Personal Experience – Uninstalled Android Apps

Lots of apps in the Google Play Store……..

..….. and lots of uninstalls, 1 stars, bugs?

HELP !!!

Page 6: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 7: Android Performance and Monitoring - Meetup 3 25-14

Snappy UI Equals Great UX

Linear Layout • Similar to nested tables in HTML• Great for quick and simple UI designs• Performance degrades as complexity increases

Linear Layout

Page 8: Android Performance and Monitoring - Meetup 3 25-14

Snappy UI Equals Great UX

Relative Layout• Eliminates Nested view groups• Keeps layout hierarchy flat• Much better performance for complex layouts

Page 9: Android Performance and Monitoring - Meetup 3 25-14

Relative Layout Example – activity_main.xml

Relative Layout“button2” is

below “button1”

Page 10: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 11: Android Performance and Monitoring - Meetup 3 25-14

ANR – Application Not Responding

What causes an “Application Not Responding” (ANR) error?

• No response to an input event (such as key press or screen touch events) within 5 seconds (5,000 ms)

• A BroadcastReceiver hasn't finished executing within 10 seconds (10,000 ms)

Main Threads vs Worker Threads

Page 12: Android Performance and Monitoring - Meetup 3 25-14

Main Thread (UI Thread)

• Main Thread is also called the “UI Thread”

• All Android activities operate in the Main Thread by default

• You can easily overload the Main Thread– Doing network operations on Main

Thread– Slow disk operations (un-optimized SQL)

Page 13: Android Performance and Monitoring - Meetup 3 25-14

Main Thread (UI Thread)

TIPS• Worker Threads are “background threads”• Handle all network calls w/ Worker Threads• Decouple the UI Thread from potential

blockers

Sample Worker Thread

Page 14: Android Performance and Monitoring - Meetup 3 25-14

Main Thread (UI Thread)

Set Thread Priority: Example

Page 15: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 16: Android Performance and Monitoring - Meetup 3 25-14

Android OS Install Base Fragmentation

Over 20% of Android devices are still running an OS version below 4.0

Data collected during a 7-day period ending on March 3, 2014

(developer.android.com)

Page 17: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 18: Android Performance and Monitoring - Meetup 3 25-14

Average Mobile App Consumes Five 3rd Party APIs

• The average mobile app is using between 5-6 APIs / web services

• API Monitoring from web server to web server does not tell the full story

Page 19: Android Performance and Monitoring - Meetup 3 25-14

Average Mobile App Consumes Five 3rd Party APIs

Page 20: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 21: Android Performance and Monitoring - Meetup 3 25-14

3rd Party SDK Overhead and Performance Latency

• Mobile Ads SDKs

Page 22: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 23: Android Performance and Monitoring - Meetup 3 25-14

3rd Party SDK Overhead and Performance Latency

• Security SDKs

Page 24: Android Performance and Monitoring - Meetup 3 25-14

3rd Party SDK Overhead and Performance Latency

What is that SDK adding to your app?

• What is the performance overhead for this service? • What if they start to lag or get slow? • How can I monitor that this SDK isn’t making my app have

performance issues?

Page 25: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 26: Android Performance and Monitoring - Meetup 3 25-14

MBaaS Powering your Android App

Page 27: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 28: Android Performance and Monitoring - Meetup 3 25-14

Testing Does Not Ensure Performance: Trust But Verify

• Agile Mobile App Development methodology– Leaves little time for testing

Page 29: Android Performance and Monitoring - Meetup 3 25-14

Testing Does Not Ensure Performance: Trust But Verify

• Agile Mobile App Development methodology– Leaves little time for testing

Page 30: Android Performance and Monitoring - Meetup 3 25-14

Agenda

• Why Does Android Performance Matter?• Snappy UI for UX Performance• UI Thread vs. Worker Thread• Android OS Install Base Fragmentation• Mashed Up Mobile Apps – 3rd Party APIs• Mobile Ad SDK performance• Security SDKs performance• MBaaS performance• Testing vs. Monitoring for Performance• Implementing Android App Monitoring

Page 31: Android Performance and Monitoring - Meetup 3 25-14

Implementing Performance Monitoring for Android

Failure of shopping cart check-outs, referrals, etc. Transaction Errors

HTTP Errors like 404’s, Errors accessing Cloud ServicesAPI & Network Errors

Slow performance, High latenciesUnresponsive Apps

Downtime due to app crashesApps Crashes &

Exceptions

Performance issues due to geography Location

What cannot be tested prior to launch?

Page 32: Android Performance and Monitoring - Meetup 3 25-14

Implementing Performance Monitoring for Android

DEMO

Page 33: Android Performance and Monitoring - Meetup 3 25-14

Testing Does Not Ensure Performance: Trust But Verify

Thank You!www.crittercism.com

@crittercism