Overview
The article discusses LinkedIn's 3x3 philosophy aimed at optimizing iOS build speed and stability, detailing the challenges faced and the solutions implemented to achieve a rapid commit-to-publish pipeline. It highlights the transition to Swift, the importance of automated testing, and the implementation of distributed building and testing to enhance efficiency.
What You'll Learn
1
How to optimize Swift code to reduce build times
2
Why distributed building can enhance CI/CD pipelines
3
How to implement automated UI testing to improve release cycles
Prerequisites & Requirements
- Understanding of Swift programming language and iOS development
- Familiarity with CI/CD tools and testing frameworks(optional)
Key Questions Answered
How did LinkedIn optimize their iOS build pipeline?
LinkedIn optimized their iOS build pipeline by refactoring Swift code, speeding up UI test frameworks, and implementing distributed building and testing across multiple machines. These changes reduced the commit-to-publish time significantly from over four hours to around 45 minutes.
What challenges did LinkedIn face with Swift's compilation times?
As the codebase grew, LinkedIn experienced increased build times, with release builds taking up to two hours and UI tests adding another two and a half hours. This necessitated a refactor of the codebase to improve compilation speed and reduce overall build times.
What is Project Hydra and its goals?
Project Hydra aims to improve build stability by running tests in parallel on multiple simulators within a single machine. This approach enhances build times significantly, achieving speeds five to ten times faster than previous methods.
Key Statistics & Figures
Daily commits
60 commits
This volume of commits contributed to the increasing build times experienced by LinkedIn.
Initial commit-to-publish time
4.5 hours
This was the time taken before optimizations were implemented.
Current commit-to-publish time
45 minutes
This is the time achieved after implementing distributed building and testing.
UI test running time reduction
80 percent
This was achieved by optimizing the KIF UI testing framework.
Technologies & Tools
Some links below are affiliate links. We may earn a commission if you make a purchase.
Programming Language
Swift
Used as the primary language for LinkedIn's flagship application Voyager.
Testing Framework
Kif
Utilized for UI testing, which was optimized to improve testing speed.
Configuration Management
Cfengine
Used for managing the machine pool for build stability.
Key Actionable Insights
1Implement distributed building to enhance CI/CD efficiency.By distributing build and testing jobs across multiple machines, you can significantly reduce the time from code commit to production release, as demonstrated by LinkedIn's reduction to 45 minutes.
2Refactor code to use explicit type references in Swift.This change can lead to substantial improvements in build times, as LinkedIn found that it cut debug build time by almost half and reduced release build time from two hours to 35 minutes.
3Utilize automated UI testing frameworks to streamline testing processes.Automating UI tests can drastically reduce testing time and improve reliability, which is essential for maintaining a rapid release cycle.
Common Pitfalls
1
Reliability issues with distributed testing can arise due to increased complexity.
As more machines are added to the testing pool, the overall reliability can decrease due to the compounded failure rates of each machine. It's crucial to ensure that the individual machines are stable to maintain overall system reliability.
Related Concepts
Continuous Integration/Continuous Deployment (ci/Cd)
Automated Testing
Performance Optimization Techniques