Lyft Apr 13, 2022

Monitoring CPU Performance of Lyft’s Android Applications

Article Summary

Lyft's Android app serves millions of users daily, but how do you track CPU performance when hundreds of engineers ship code constantly? The team built a custom monitoring system from scratch.

Pavlo Stavytskyi from Lyft Engineering breaks down their approach to measuring CPU usage across Android releases. Instead of relying on third-party tools, they went deep into Linux system files and Android APIs to build precise, time-based metrics.

Key Takeaways

Critical Insight

Lyft built a custom CPU monitoring system using Linux system files and native APIs to track performance regressions across releases with precision down to one-minute intervals.

The article includes the exact formulas and code snippets for calculating CPU metrics that work across different ARM and x86 architectures.

About This Article

Problem

Lyft's Android apps grow quickly with hundreds of contributors working on the codebase. This makes it hard to spot CPU performance regressions between product releases without a proper way to measure them.

Solution

Pavlo Stavytskyi's team pulled intermediate metrics from /proc/[pid]/stat files, specifically utime, stime, cutime, and cstime values. They converted clock ticks to seconds using CPU clock speed to calculate relative average CPU usage between two points in time.

Impact

Lyft can now measure CPU load at one-minute intervals with precision. The system compares average values across releases and tracks performance patterns on different device architectures and core counts.

Recent from Lyft

Related Articles