Scaling Mercurial at Facebook
I wrote a comment about the scaling of repositories (and specifically Facebook's issues) a few days ago that was wiped out by the HN crash, but I've managed to recover it from HNSearch:<p><i><old-comment></i>
Facebook's problem is that they were trying to scale with Git improperly. With conventional CVS[sic] systems like Perforce, you can scale a single repo nearly as large as any company will need. Emphasis on that nearly. At a certain point, with a large enough codebase (and, critically, enough throughput) you start to realize that you are about to hit a brick wall. With perforce, this starts to manifest with service brownouts.<p>With perforce, you can reasonably expect to run into this brick wall somewhere in the neighborhood of terabytes of metadata and dozens of transactions per second. That changes depending on what sort of beastly hardware you are willing to throw at your version control team.<p>Git of course hits a brick wall much sooner, somewhere around single-digit gigabytes of data (depending heavily on the average size of every object in the DAG), even ignoring throughput.<p>Perforce is probably good enough for Facebook in the present, but if you are a company that large and if you are forward looking, it becomes apparent that with existing version control technology, "one repo per company" is not a long term solution. Even "one repo per department".<p>You can split it even further, but what you realize is that you are developing infrastructure that allows you to use many repos (for instance your build servers and internal code search/browsing tools will now need to understand that concept) but you are losing many of the benefits of Perforce. While you are in the process of adapting your infrastructure to wrap its mind around many repositories, it makes sense to allow dev teams to really take advantage of this splitting. Develop infrastructure that allows Perforce and git repos to coexist in the company, allowing dev teams to spin up new git repos for their every project at will. Done properly, git allows you to create massively scalable systems that you can count on supporting your companies needs for the foreseeable future.<p>Smooth migration, migration that does not disrupt development, takes months (assuming the right initial conditions), so it is best to recognize the problem and start early, before service becomes disrupted.<p>If I understand Facebook's situation currently, they are still in the "try to make Mercurial scale" stage of denial, burning developer time and effort to push back that first brick wall (the same one that git hits, though mercurial hits it after git hits it but before perforce hits it...)<p>Here is a google presentation about extreme scaling with Perforce: <a href="http://www.perforce.com/sites/default/files/still-all-one-server-perforce-scale.pdf" rel="nofollow">http://www.perforce.com/sites/default/files/still-all-one-se...</a><p>An example of building multi-repo infrastructure for large projects with git is Android's repo: <a href="http://en.wikipedia.org/wiki/Repo_(script)" rel="nofollow">http://en.wikipedia.org/wiki/Repo_(script)</a> Repo is just one example though; other, better, solutions are very possible.<p><i></old-comment></i><p>I guess the TL;DR here is that I think it is great that Facebook is making a single Mercurial repository work for their purposes right now, but I think they are kidding themselves if they think that is a long term solution.  They are doing a pretty good job of making Mercurial scale like Perforce can scale, but that will only work for them for so long.<p>(In the above comment I talk about building a scalable system <i>with</i> git <i>("with" git, rather than making git itself scale)</i>, but the same can of course be done with mercurial instead of git.  I don't mean this to be a comment suggesting that they should use git instead of mercurial.)