Share
Embed
Mono Repository: What, Why and How
I've been using mono repository for many years. I prepared this deck to explain why mono repository is a better choice in certain circumstances.
Lemi Orhan Ergin PRO
June 04, 2018
Transcript
16 slides
-
MONO REPOSITORY WHAT, why and how Lemi Orhan Ergin Agile
Software Craftsman -
Welcome to the hell of components and apps Coarse grained
structure between applications and databases -
Multi Repository System Having one individual sourcecode repository for each
logical code group -
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 -
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 -
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) -
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 -
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 -
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 -
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 -
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. -
Twi!er, Facebook, Google, Digital Ocean, Foursquare, Etsy, Shippable, Plataformatec, Ravelin
Who migrated from multi to mono repositories? -
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 -
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 -
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 -
“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