Live data from Hacker News

Ask HN: What are the pros / cons of using monorepos?

news.ycombinator.com

71–80 of 100 posts

Re: Ask HN: What are the pros / cons of using monorepos?

#71

Google posted a paper detailing their reasons for choosing monorepo: https://research.google/pubs/pub45424/ Caveat: your company probably isn't Google, so your challenges may be different.

Thanks for sharing that. It's mind-blowing that Google runs everything from a single repo. Most places that I work with create several repos for just one project.

Re: Ask HN: What are the pros / cons of using monorepos?

#72
post #33

Twitter: Monorepo Facebook: Monorepo Google: Monorepo Amazon: Multirepo Of these companies, compare AWS and the number of services, new features and quick turn around time with their competitors, and get back to me.

What makes Amazon's multirepo setup "tick" isn't the multirepos themselves but the coordination mechanisms around it (version sets, brazil, and pipelines). whereas bazel/buck are open source and work ok enough to scale monorepos, i dont think there are the equivalent tools out there for multirepo and it shows in the comments for people with multirepo pain.

EDIT: that being said, I do think multirepo is better, but only when you have the above tools to manage it.

Re: Ask HN: What are the pros / cons of using monorepos?

#73
post #32

Earlier quoted context omitted.

> You have to figure out with every commit what actually changed and based on that change what needs to be tested and built. I feel this problem and I wonder, is there any ready-made solution for that?

We just build and test everything every time. Maybe it costs us more $$$ on CI, but it costs far less in developer time. That being said, I mostly work at startups and larger companies will certainly cross a threshold where this isn't feasible.

>>> larger companies will certainly cross a threshold where this isn't feasible.

Nope. Worked at the largest US bank that happens to be mono repo. They had compute grids with thousands of cores running tests 24/7. It's not sizable compared to the costs of the developers writing and maintaining software.

Re: Ask HN: What are the pros / cons of using monorepos?

#74
post #68

Earlier quoted context omitted.

Git + Bazel will be fine for scaling up to 100s of engineers from my experience (at Lyft's L5 autonomous division). My other data point is Google, with 10,000s of engineers and a bespoke VCS. I'm not sure how things work in the middle (1000s of engineers), but I think you can solve that problem when you get to it, and Bazel has some features (look at the git_repository rule) to help you split a big repo if you need t…

I work in a project with 50 engineers. Our git repo is 2GB plus 5GB of submodules. Git is painfully slow and I would imagine with more engineers it would become unusable. For example, git-fetch takes at least a minute. To some degree we are doing it wrong like using Windows, creating too many tags, and committing binary blobs (despite LFS). Still, scaling it up by factor of two or three would not change it significan…

Interesting... when you say fetch, are you talking about a cold-fetch?

`du -sh repo` for me is 15GB, and we don't experience the slowness you describe. If I'm checking out a branch that diverged from master 1 year ago, it takes maybe... 30 seconds?

But I don't know, maybe we've cast different git-spells from you all? We don't use sub-modules, for example.

Re: Ask HN: What are the pros / cons of using monorepos?

#75

I won't try to be exhaustive here, but I think it's worth mentioning a few things: One con is that most open source (as well as publicly available but proprietary) tooling is geared towards the non-monorepo approach. So if you want to use a monorepo, you're going to have to fight a bit of an uphill battle because most tools and processes assume you have lots of little repos. For example, build triggers in a lot of CI…

Regression tests across multiple repos are still required. I don't see how splitting a monorepo into multiple repos gets rid of those tests.

Agreed - that's why I said that the big thing is the One Version Rule, not the monorepo itself. If you're not following the One Version Rule, then end-to-end tests have to deal with an explosion in the different combinations of versions of everything. It quickly becomes unmanageable.

Re: Ask HN: What are the pros / cons of using monorepos?

#76

We are breaking our monorepo into 3 kind-of mono repos based on release cadence. A repo for each of two large applications plus a third repo for shared library code. We import the share library code onto the app repos using a git sub module. Has anyone else used git sub-repos to import common code?

We've used submodules pretty extensively in the past but we're working to get rid of as many of them as possible. A friend and former colleague liked to say they were the worst solution... with the exception of all the other solutions. Practically speaking they are probably more confusing to new developers who haven't had a lot of experience with them. We would often run into problems that stemmed from someone making a change in the submoduled repo and then forgetting to update the ref in the parent. Or people would navigate to the submodule to do the work there rather than checking it out separately, and then be confused over the detached HEAD status and check out a branch (not a problem, necessarily, but confusing to some extent). For some of our dependencies we've gotten rid of submodules in favor of hosting internal pypi packages.

Re: Ask HN: What are the pros / cons of using monorepos?

#77
I've heard many teams are breaking repos up by team, and I think that makes sense for many non-Google companies, but what I wonder about is whether or not clients and backends should ever be bundled in one repo.

My gut tells me they should be separate, but I'm curious what other people think.

Re: Ask HN: What are the pros / cons of using monorepos?

#79
post #55
post #26

Earlier quoted context omitted.

> Churn from other dev's stuff gets in your merge/rebase work Wouldn't other people' work only cause issues if they are changing the same files, in which case conflicts would happen even if the work is spread in multiple repos?

Here is the problem: 1- You finished your work, so you pull from the central repository, and merge your your branch to the master 2- You do your merge work, test it a bit and commit 3- Now, you push and oops, another team did the same, you are now left with to heads 4- You merge or rebase the two heads. Probably a simple task, but you may still need to run some tests again. And if you are lucky, you are done, otherwi…

When you say "But the more freedom you give individual teams to push to the common branches", what do you mean? I've typically only seen CI merge to master, and disable pushing.

Re: Ask HN: What are the pros / cons of using monorepos?

#80
post #26

Pros: * Single version / branching for everything * Commits that go across components/apps are atomic. Cons: * When it gets big, those features matter less * Churn from other dev's stuff gets in your merge/rebase work. * 'git log' and other commands can be painfully slow * Mistakes in the repo (e.g., committing a password) now affect many more people. Use for highly-coupled source bases. Where releases together and a…

> Churn from other dev's stuff gets in your merge/rebase work Wouldn't other people' work only cause issues if they are changing the same files, in which case conflicts would happen even if the work is spread in multiple repos?

Github (might depend on settings) refuse to merge if your branch is out of date. Rebasing on master re-triggers CI/CD. Might cause lots of waiting for this case...
Post reply on HN