How Glovo Slashes Lead Times by 30%: The Impact of Using Explicit Types in JVM
Original post Slashing Lead Times by 30%: The Impact of Using Explicit Types in JVM
Article Summary
alexxozo from Glovo's engineering team discovered that a single line of code change slashed their build time by 30%. The culprit? Java's type inference struggling with large Map definitions.
Glovo's feed service team faced a critical bottleneck: 35-minute builds were killing their ability to experiment and respond to incidents quickly. After migrating from Jenkins to GitHub Actions and optimizing tests, compilation time remained painfully slow. The breakthrough came from diving deep into Gradle's verbose logging.
Key Takeaways
- Build time dropped 30% by adding explicit types to Map.ofEntries calls
- Gradle's options.verbose flag revealed one class taking 5+ minutes to compile
- JVM type inference breaks down with 500+ Map entries in single declaration
- Parallel builds and incremental compilation cut memory usage significantly
- Lead time reduction enables faster product experimentation and incident response
Adding Map.<String, String>ofEntries instead of Map.ofEntries reduced compilation from 35 to 25 minutes by eliminating expensive type inference on large static data structures.
Continue reading
What This Article Covers
When Glovo moved from Jenkins to GitHub Actions, their microservice builds started taking 35 minutes and kept running out of memory. GitHub Actions had tighter resource limits, which exposed problems in their integration tests. These tests were consuming way too much memory.
The team made several changes to their Gradle setup. They turned on fork mode, incremental compilation, and parallel task execution. They also found tests that were missing Spring profiles and removed unit tests that were incorrectly extending integration base classes.
The CI pipeline went from 36 minutes down to about 25 minutes. This meant the team could experiment with new features faster and respond to incidents more quickly for Glovo's feed service.
This page summarizes “Slashing Lead Times by 30%: The Impact of Using Explicit Types in JVM” by Glovo, published Dec 18, 2023. All credit for the original work goes to the authors.