MONO REPOSITORY
WHAT, why and how
Lemi Orhan Ergin
Agile Software Craftsman
Slide 2
Slide 2 text
Welcome to
the hell of
components
and apps
Coarse grained
structure between
applications and
databases
Slide 3
Slide 3 text
Multi Repository System
Having one individual sourcecode repository for each logical code group
Slide 4
Slide 4 text
Clear ownership for each repo
Possible to restrict access for each repo
Lightweight repository, narrow clones
High flexibility of dependency upgrade
Independent upgrade & versioning strategy
Manage like open source applications
Easy to open the source to public
Multi Repository System
PROS
Slide 5
Slide 5 text
Code duplication
Inefficient code review
Lack of understanding big picture
Cross repo changes and refactorings are painful
Adds overhead if one team handles multiple repos
It hurts your ability to navigate the code
Need to open multiple IDEs to write code
Need to manage versions of many small libraries
Long release procedure, open for failure
Need to pull changes on many repos
Multi Repository System
CONS
Slide 6
Slide 6 text
Mono Repository
System
Even though our services are still developed and
deployed independently, the code for all services lives
in one repository
The repository contains more than one logical project
(e.g. an iOS client and a web-application)
These projects are most likely unrelated, loosely
connected or can be connected by other means (e.g via
dependency management tools)
Slide 7
Slide 7 text
Reduces overhead of dependencies
Easier to navigate on sourcecode
Unified versioning, one source of truth
You don’t need to define version numbers
Cross-project refactoring and implementation is easier
Forcing dependencies to update to latest
Effective code reviews
Sharing common components
No wasting time dealing with multiple git commands
Mono Repository System
PROS
1
Slide 8
Slide 8 text
All about moving fast and getting things done
Increase developer productivity
Enables experimenting cross-project improvements
Supports real CI and Trunk Based Development
Mono Repository System
PROS
2
Slide 9
Slide 9 text
Fully supports microservices architecture
You can still maintain a loosely coupled architecture
More relevant pull requests & commits
Project gardening is simpler
Mono Repository System
PROS
3
with Micro Service Architecture
Slide 10
Slide 10 text
Cannot restrict to access for specific projects
Low flexibility of dependency upgrade
Needs special tooling for building
Usefulness of tags diminishes
Performance issues might occur on git
Mono Repository System
CONS
Slide 11
Slide 11 text
We don’t work with application specialists, we work with generalists and
a lot of communication through pull requests.
We want to build one team with knowledge across services as opposed to
several teams with localized knowledge.
What do we want
No Silos
To experiment cross-platform refactorings
We want to remove code duplication, decrease coupling and increase
cohesion inside sourcecode. That needs creating extra modules and projects.
To improve efficiency of release & deployment
We want to use latest/best versions of dependencies. And that would be for
all modules and platforms.
Slide 12
Slide 12 text
Twi!er, Facebook, Google, Digital Ocean,
Foursquare, Etsy, Shippable, Plataformatec, Ravelin
Who migrated from
multi to mono
repositories?
Slide 13
Slide 13 text
Facebook’s main source repository is enormous—many
times larger than even the Linux kernel, which checked
in at 17 million lines of code and 44,000 files in 2013.
Test repo:
4 million commits
Linear history
~1.3 million files
The size of the .git directory was roughly 15 GB
The size of the index file was 191 MB
Who migrated from multi to mono repositories?
Facebook
Slide 14
Slide 14 text
All 2 billion lines of code sit inside a single system
available to just about every engineer inside the
company.
One repository, huge activity:
Google’s 25,000 engineers
About 45,000 commits (changes) to the repository each day
Google engineers modify 15 million lines of code across 250,000 files
each week.
Who migrated from multi to mono repositories?
Google
h!p://cacm.acm.org/magazines/2016/7/204032-why-google-stores-billions-of-lines-of-code-in-a-single-repository/fulltext
Why Google Stores Billions of Lines of Code in a Single Repository
Slide 15
Slide 15 text
You can not do CI without using monorepos
- Xebia
What people say?
And you should feel the benefit almost immediately.
Whenever I’ve done this, it’s felt like an absolute breath
of fresh air, and has immediately made me happier.:))) -
David R. MacIver, Ex-Google Engineer
Slide 16
Slide 16 text
“When you start a new project,” Potvin tells WIRED, “you
have a wealth of libraries already available to you. Almost
everything has already been done.”
- Rachel Potvin, Engineering Manager at Google
What people say?
Our productivity has increased at least 5x.
- Shippable