TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Monorepos and the Fallacy of Scale

104 pointsby loevborgover 6 years ago

21 comments

kenover 6 years ago
Whenever I hear smart and reasonable people argue well for both sides of an engineering issue, my experience is that it will turn out that we&#x27;re arguing the wrong question. The perspective is wrong. We can&#x27;t get past thinking in terms of our old terminology.<p>What we all <i>really</i> want is a VCS where repos can be combined and separated easily, or where one repo can gain the benefits of a monorepo without the drawbacks of one.<p>Another crazy tech prediction from me: just as DVCS killed off pre-DVCS practically overnight, the thing that will quickly kill off DVCS is a new type of VCS where you can trivially combine&#x2F;separate repos and sections of repos as needed. You can assign, at the repo level, sub-repos to include in this one, get an atomic commit hash for the state of the whole thing, and where my VCS client doesn&#x27;t need to actually download every linked repo, but where tools are available to act like I have.<p>(This will also enable it to replace the 10 different syntaxes I&#x27;ve had to learn for one project to reference another, via some Dependencies list and its generated Dependencies.lock list.)<p>In a sense, we already have all of these features, in folders. You can combine and separate them, you can make a local folder mimic a folder on a remote system, and access its content without needing to download it all ahead of time. They just don&#x27;t have any VCS features baked in. We&#x27;ve got {filesystems, network filesystems, and VCS}, and each of the three has some features the others would like!<p>I don&#x27;t have much money right now but I&#x27;d pay $1000 for a good solution to this. I&#x27;d use it for my home directory, my backups, my media server, etc.
评论 #18860158 未加载
评论 #18868336 未加载
评论 #18867264 未加载
评论 #18858007 未加载
jupp0rover 6 years ago
While certainly interesting, the article leaves out the juicy bits monorepos and their workflows offer:<p>- library developers can easily see the impact their changes will have on their consumers<p>- library changes that introduce regressions in their consumers can be caught pre-merge given good test coverage<p>- dependency version updates between packages cause less mayhem because they are performed atomically and only merged when green<p>At the same time, many drawbacks are also left out:<p>- the incentive to have long living branches for stability reasons can negate most benefits mentioned above<p>- build times for compiled languages can become problematic even for moderately sized organizations (I’m looking at you, C++)<p>- in my experience, you pretty much need a dedicated dev team working on workflow tooling because ready solutions are fragmented and hard to integrate (code review, merge bots, CI&#x2F;CD, ...)
评论 #18858813 未加载
评论 #18856582 未加载
评论 #18856778 未加载
Joe8Bitover 6 years ago
The benefits of monorepos (in my experience) are all people&#x2F;organisation based e.g. it can be easier to enforce standards&#x2F;processes among 100s-1000s of engineers with a monorepo, or it can be easier to manage&#x2F;release a very large interdependent codebase&#x2F;eco-system being worked on&#x2F;coordinated between dozens of teams.<p>However, this linked post makes a great point, those benefits are all &#x27;scale&#x27; problems which 99.99% of orgs don&#x27;t have. The corollary is I&#x27;ve seen how hard it is to go from from multi-repo -&gt; monorepo when you reach the scale where you <i>would</i> see some benefit.<p>I also think that the tooling&#x2F;UX doesn&#x27;t publicly exist to solve the multi-repo problem with 100s-1000s of engineers working on 100s of repos. It becomes so hard to navigate, understand and grok and so much is buried in dark corners. My experience is that that tooling is <i>less hard</i> to build around monorepos (Google for example).
评论 #18858496 未加载
justinwpover 6 years ago
We are a small 20ish dev company using a monorepo with mostly python. Our tooling is Bazel and Drone.<p>- Ease of onboarding. Being able to quickly build or test any target is awesome for the new employee.<p>- Ease of collaboration. I can see all of the code easily and can learn from these patterns. I can also quickly contribute or extend apis and fix all usages without concern for breaking changes.<p>Our use of Bazel quickly gets us around git scale issues by enabling external dependencies that can be loaded into the workspace without fully vendoring everything.
评论 #18856375 未加载
评论 #18856671 未加载
评论 #18856472 未加载
azhenleyover 6 years ago
I’ve never understood the debate between mono and multi repos. With the right tooling, the line seems to vanish and you just have folders anyway.<p>Each repo may have their own policies and permissions, which is the biggest reason I see to keep them separate, but again the distinction still seems little more than a folder.<p>Am I missing something?
评论 #18855923 未加载
评论 #18855948 未加载
评论 #18855926 未加载
评论 #18856118 未加载
评论 #18856327 未加载
评论 #18855902 未加载
评论 #18855907 未加载
评论 #18857082 未加载
grey-areaover 6 years ago
We&#x27;re pretty small scale (&lt; 20 services, &lt; 10 devs), and happily use a monorepo (recently moved from multiple repos when that became unwieldy as services grew). If you have a lot of services&#x2F;projects with some shared dependencies they can make tracking that easier. I agree with the article that in general they make life easier.<p>It depends on what tooling you&#x27;re using, and whether it is tied to the version control system. Clearly if the tooling makes assumptions about one deployable per repo and works on git hooks that&#x27;s going to cause pain, but the answer is don&#x27;t use monorepos if your tooling doesn&#x27;t support it, or change the tooling so it does.<p>Most companies won&#x27;t scale past a few hundred employees, so they&#x27;re never going to hit any sort of scale issues with monorepos, and if they do, they&#x27;ll have the resources to deal with it.<p>Does this have to be a religious war? Does one size fits all really apply here?
评论 #18856148 未加载
评论 #18856242 未加载
nwhattover 6 years ago
The right way to write this kind of content is like Digital Ocean did: <a href="https:&#x2F;&#x2F;blog.digitalocean.com&#x2F;cthulhu-organizing-go-code-in-a-scalable-repo&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.digitalocean.com&#x2F;cthulhu-organizing-go-code-in-...</a><p>Rather than these back and forth about the theoretical implications of a monorepo, actual stories of implementing one are 10x more useful to me.
评论 #18857264 未加载
monksyover 6 years ago
&gt; Developers are not arguing children that need to be confined to separate rooms to prevent fights<p>Has the author seen the fights that go on? We&#x27;re extremely opinionated.
asdfasdfasdfaover 6 years ago
The original &quot;Monorepos please don&#x27;t&quot; article really just convinced me how great monorepos are when you <i>aren&#x27;t</i> at scale. So you know, put your shit in a monorepo, and then when it gets painful, break it out.
评论 #18856857 未加载
jphover 6 years ago
Monorepo vs polyreop summary notes from previous HN discussions: <a href="https:&#x2F;&#x2F;github.com&#x2F;joelparkerhenderson&#x2F;monorepo_vs_polyrepo" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;joelparkerhenderson&#x2F;monorepo_vs_polyrepo</a><p>I&#x27;m adding notes from this HN discussion today. Feedback welcome.
nijaveover 6 years ago
Merging&#x2F;integrating code &amp; styles is difficult and error prone. At the end of the day, if two systems interact they will need to be &quot;merged&quot; at some point. It seems to make more sense to handle this in tests&#x2F;at a source code level then risk doing it in the runtime environment alone.<p>I think tooling and granular permissions (still part of tooling) can be blockers, though. It makes less sense outside an enterprise&#x2F;company perspective such as developing a discrete component that gets pushed to a public repo (Maven, pypi, npm, etc)
EGregover 6 years ago
What are the actually serious downsides of having a repo for each project again? Serious question. Mercurial supports Subrepositories for example. Just define your rules for pulling stuff.<p>From my own experience, if you are arguing about whether use convention A or convention B, the answer should be to have C that allows both, and then configurations on top of C for A and B.<p>This applies for example to lookups in the dabatase by an index.
austincheneyover 6 years ago
&gt; Does the practice of keeping all code together in one place lead to better code sharing? In my experience that&#x27;s clearly the case.<p>This is where abstraction comes in. When done correctly abstractions are necessary so that you can separate your work from things you don&#x27;t want to work on. In my application I want to be able to access and modify files on the local filesystem. I don&#x27;t care about the differences between opening files in Windows versus Linux or the intricacies of how filesystems work at the bit level. My application evaluates some code and writes some output to a file. I use Node.js to solve for a universal file management API. This is an example of a good abstraction because the separation is clear and explicit.<p>The simple rule for abstractions is if you can do the very same job in a lower level you don&#x27;t need the higher level code. In the Node.js example you cannot access the filesystem in a lower level, because no such standard library exists to JavaScript.<p>Bad abstractions don&#x27;t provide separation. Many times developers want to use an abstraction to solve for complexity, but inadvertently do the very same things the abstraction is supposedly solving for just in a different style or syntax. Many JavaScript developers use abstractions to access the DOM or XHR. XHR is simple: assign a handler to the onreadystatechange property, open the connection, and then send the request. You lose huge amounts of performance by abstracting these and dramatically increase your code base and the separation between the API, the framework performing the abstraction, and the code you are writing are all superficial and self-imposed.<p>By using and enforcing good abstractions while avoiding bad abstractions you keep your application far more lean and restrict the focus of your development team to the goals of the project. Without that your code isn&#x27;t a monorepo, its a dependent library of another repo.
oblioover 6 years ago
I just have this to say: the discussions here are painfully oriented around SaaS. Once you&#x27;re doing stuff on-premise or making desktop applications (things requiring long lived release branches), the discussion is totally different.
评论 #18856836 未加载
评论 #18856816 未加载
eddiehover 6 years ago
I think I can summarize my thinking on this pretty succinctly: I want to build a product, not tooling for software development, and I certainly don&#x27;t want to spend any time trying to keep different repos synchronized, etc.
评论 #18860925 未加载
vorpalhexover 6 years ago
I&#x27;m part of a company that went from a boring VCS strategy to jumping on the monorepo bandwagon against my advice to keep our git usage simple. It&#x27;s been fairly terrible - merge conflicts, code going to the wrong environment, nobody can actually do a hot patch, and even long running feature branches which should be stupidly simple run into immense problem.<p>It also caused issues with our npm repo solution, and has created the worst case of dependency lock we&#x27;ve ever had.<p>Do yourself a favor and say no to monorepos. It is massive complexity for no benefit.
DannyBeeover 6 years ago
1. It&#x27;s really hard to tell if any of the people writing blog posts about these things have ever experienced the larger scale monorepos or not for any length of time.<p>As best I can tell, the answer is &quot;no&quot;, and they are mostly writing based on perception. They don&#x27;t appear to even do things like &quot;try to talk to people who have experienced the good and bad of it&quot;.<p>While the writing is fun, it makes it a lot less useful in both directions, IMHO.<p>2. The author is right that planning more than 6 months for smaller scale companies makes no sense. However, both of these authors seem to fundamentally miss the actual problem in large companies, which they assume is around engineering and scaling large systems. In fact, it is not. The underlying issue is that engineering a thing is no longer your main cost. This is one of many reasons larger teams&#x2F;companies are fundamentally different (as this author does correctly point out).<p>There are 2080 work hours in a year.<p>If i have 8000 developers, and I have to spend an hour teaching them a new thing, i just spent ~4 people for a year.<p>If you spend a day teaching them something new, I just spent ~31 people for a year.<p>If you spend a work week teaching them something new, I just spent ~154 people for a year.<p>That&#x27;s just the basic learning costs, it doesn&#x27;t include migration costs for code base or <i>anything else</i>[1].<p>But these costs certainly dominate the cost to engineer a solution as you get larger - the systems being talked about here (which <i>have</i> scaled engineering wise) are not 50 people a year (i work next to them :P). Not even close.<p>In some sense, talking about the engineering challenges makes no sense - they basically don&#x27;t matter to the overall cost at large scale.<p>These same things apply to most of the broader (in the sense of who it touches) pieces of developer infrastructure like programming languages, etc.<p>As you can also imagine, you can&#x27;t stand still, and so you will pay costs here, and need to be able to amortize these costs over the longer term. In turn, this means you have to plan much longer term, because you want to pay these costs over a 5-10 year scale, not a 1 year scale.<p>[1] It also excludes the net benefits, but you still pay the costs in actual time even if you get the benefits in actual time as well :)<p>Also, productivity benefits from new developer infrastructure are wildly overestimated in practice. Studies I&#x27;ve seen basically show people perceive a lot of benefit that either doesn&#x27;t pan out or doesn&#x27;t translate into real time saved. So at best you may get happiness, which while great, doesn&#x27;t pay down your cost <i>here</i> ;)
评论 #18856754 未加载
评论 #18856591 未加载
评论 #18856611 未加载
SideburnsOfDoomover 6 years ago
This can&#x27;t really be discussed without also clarifying how your target language and tools ecosystem does package management. i.e. are you expecting to generate and version internal packages and then consume them from a feed?<p>It seems like, if you don&#x27;t have this facility then the monorepo becomes more compelling.<p>Not to mention, are you building 1 or 2 apps, or a whole host of microservices.<p>Without knowing that, your experience of mono vs. multi-repos won&#x27;t be much use.
pm90over 6 years ago
I have a simple question: are monorepos possible in git? What is the upper limit of contributions per day for git to be effective in a monorepo?
评论 #18856041 未加载
lmmover 6 years ago
&gt; Looking at it from the other side, could introducing strict borders somehow make it easier to reuse logic? I think it&#x27;s clear that borders can only take away from your ability to perceive opportunities to use abstractions or to unify code.<p>This is not at all clear. I&#x27;d argue that a visible organization of your codebase into repositories makes it easier to reuse code in the same way that interface&#x2F;implementation splits do: it makes it clearer which parts felt domain-specific and which felt like reusable libraries.<p>&gt; The bottom line is that you should pick the right abstraction and the right place for a function or class based on the individual merits of the case - and not driven by facts about repos created a long time ago.<p>This seems to be assuming that repository boundaries are defined in the beginning and fixed for all time - the same mistake I see opponents of static typing making. Your repository structure reflects your logic and business structure; as those change you change your code structure to match.<p>&gt; True, touching multiple subprojects in a single commit is not always desirable. For example, updating backend and frontend components incrementally in backward-compatible ways can be the better approach. But even so, it&#x27;s useful to retain the option of cross-boundary commits for many reasons including simplicity and enforced coordination.<p>This needs to be justified. In much of programming we consider the benefits of strict isolation to outweigh the costs - e.g. private fields in OO languages, true parametric polymorphism, microservices. You can&#x27;t just assert that having the option of bypassing the good practice is worthwhile.<p>&gt; If you think about it, splitting a codebase into sub-repos is a ham-fisted way to enforce ownership boundaries. Developers are not arguing children that need to be confined to separate rooms to prevent fights. With sufficient communication and good practices, a monorepo will allow you to avoid the question “which repo does this piece of code belong to?” Instead of thinking about repo boundaries - effectively a distraction - a monorepo allows you to focus on the important question: where should we draw the boundaries between modules to keep the code maintainable, understandable and malleable in the light of changing requirements?<p>Communication and good practice are the most costly way to enforce important things; you could equally well argue that e.g. unit tests are a ham-fisted way to enforce non-breaking of code and developers are not arguing children that need to be reminded not to break each other&#x27;s functionality.<p>Repo boundaries are higher-level than directory boundaries. No-one is arguing for having each directory in its own repo, but being able to represent &quot;not directly involved, but versioned together&quot; and &quot;separate enough to be versioned separately&quot; is a very valuable distinction to have in your toolbox.<p>&gt; Many of us, especially in the world of startups, work in smaller teams - let&#x27;s say less than 100 developers.<p>Do you find it practical to communicate and co-ordinate with 100 other developers before making any changes? Because that&#x27;s the only case where a single repo makes sense - when you are working closely enough with every other developer sharing the repository that you don&#x27;t need to go to any extra effort to organize who is changing what.<p>Once you&#x27;re not attending the same standup, you shouldn&#x27;t be working on the same repository. You need to have a release cycle with semVer etc. so that people who aren&#x27;t in close communication with you can understand the impact of changes to your code area. Since tags are repository-global, the repository should be the unit of versioning&#x2F;releasing.
评论 #18860159 未加载
chrismathesonover 6 years ago
Glad you wrote this and saved me the effort, pretty much what I was thinking of jotting down