When in Rome: How Spotify halved build times with just one script

Spotify Engineering
8 min readintermediate
--
View Original

Overview

The article discusses how Spotify significantly improved the build times of its iOS app, Spotify for Artists, by implementing a caching solution using a custom script with the Rome tool. This innovation led to a 50% reduction in build times, enhancing developer productivity and user experience.

What You'll Learn

1

How to implement caching for iOS app dependencies using Rome

2

Why using pre-built binaries can reduce build times in iOS development

3

When to consider custom scripts for artifact management in CI/CD pipelines

Prerequisites & Requirements

  • Understanding of iOS development and dependency management
  • Familiarity with Carthage and CI/CD tools(optional)

Key Questions Answered

How did Spotify reduce iOS app build times by 50%?
Spotify reduced build times by implementing a caching solution with Rome, which allowed them to reuse pre-built binaries instead of compiling dependencies from source. This change cut the CI configuration time from around 20 minutes to under 10 minutes, significantly improving developer efficiency.
What challenges did Spotify face with dependency management?
Spotify faced significant delays due to the need to compile dependencies from source, which consumed 60-70% of build time. This was particularly problematic during continuous integration, where build artifacts were cleaned before each build, forcing developers to rebuild dependencies repeatedly.
What is the role of the Rome tool in Spotify's build process?
Rome is an open-source tool that caches artifacts built by Carthage, allowing Spotify to store and retrieve pre-built binaries efficiently. By integrating a custom script with Rome, Spotify was able to adapt it to their artifact storage solution, Artifactory.
What specific improvements were observed after implementing the caching solution?
After integrating the caching solution, Spotify observed a 50% reduction in CI configuration times for the Spotify for Artists app, decreasing build times from approximately 20 minutes to under 10 minutes, thus enhancing overall developer productivity.

Key Statistics & Figures

Reduction in CI configuration time
50%
Build times for the Spotify for Artists app decreased from around 20 minutes to under 10 minutes after implementing the caching solution.
Time spent compiling dependencies
60-70%
This percentage reflects the time developers spent compiling the same dependencies repeatedly before the caching solution was implemented.

Technologies & Tools

Dependency Manager
Carthage
Used for managing dependencies in iOS applications at Spotify.
Caching Tool
Rome
Caches artifacts built by Carthage to improve build times.
Artifact Repository
Artifactory
Used by Spotify to store and manage build artifacts.

Key Actionable Insights

1
Implement caching for your iOS app dependencies to improve build times.
By using tools like Rome to cache pre-built binaries, you can significantly reduce the time spent on repetitive builds, which is especially beneficial in continuous integration environments.
2
Consider using custom scripts to tailor existing tools to your infrastructure needs.
Spotify's experience shows that adapting open-source tools like Rome with custom scripts can resolve specific challenges, such as integrating with different artifact storage solutions.
3
Monitor and analyze build times to identify bottlenecks in your development process.
Understanding where time is spent during builds can help you make informed decisions about optimizations, such as caching or changing dependency management strategies.

Common Pitfalls

1
Failing to adapt caching solutions to specific infrastructure needs can lead to inefficiencies.
Using a one-size-fits-all approach may not yield the desired improvements. Customizing tools like Rome to fit your existing systems is crucial for maximizing their effectiveness.

Related Concepts

Caching Strategies
Continuous Integration Best Practices
Dependency Management In Ios Development