Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Chasing Performance Issues Methodically

Amanjeet Singh
September 04, 2022

Chasing Performance Issues Methodically

Solving performance problems at scale has always been tricky. There is a lot of confusion on how to address those problems in android. In this talk, we will try to understand the nature of the performance problems, how to select tooling for these issues, and also try to make a generic approach that could apply to most of the problems.

Amanjeet Singh

September 04, 2022
Tweet

More Decks by Amanjeet Singh

Other Decks in Technology

Transcript

  1. Chasing Performance Issues Methodically
    @droid_singh
    @amanjeetsingh150
    Amanjeet Singh

    View full-size slide

  2. What is Performance?

    View full-size slide

  3. What is Performance?
    Story 📘

    View full-size slide

  4. What is Performance?
    Story 📘

    View full-size slide

  5. What is Performance?
    Story 📘

    View full-size slide

  6. What is Performance?
    Story 📘

    View full-size slide

  7. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase

    View full-size slide

  8. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries

    View full-size slide

  9. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates

    View full-size slide

  10. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton

    View full-size slide

  11. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton


    • Selecting configs according to only business metrics

    View full-size slide

  12. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton


    • Selecting configs according to only business metrics

    View full-size slide

  13. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton


    • Selecting configs according to only business metrics

    View full-size slide

  14. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton


    • Selecting configs according to only business metrics

    Pattern 2: We get to know from customer
    tickets or Android Vitals

    View full-size slide

  15. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton


    • Selecting configs according to only business metrics

    Pattern 2: We get to know from customer
    tickets or Android Vitals

    View full-size slide

  16. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton


    • Selecting configs according to only business metrics

    Pattern 2: We get to know from customer
    tickets or Android Vitals
    Pattern 3: Prioritising performance issues

    with other feature work is an issue

    View full-size slide

  17. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton


    • Selecting configs according to only business metrics

    Pattern 2: We get to know from customer
    tickets or Android Vitals
    Pattern 3: Prioritising performance issues

    with other feature work is an issue
    • How are performance issues linked with business?

    View full-size slide

  18. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton


    • Selecting configs according to only business metrics

    Pattern 2: We get to know from customer
    tickets or Android Vitals
    Pattern 3: Prioritising performance issues

    with other feature work is an issue
    • How are performance issues linked with business?


    • Time for solving one performance issue?

    View full-size slide

  19. What is Performance?
    Story 📘
    Pattern 1: Scalable ≠ High Performant Codebase
    • Not upgrading libraries


    • Partial quality gates


    • Not scoping dagger dependencies properly. I Singleton


    • Selecting configs according to only business metrics

    Pattern 2: We get to know from customer
    tickets or Android Vitals
    Pattern 3: Prioritising performance issues

    with other feature work is an issue
    • How are performance issues linked with business?


    • Time for solving one performance issue?
    🤷

    View full-size slide

  20. Platform Team of Company X

    View full-size slide

  21. Mission I: Reducing Cold Start
    •Drafting OKRs for reducing Cold Start

    View full-size slide

  22. Mission I: Reducing Cold Start
    •Drafting OKRs for reducing Cold Start
    •Draft I


    •Uplifting the app quality of X consumer app (O)

    View full-size slide

  23. Mission I: Reducing Cold Start
    •Drafting OKRs for reducing Cold Start
    •Draft I


    •Uplifting the app quality of X consumer app (O)


    •Key Results I: Reduce cold start by 60%


    •Key Results II: Reduce wake locks by 30%


    •Key Results III: Reduce frame drops by 50%

    View full-size slide

  24. Mission I: Reducing Cold Start
    •Drafting OKRs for reducing Cold Start
    •Draft I


    •Uplifting the app quality of X consumer app (O)


    •Key Results I: Reduce cold start by 60%


    •Key Results II: Reduce wake locks by 30%


    •Key Results III: Reduce frame drops by 50%

    View full-size slide

  25. Mission I: Reducing Cold Start
    •Drafting OKRs for reducing Cold Start
    •Draft I


    •Uplifting the app quality of X consumer app (O)


    •Key Results I: Reduce cold start by 60%


    •Key Results II: Reduce wake locks by 30%


    •Key Results III: Reduce frame drops by 50%
    •No observability

    View full-size slide

  26. Mission I: Reducing Cold Start
    •Drafting OKRs for reducing Cold Start
    •Draft I


    •Uplifting the app quality of X consumer app (O)


    •Key Results I: Reduce cold start by 60%


    •Key Results II: Reduce wake locks by 30%


    •Key Results III: Reduce frame drops by 50%
    •No observability


    •No quality gate

    View full-size slide

  27. Mission I: Reducing Cold Start
    •Drafting OKRs for reducing Cold Start
    •Draft I


    •Uplifting the app quality of X consumer app (O)


    •Key Results I: Reduce cold start by 60%


    •Key Results II: Reduce wake locks by 30%


    •Key Results III: Reduce frame drops by 50%
    😖 •No observability


    •No quality gate


    •Every fix might not have affect to gain performance

    View full-size slide

  28. Mission I: Reducing Cold Start
    •Drafting OKRs for reducing Cold Start
    •Draft I


    •Uplifting the app quality of X consumer app (O)


    •Key Results I: Reduce cold start by 60%


    •Key Results II: Reduce wake locks by 30%


    •Key Results III: Reduce frame drops by 50%
    Pattern 4: Drafting OKRs for platform teams is difficult
    •No observability


    •No quality gate


    •Every fix might not have affect to gain performance
    😖

    View full-size slide

  29. First few Attempts to


    fix cold start

    View full-size slide

  30. First few Attempts to


    fix cold start
    ⏰ 1. Looking online for blogs "Reducing cold starts at an X

    company by 80%"

    View full-size slide

  31. First few Attempts to


    fix cold start
    ⏰ 1. Looking online for blogs "Reducing cold starts at an X

    company by 80%"
    2. Playing with tools like profilers locally to identify

    bottlenecks on app start and fix them

    View full-size slide

  32. First few Attempts to


    fix cold start
    ⏰ 1. Looking online for blogs "Reducing cold starts at an X

    company by 80%"
    2. Playing with tools like profilers locally to identify

    bottlenecks on app start and fix them
    3. Randomly change something according to experience

    View full-size slide

  33. First few Attempts to


    fix cold start
    ⏰ 1. Looking online for blogs "Reducing cold starts at an X

    company by 80%"
    2. Playing with tools like profilers locally to identify

    bottlenecks on app start and fix them
    3. Randomly change something according to experience
    🚀

    View full-size slide

  34. First few Attempts to


    fix cold start
    ⏰ 1. Looking online for blogs "Reducing cold starts at an X

    company by 80%"
    2. Playing with tools like profilers locally to identify

    bottlenecks on app start and fix them
    3. Randomly change something according to experience
    Theoretically ✅
    🚀

    View full-size slide

  35. First few Attempts to


    fix cold start
    ⏰ 1. Looking online for blogs "Reducing cold starts at an X

    company by 80%"
    2. Playing with tools like profilers locally to identify

    bottlenecks on app start and fix them
    3. Randomly change something according to experience
    Theoretically ✅

    🚀

    View full-size slide

  36. First few Attempts to


    fix cold start

    Anti Methodology for Performance Analysis

    View full-size slide

  37. First few Attempts to


    fix cold start

    Anti Methodology for Performance Analysis
    • Blame-Someone-Else Anti-Method

    View full-size slide

  38. First few Attempts to


    fix cold start

    Anti Methodology for Performance Analysis
    • Blame-Someone-Else Anti-Method
    • Street light anti-method

    View full-size slide

  39. First few Attempts to


    fix cold start

    Anti Methodology for Performance Analysis
    • Blame-Someone-Else Anti-Method
    • Street light anti-method
    • Random Change Anti-Method

    View full-size slide

  40. What are we

    doing wrong?

    View full-size slide

  41. What are we

    doing wrong?
    • Are we chasing the right metric for cold start?

    View full-size slide

  42. What are we

    doing wrong?
    • Are we chasing the right metric for cold start?
    • Is there any missing case for cold start we are not

    considering?

    View full-size slide

  43. What are we

    doing wrong?
    • Are we chasing the right metric for cold start?
    • Is there any missing case for cold start we are not

    considering?
    • Maybe there were improvements but were neutralised

    by changes made by other developers 🤔

    View full-size slide

  44. Sit back and Strategize! 🤔

    View full-size slide

  45. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability

    View full-size slide

  46. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability
    • Cold Start App Launch

    View full-size slide

  47. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability
    • Cold Start App Launch
    • Different spans for app launch

    View full-size slide

  48. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability
    • Cold Start App Launch
    • Different spans for app launch


    • Google


    Content

    Provider
    First

    Screen

    Drawn

    View full-size slide

  49. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability
    • Cold Start App Launch
    • Different spans for app launch


    • Google


    • User experienced
    Content

    Provider
    First

    Screen

    Drawn
    onCreate

    end
    onStart

    View full-size slide

  50. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability
    • Cold Start App Launch
    • Different spans for app launch


    • Google


    • User experienced
    • Send app launch events and following attributes:

    View full-size slide

  51. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability
    • Cold Start App Launch
    • Different spans for app launch


    • Google


    • User experienced
    • Send app launch events and following attributes:


    • First screen name


    View full-size slide

  52. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability
    • Cold Start App Launch
    • Different spans for app launch


    • Google


    • User experienced
    • Send app launch events and following attributes:


    • First screen name


    • Total time

    View full-size slide

  53. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability
    • Cold Start App Launch
    • Different spans for app launch


    • Google


    • User experienced
    • Send app launch events and following attributes:


    • First screen name


    • Total time


    • User ID

    View full-size slide

  54. Sit back and Strategize! 🤔
    Step 1: Identify proper metrics and create observability
    • Cold Start App Launch
    • Different spans for app launch


    • Google


    • User experienced
    • Send app launch events and following attributes:


    • First screen name


    • Total time


    • User ID
    • Tools selection: Firebase analytics

    View full-size slide

  55. Sit back and Strategize! 🤔
    // Start


    AppLaunchTracker.startTracking()


    View full-size slide

  56. Sit back and Strategize! 🤔
    // Start


    AppLaunchTracker.startTracking()


    // End


    AppLaunchTracker.stopTracking(firstScreenName)




    View full-size slide

  57. Sit back and Strategize! 🤔
    // Start


    AppLaunchTracker.startTracking()


    // End


    AppLaunchTracker.stopTracking(firstScreenName)




    // Track event


    Bundle bundle = new Bundle();


    bundle.putString(FirebaseAnalytics.Param.USER_ID, id);


    bundle.putString(

    FirebaseAnalytics.Param.FIRST_SCREEN_DRAWN, firstScreenName

    );


    bundle.putString(FirebaseAnalytics.Param.TOTAL_DURATION, totalTime);



    View full-size slide

  58. Sit back and Strategize! 🤔
    // Start


    AppLaunchTracker.startTracking()


    // End


    AppLaunchTracker.stopTracking(firstScreenName)




    // Track event


    Bundle bundle = new Bundle();


    bundle.putString(FirebaseAnalytics.Param.USER_ID, id);


    bundle.putString(

    FirebaseAnalytics.Param.FIRST_SCREEN_DRAWN, firstScreenName

    );


    bundle.putString(FirebaseAnalytics.Param.TOTAL_DURATION, totalTime);



    View full-size slide

  59. Sit back and Strategize! 🤔
    // Start


    AppLaunchTracker.startTracking()


    // End


    AppLaunchTracker.stopTracking(firstScreenName)




    // Track event


    Bundle bundle = new Bundle();


    bundle.putString(FirebaseAnalytics.Param.USER_ID, id);


    bundle.putString(

    FirebaseAnalytics.Param.FIRST_SCREEN_DRAWN, firstScreenName

    );


    bundle.putString(FirebaseAnalytics.Param.TOTAL_DURATION, totalTime);


    val firebaseAnalytics = FirebaseAnalytics.getInstance(this)


    firebaseAnalytics.logEvent(FirebaseAnalytics.Event.APP_LAUNCH, bundle)



    View full-size slide

  60. Sit back and Strategize! 🤔
    // Start


    AppLaunchTracker.startTracking()


    // End


    AppLaunchTracker.stopTracking(firstScreenName)




    // Track event


    Bundle bundle = new Bundle();


    bundle.putString(FirebaseAnalytics.Param.USER_ID, id);


    bundle.putString(

    FirebaseAnalytics.Param.FIRST_SCREEN_DRAWN, firstScreenName

    );


    bundle.putString(FirebaseAnalytics.Param.TOTAL_DURATION, totalTime);


    val firebaseAnalytics = FirebaseAnalytics.getInstance(this)


    firebaseAnalytics.logEvent(FirebaseAnalytics.Event.APP_LAUNCH, bundle)



    View full-size slide

  61. Sit back and Strategize! 🤔
    // Start


    AppLaunchTracker.startTracking()


    // End


    AppLaunchTracker.stopTracking(firstScreenName)




    // Track event


    Bundle bundle = new Bundle();


    bundle.putString(FirebaseAnalytics.Param.USER_ID, id);


    bundle.putString(

    FirebaseAnalytics.Param.FIRST_SCREEN_DRAWN, firstScreenName

    );


    bundle.putString(FirebaseAnalytics.Param.TOTAL_DURATION, totalTime);


    val firebaseAnalytics = FirebaseAnalytics.getInstance(this)


    firebaseAnalytics.logEvent(FirebaseAnalytics.Event.APP_LAUNCH, bundle)



    Query data and create intelligence

    View full-size slide

  62. Tracker
    Attributes for app launch

    View full-size slide

  63. Tracker
    Attributes for app launch

    Insights from data:

    View full-size slide

  64. Tracker
    Attributes for app launch

    Insights from data:

    • Splash screen is not the only contributor

    to first_screen_drawn
    0
    25
    50
    75
    100
    Survey Screen Splash Home Screen
    First screen names
    Percentage

    distribution

    of app launch

    View full-size slide

  65. Tracker
    Attributes for app launch

    Insights from data:

    • Splash screen is not the only contributor

    to first_screen_drawn
    • App Icon click is not only trigger
    0
    25
    50
    75
    100
    Survey Screen Splash Home Screen
    First screen names
    Percentage

    distribution

    of app launch

    View full-size slide

  66. Tracker
    Attributes for app launch

    Insights from data:

    • Splash screen is not the only contributor

    to first_screen_drawn
    • App Icon click is not only trigger
    • Campaigns
    0
    25
    50
    75
    100
    Survey Screen Splash Home Screen
    Percentage

    distribution

    of app launch
    First screen names

    View full-size slide

  67. Sit back and Strategize! 🤔
    Step 2:

    View full-size slide

  68. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline

    View full-size slide

  69. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline?

    View full-size slide

  70. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline
    • Creating observability on the PRs

    View full-size slide

  71. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline
    • Creating observability on the PRs
    • Ideal tool for this:

    View full-size slide

  72. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline
    • Creating observability on the PRs
    • Ideal tool for this:


    • Surface tentative regressions

    View full-size slide

  73. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline
    • Creating observability on the PRs
    • Ideal tool for this:


    • Surface tentative regressions


    • Detecting outliers and noise

    View full-size slide

  74. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline
    • Creating observability on the PRs
    • Ideal tool for this:


    • Surface tentative regressions


    • Detecting outliers and noise


    • Surface regressions mapping developers and teams

    View full-size slide

  75. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline
    • Creating observability on the PRs
    • Ideal tool for this:


    • Surface tentative regressions


    • Detecting outliers and noise


    • Surface regressions mapping developers and teams


    • Infra to run the tests

    View full-size slide

  76. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline
    • Creating observability on the PRs
    • Ideal tool for this:


    • Observability on tentative regressions


    • Detecting outliers and noise


    • Surface regressions mapping developers and teams


    • Infra to run the tests

    View full-size slide

  77. Sit back and Strategize! 🤔
    Common factors of noise and outliers
    • Network

    View full-size slide

  78. Sit back and Strategize! 🤔
    Common factors of noise and outliers
    • Network
    🎹 Orchestration of test with mitm

    View full-size slide

  79. Sit back and Strategize! 🤔
    Common factors of noise and outliers
    • Network
    • Remote Configuration
    /data/data/com.app.id/files/frc__firebase_activate.json

    View full-size slide

  80. Sit back and Strategize! 🤔
    Common factors of noise and outliers
    • Network
    • Remote Configuration
    • Debug Builds

    View full-size slide

  81. Sit back and Strategize! 🤔
    Why not debug builds?

    View full-size slide

  82. Sit back and Strategize! 🤔
    Why not debug builds?
    • Account for Progaurd and Dexguard effects

    View full-size slide

  83. Sit back and Strategize! 🤔
    Why not debug builds?
    • Account for Progaurd and Dexguard effects
    • Don’t account for debug artifacts

    View full-size slide

  84. Sit back and Strategize! 🤔
    Why not debug builds?
    • Account for Progaurd and Dexguard effects
    • Don’t account for debug artifacts
    • Take in account build configuration as close to

    release builds

    View full-size slide

  85. Sit back and Strategize! 🤔
    Common factors of noise and outliers
    • Network
    • Remote Configuration
    • Debug Builds
    • App/Device based noise

    View full-size slide

  86. Sit back and Strategize! 🤔
    App/Device based noise

    View full-size slide

  87. Sit back and Strategize! 🤔
    • Random GC triggers
    App/Device based noise

    View full-size slide

  88. Sit back and Strategize! 🤔
    App/Device based noise
    • Random GC triggers
    • System Dialogs from Crashes/ANRs

    View full-size slide

  89. Sit back and Strategize! 🤔
    App/Device based noise
    • Random GC triggers
    • System Dialogs from Crashes/ANRs
    • Device configuration like CPU frequency

    View full-size slide

  90. Sit back and Strategize! 🤔
    App/Device based noise
    • Random GC triggers
    • System Dialogs from Crashes/ANRs
    • Device configuration like CPU frequency
    • CPU/Runtime optimisations in general

    View full-size slide

  91. Sit back and Strategize! 🤔
    App/Device based noise
    • Random GC triggers
    • System Dialogs from Crashes/ANRs
    • Device configuration like CPU frequency
    • CPU/Runtime optimisations in general
    • Never ending.

    View full-size slide

  92. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline
    • Creating observability on the PRs
    • Ideal tool for this:


    • Observability on tentative regressions


    • Detecting outliers and noise


    • Surface regressions mapping developers and teams


    • Infra to run the tests
    Tool Selection

    View full-size slide

  93. Sit back and Strategize! 🤔
    Step 2: Stop bleeding by creating baseline
    • Creating observability on the PRs
    • Ideal tool for this:


    • Observability on tentative regressions


    • Detecting outliers and noise


    • Surface regressions mapping developers and teams


    • Infra to run the tests
    Tool Selection

    View full-size slide

  94. Tracker
    Attributes for app launch

    Insights from data:

    • Splash screen is not the only

    contributor to first_screen_drawn
    • App Icon click is not only trigger
    • Campaigns

    View full-size slide

  95. Tracker
    Attributes for app launch

    Insights from data:

    • Splash screen is not the only

    contributor to first_screen_drawn
    • App Icon click is not only trigger
    • Campaigns
    Eyes on the changes entering while you fix

    View full-size slide

  96. Tracker
    Attributes for app launch

    Insights from data:

    • Splash screen is not the only

    contributor to first_screen_drawn
    • App Icon click is not only trigger
    • Campaigns
    Eyes on the changes entering while you fix

    Alert of PRs on slack, email

    View full-size slide

  97. Tracker
    Attributes for app launch

    Insights from data:

    • Splash screen is not the only

    contributor to first_screen_drawn
    • App Icon click is not only trigger
    • Campaigns
    Eyes on the changes entering while you fix

    Alert of PRs on slack, email

    Flame graphs, diff, VCS metadata

    View full-size slide

  98. Sit back and Strategize! 🤔
    Production analytics
    Quality gate on baseline branch


    View full-size slide

  99. Sit back and Strategize! 🤔
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users

    View full-size slide

  100. Sit back and Strategize! 🤔
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users

    View full-size slide

  101. Sit back and Strategize! 🤔
    • Definition of Impacted session for app launch
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users

    View full-size slide

  102. Sit back and Strategize! 🤔
    • Definition of Impacted session for app launch
    • Google Android Vitals >= 5 seconds
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users

    View full-size slide

  103. Sit back and Strategize! 🤔
    • Definition of Impacted session for app launch
    • Google Android Vitals >= 5 seconds
    • Discussion with product stakeholders
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users

    View full-size slide

  104. Sit back and Strategize! 🤔
    • Definition of Impacted session for app launch
    • Discussion with product stakeholders
    • Google Android Vitals >= 5 seconds
    • Query the users having more than X percent sessions

    as Impacted
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users

    View full-size slide

  105. Sit back and Strategize! 🤔
    • Discussion with product stakeholders
    • Query the users having more than X percent sessions

    as Impacted
    • Tools selection: Firebase Realtime Database, Firebase

    User Properties and Debug API on the rescue
    • Google Android Vitals >= 5 seconds
    • Definition of Impacted session for app launch
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users

    View full-size slide

  106. Sit back and Strategize! 🤔
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users
    Segment

    impacted users

    with firebase
    Uploading

    traces from

    impacted users

    View full-size slide

  107. Sit back and Strategize! 🤔
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users
    Segment

    impacted users

    with firebase
    Uploading

    traces from

    impacted users

    View full-size slide

  108. Sit back and Strategize! 🤔
    1. Create Firebase User Properties on Console

    View full-size slide

  109. Sit back and Strategize! 🤔
    1. Create Firebase User Properties on Console
    pro
    fi
    le_app_startup

    View full-size slide

  110. Sit back and Strategize! 🤔
    users
    …….
    2. Firebase Realtime Database

    View full-size slide

  111. Sit back and Strategize! 🤔
    2. Firebase Realtime Database
    users
    …….
    ……. user-id-1
    ……. user-id-2

    View full-size slide

  112. Sit back and Strategize! 🤔
    users
    …….
    ……. user-id-1
    ……. user_property_a: true
    ……. user-id-2
    ……. user_property_a: true
    2. Firebase Realtime Database

    View full-size slide

  113. Sit back and Strategize! 🤔
    users
    …….
    ……. user-id-1
    ……. user_property_a: true
    ……. user-id-2
    ……. user_property_a: true
    ……. pro
    fi
    le_app_startup: true
    ……. user_property_b: true
    2. Firebase Realtime Database

    View full-size slide

  114. Sit back and Strategize! 🤔
    users
    …….
    ……. user-id-1
    ……. user_property_a: true
    ……. user-id-2
    ……. user_property_a: true
    ……. pro
    fi
    le_app_startup: true
    ……. user_property_b: true
    2. Firebase Realtime Database
    Dynamically enable app start up profiling for these users

    View full-size slide

  115. Sit back and Strategize! 🤔
    3. Enable via remote config

    View full-size slide

  116. Sit back and Strategize! 🤔
    3. Enable via remote config
    • Create parameter enable_trace_app_launch

    View full-size slide

  117. Sit back and Strategize! 🤔
    3. Enable via remote config
    • Create parameter enable_trace_app_launch
    • Create condition with user property profile_app_startup

    View full-size slide

  118. Sit back and Strategize! 🤔
    3. Enable via remote config
    • Create parameter enable_trace_app_launch
    • Create condition with user property profile_app_startup
    • Enable the parameter for the condition and default to false

    View full-size slide

  119. Sit back and Strategize! 🤔
    Step 3: Extract Impacted sessions and collect prod traces

    from the impacted users
    Segment

    impacted users

    with firebase
    Uploading

    traces from

    impacted users

    View full-size slide

  120. Sit back and Strategize! 🤔
    4. Debug API
    •Fetch performance traces for the impacted users from

    production

    View full-size slide

  121. Sit back and Strategize! 🤔
    4. Debug API
    •Fetch performance traces for the impacted users from

    production
    class AppLaunchTracker(private val remoteConfig: RemoteConfig)


    View full-size slide

  122. Sit back and Strategize! 🤔
    4. Debug API
    •Fetch performance traces for the impacted users from

    production
    class AppLaunchTracker(private val remoteConfig: RemoteConfig)


    fun startTracking() {


    ...


    if(remoteConfig.isEnabled(enable_trace_app_launch)) {


    Debug.startMethodTracingSampling(


    context.cacheDir,


    maxBufferSize,


    samplingIntervalUs


    )


    }


    }


    View full-size slide

  123. Sit back and Strategize! 🤔
    4. Debug API
    •Fetch performance traces for the impacted users from

    production
    class AppLaunchTracker(private val remoteConfig: RemoteConfig)


    fun stopTracking() {


    ...


    if(remoteConfig.isEnabled(enable_trace_app_launch)) {


    Debug.stopMethodTracing()


    }


    }


    View full-size slide

  124. Sit back and Strategize! 🤔
    4. Debug API
    •Fetch performance traces for the impacted users from

    production
    •Upload traces from periodic work manager

    View full-size slide

  125. Sit back and Strategize! 🤔
    4. Debug API
    •Fetch performance traces for the impacted users from

    production
    •Upload traces from periodic work manager
    • Firebase Storage


    • Multipart API upload

    View full-size slide

  126. Tracker
    Attributes for app launch

    Insights from data:

    • Splash screen is not the only

    contributor to first_screen_drawn
    • App Icon click is not only trigger
    • Campaigns
    Eyes on the changes entering while you fix

    Alert of PRs on slack, email

    Flame graphs, diff, VCS metadata

    View full-size slide

  127. Tracker
    Attributes for app launch

    Insights from data:

    • Splash screen is not the only

    contributor to first_screen_drawn
    • App Icon click is not only trigger
    • Campaigns
    Eyes on the changes entering while you fix

    Alert of PRs on slack, email

    Flame graphs, diff, VCS metadata

    Traces from production

    View full-size slide

  128. Sit back and Strategize! 🤔
    Flamegraphs

    View full-size slide

  129. Sit back and Strategize! 🤔
    What we achieved with flame graphs?

    View full-size slide

  130. Sit back and Strategize! 🤔
    •Study issues which are consistent in the impacted flame

    graphs
    What we achieved with flame graphs?

    View full-size slide

  131. Sit back and Strategize! 🤔
    •Study issues which are consistent in the impacted flame

    graphs
    What we achieved with flame graphs?
    •Creating a priority list of the issues that needs to be fixed

    View full-size slide

  132. Sit back and Strategize! 🤔
    •Study issues which are consistent in the impacted flame

    graphs
    What we achieved with flame graphs?
    •Creating a priority list of the issues that needs to be fixed


    •Performance gain they will provide

    View full-size slide

  133. Sit back and Strategize! 🤔
    •Study issues which are consistent in the impacted flame

    graphs
    What we achieved with flame graphs?
    •Creating a priority list of the issues that needs to be fixed


    •Performance gain they will provide


    •Effort of fix on the basis of:


    •Refactor


    •Upgrading library


    •Executing on background thread

    View full-size slide

  134. Step4:

    Lets ship the fixes

    View full-size slide

  135. Step4:

    Lets ship the fixes
    Some of the issues the team found
    •Dexguard class encryption of classes increasing

    initialisation time

    View full-size slide

  136. Step4:

    Lets ship the fixes
    Some of the issues the team found
    •Dexguard class encryption of classes increasing

    initialisation time
    •List of consistent expensive initialisation of some SDKs

    View full-size slide

  137. Step4:

    Lets ship the fixes
    Some of the issues the team found
    •Dexguard class encryption of classes increasing

    initialisation time
    •List of consistent expensive initialisation of some SDKs
    •Unwanted dependencies getting injected through dagger

    View full-size slide

  138. Partayyy!!
    Some of the issues the team found
    •Dexguard class encryption of classes increasing

    initialisation time
    •List of consistent expensive initialisation of some SDKs
    •Unwanted dependencies getting injected through dagger
    🎉

    View full-size slide

  139. Conclusion
    •Creating observability is the most important part, fixes can really be one line change

    View full-size slide

  140. Conclusion
    •Creating observability is the most important part, fixes can really be one line change
    •Lets revisit our patterns:

    View full-size slide

  141. Conclusion
    •Creating observability is the most important part, fixes can really be one line change
    • Pattern 1: Scalable ≠ High Performant Codebase
    •Lets revisit our patterns:

    View full-size slide

  142. Conclusion
    •Creating observability is the most important part, fixes can really be one line change
    • Pattern 1: Scalable ≠ High Performant Codebase
    •Lets revisit our patterns:

    • Pattern 2: We get to know from customer tickets or Android Vitals

    View full-size slide

  143. Conclusion
    •Creating observability is the most important part, fixes can really be one line change
    • Pattern 1: Scalable ≠ High Performant Codebase
    •Lets revisit our patterns:

    • Pattern 2: We get to know from customer tickets or Android Vitals

    • Pattern 3: Prioritising performance issues with other feature work is an issue

    View full-size slide

  144. Conclusion
    •Creating observability is the most important part, fixes can really be one line change
    • Pattern 1: Scalable ≠ High Performant Codebase
    •Lets revisit our patterns:

    • Pattern 2: We get to know from customer tickets or Android Vitals

    • Pattern 3: Prioritising performance issues with other feature work is an issue

    • Pattern 4: Drafting OKRs for platform teams is difficult

    View full-size slide

  145. Conclusion
    •Creating observability is the most important part, fixes can really be one line change
    • Pattern 1: Scalable ≠ High Performant Codebase
    •Lets revisit our patterns:

    • Pattern 2: We get to know from customer tickets or Android Vitals

    • Pattern 3: Prioritising performance issues with other feature work is an issue

    • Pattern 4: Drafting OKRs for platform teams is difficult
    Proposal:

    View full-size slide

  146. Conclusion
    •Creating observability is the most important part, fixes can really be one line change
    • Pattern 1: Scalable ≠ High Performant Codebase
    •Lets revisit our patterns:

    • Pattern 2: We get to know from customer tickets or Android Vitals

    • Pattern 3: Prioritising performance issues with other feature work is an issue

    • Pattern 4: Drafting OKRs for platform teams is difficult
    • KR 1: Bringing observability to metric x, y, z, a, b, c (first screen, app launch time, user id)
    Proposal:

    View full-size slide

  147. Conclusion
    •Creating observability is the most important part, fixes can really be one line change
    • Pattern 1: Scalable ≠ High Performant Codebase
    •Lets revisit our patterns:

    • Pattern 2: We get to know from customer tickets or Android Vitals

    • Pattern 3: Prioritising performance issues with other feature work is an issue

    • Pattern 4: Drafting OKRs for platform teams is difficult
    • KR 1: Bringing observability to metric x, y, z, a, b, c (first screen, app launch time, user id)
    Proposal:
    • KR 2: Attempt 70% accuracy on the attempts for fixing cold start.

    View full-size slide

  148. Conclusion
    •Creating observability is the most important part, fixes can really be one line change
    • Pattern 1: Scalable ≠ High Performant Codebase
    •Lets revisit our patterns:

    • Pattern 2: We get to know from customer tickets or Android Vitals

    • Pattern 3: Prioritising performance issues with other feature work is an issue

    • Pattern 4: Drafting OKRs for platform teams is difficult
    • KR 1: Bringing observability to metric x, y, z, a, b, c (first screen, app launch time, user id)
    Proposal:
    • KR 2: Attempt 70% accuracy on the attempts for fixing cold start.
    • KR 3: Creating quality gate and bringing X% confidence on detecting regressions

    View full-size slide

  149. Fin
    🙋
    @droid_singh
    @amanjeetsingh150
    Amanjeet Singh

    View full-size slide