WhoBuilt

Hard-learned Lessons in App Scaling

Sep 25, 2024· 29 min· 825 views·Watch on YouTube

Speaker

Mike Duminy, principal engineer and architect at Klar, shares lessons from scaling the Klar app at React Universe Conf 2024, presented by Callstack.

Measure app performance

Duminy describes Android startup times reaching about 30 seconds on popular low-end devices. The team measured the boot sequence, parallelized work, improved a slow Keychain path, and switched from Metro to Re.Pack for code splitting and tree shaking. Startup time fell below three seconds. The team later made time to interactive a KPI and emphasized automating and tracking important metrics.

Restrict risky APIs

A feature that downloaded a website at app startup began making about 800 requests after a webpack chunking change, starving other app requests. The feature team had used an available startup callback to preload its content. Duminy’s lesson is to design APIs defensively and limit access to risky ones with tools such as code ownership or lint checks.

Make migrations incremental

The team’s move from a monolithic app to Yarn workspaces took two and a half years across roughly two million lines of code and 200 features. The final 10 percent took about a third of the project time. Allowing old and new architectures to interoperate let teams migrate gradually, while CI rules for new code and communicating team benefits helped adoption.

Investigate limits at scale

A development-only recursion error blocked more than 300 developers, but git bisect and reverting the apparent commit did not identify the cause. The team reproduced the issue with a generated bundle of about 50,000 connected files and shared it with the Hermes team. They traced it to a memory limit in register allocation; the issue was fixed in React Native 0.75. Duminy recommends digging into tools and working with their open-source communities when familiar debugging resources fall short.

Takeaways

  • Choose critical performance metrics, automate their measurement, and connect them to business goals.
  • Treat every platform API as something feature teams may use in unexpected ways; restrict risky entry points.
  • Plan large migrations for gradual adoption, with old and new systems able to coexist.
  • When a bug has no clear cause, build a small reproduction and bring concrete evidence to the tool’s maintainers.

Mentioned in this talk

Search inside this talk

What was claimed 11

Related talks

Hard-learned Lessons in App Scaling, Mike Duminy · WhoBuilt