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

Android Builds: Simple Recipes for Enhance Deve...

Android Builds: Simple Recipes for Enhance Developer Productivity

PRESENTED AT:

1. DPE Summit (https://www.linkedin.com/posts/aidaisay_dpesummit-developerproductivity-techconference-activity-7238958096126005248-gc7j) 🇺🇸

DATES:

1. September 24, 2024

DESCRIPTION:

Diving into Android build optimizations, this talk revisits seemingly minor adjustments that hold untapped potential for speeding up your build process.

Often overlooked or underestimated, these simple tweaks can be game-changers in enhancing build efficiency. I'll share insights from my experience at Toast where basic changes led to significant improvements, reminding you to give these solutions a second glance.

Whether it's fine-tuning gradle properties, leveraging incremental builds, or optimizing resource usage, this session aims to highlight the often-skimmed solutions that might just be the key to a faster build.

This session is ideal for developers looking to improve build times and enhance productivity, demonstrating that sometimes, the most impactful optimizations are also the most accessible.

Aida Issayeva

September 24, 2024
Tweet

More Decks by Aida Issayeva

Other Decks in Programming

Transcript

  1. @aida_isay About me Staff Software Engineer
 Tech Lead for POS

    Productivity team Google Developer Expert for Android Women TechMakers Ambassador
  2. @aida_isay Agenda 01 Toast 02 POS App 03 Growth Pains

    The problem The results 04 Hardware 05 Gradle Properties 06 Dependencies 07 CI Scripts 08 CI Container Settings & Configuration 09 Recap
  3. @aida_isay Toast’s Growth 2023 Customers:
 Restaurants 0 25,000 50,000 75,000

    100,000 100,000 2023 Customers:
 Restaurants 0 25,000 50,000 75,000 100,000 100,000
  4. @aida_isay POS App’s Build Tooling State Gradle Build System Git

    Version Control Github Git hosting platform Jenkins CI Server
  5. @aida_isay POS App’s Growth 2015 Features 0 250 500 750

    1000 50 2015 Contributors 0 40 80 120 160 10 2015 Number of Builds 0 7500 15000 22500 30000 2000
  6. @aida_isay POS App’s Growth 2015 Features 0 250 500 750

    1000 50 2023 Contributors 0 40 80 120 160 141 2023 Contributors 0 40 80 120 160 141 2015 Number of Builds 0 7500 15000 22500 30000 2000
  7. @aida_isay POS App’s Growth 2023 Features 0 250 500 750

    1000 1000 2023 Features 0 250 500 750 1000 1000 2023 Contributors 0 40 80 120 160 141 2023 Contributors 0 40 80 120 160 141 2015 Number of Builds 0 7500 15000 22500 30000 2000
  8. @aida_isay POS App’s Growth 2023 Features 0 250 500 750

    1000 1000 2023 Features 0 250 500 750 1000 1000 2023 Contributors 0 40 80 120 160 141 2023 Contributors 0 40 80 120 160 141 2023 Number of Builds 0 7500 15000 22500 30000 26000 2023 Number of Builds 0 7500 15000 22500 30000 26000
  9. @aida_isay The problem Build Time Uptick Minutes 0 40 80

    120 160 Q1 2022 Q2 2022 Q3 2022 Q4 2022 Q1 2023 Q2 2023 77 74 69 56 51 48 75.76 72 67 52 45 42 P50 Build Time P95 Build Time
  10. @aida_isay The problem Build Time Uptick Minutes 0 40 80

    120 160 Q1 2022 Q2 2022 Q3 2022 Q4 2022 Q1 2023 Q2 2023 77 74 69 56 51 48 75.76 72 67 52 45 42 P50 Build Time P95 Build Time +44%
  11. @aida_isay Build Efficiency Project Results Q3 2023 - Q1 2024

    Minutes 0 17.5 35 52.5 70 H1 2023 H2 2023 Q1 2024 P50 Build Time
  12. @aida_isay Build Efficiency Project Results Q3 2023 - Q1 2024

    Minutes 0 17.5 35 52.5 70 H1 2023 H2 2023 Q1 2024 P50 Build Time -61%
  13. @aida_isay 2d. Manage Memory ✅ Xmx Metaspace and other native

    memory JVM Memory Hungriest Gradle Task 70% - 80% 100%
  14. @aida_isay 3. Dependencies ❌ Unused Dependencies 1. Time • Dependency

    Resolution • Configuration • Download 2. Size • Classpath
  15. @aida_isay 3. Dependencies ❌ Unused Dependencies Outdated Dependencies 1. Time

    • Dependency Resolution • Configuration • Download 2. Size • Classpath
  16. @aida_isay 3. Dependencies ❌ Unused Dependencies Outdated Dependencies 1. Time

    • Dependency Resolution • Configuration • Download 2. Size • Classpath 1. Time • Dependency Resolution • Inefficient build processes • Deprecated Features 2. Compatibility Issues 3. Security Patches 4. Maintainer Support
  17. @aida_isay 3. Dependencies ✅ Unused Dependencies Outdated Dependencies Use Plugins

    1. Dependency Analysis Gradle Plugin - unused & transitive dependencies 2. Dependabot - automated dependency updates in Github 3. RenovateBot - automated dependency updates in Github
  18. @aida_isay 4. CI Scripts ❌ • Serial Execution of CI

    Stages • Staggered Gradle tasks across different stages • Timeouts on different plugin responses https://devops.com/how-to-use-the-jenkins-pipelines/
  19. @aida_isay 4. CI Scripts ✅ • Parallelize CI Stages •

    Combine Gradle tasks • Investigate and reduce timeouts https://www.jenkins.io/blog/2017/09/25/declarative-1/
  20. @aida_isay 5. CI Container Settings & Config ❌ Instance Age

    https://toolsqa.com/jenkins/jenkins-configuration/
  21. @aida_isay 5. CI Container Settings & Config ❌ Instance Age

    Agents Count https://toolsqa.com/jenkins/jenkins-configuration/
  22. @aida_isay 5. CI Container Settings & Config ❌ Instance Age

    Agents Count Agent Instantiation https://toolsqa.com/jenkins/jenkins-configuration/
  23. @aida_isay 5. CI Container Settings & Config ❌ Instance Age

    Agents Count Agent Instantiation Build Queue Congestion https://toolsqa.com/jenkins/jenkins-configuration/
  24. @aida_isay 5. CI Container Settings & Config ❌ Instance Age

    Agents Count Agent Instantiation Build Queue Congestion Build Trigger on Unnecessary Events https://toolsqa.com/jenkins/jenkins-configuration/
  25. @aida_isay 5. CI Container Settings & Config ✅ Instance Age

    Agents Count Agent Instantiation Build Queue Congestion Build Trigger on Unnecessary Events
  26. @aida_isay 5. CI Container Settings & Config ✅ Instance Age

    Agents Count Agent Instantiation Build Queue Congestion Build Trigger on Unnecessary Events Migrate to newer instance
  27. @aida_isay 5. CI Container Settings & Config ✅ Instance Age

    Agents Count Agent Instantiation Build Queue Congestion Build Trigger on Unnecessary Events Migrate to newer instance Allocate high number of agents
  28. @aida_isay 5. CI Container Settings & Config ✅ Instance Age

    Agents Count Agent Instantiation Build Queue Congestion Build Trigger on Unnecessary Events Migrate to newer instance Allocate high number of agents Keep agents warm
  29. @aida_isay 5. CI Container Settings & Config ✅ Instance Age

    Agents Count Agent Instantiation Build Queue Congestion Build Trigger on Unnecessary Events Migrate to newer instance Allocate high number of agents Keep agents warm Cancel ongoing builds if 
 new one is pushed
  30. @aida_isay 5. CI Container Settings & Config ✅ Instance Age

    Agents Count Agent Instantiation Build Queue Congestion Build Trigger on Unnecessary Events Migrate to newer instance Allocate high number of agents Keep agents warm Cancel ongoing builds if 
 new one is pushed Revisit plugin events and 
 don’t trigger builds on 
 PR metadata change
  31. @aida_isay Recap •enable parallel •enable cache •optimize memory config •manage

    gradle workers •upgrade hardware •optimize container settings •fine-tune plugin events •improve CI scripts Generated by Canva AI
  32. @aida_isay Recap Developers + Product 0 17.5 35 52.5 70

    H1 2023 Q1 2024 27 68 P50 Build Time
  33. @aida_isay Resources • Setting Kotlin Daemon’s JVM args • Java

    Memory model specification • Introduction to Java's Memory model • Essential Tips to minimize Gradle Build Time • From laptops to advanced CI • Managing nodes in Jenkins Generated by Canva AI