Similar to Microsoft or Google, the social media operator Facebook maintains its source code in a single source for all projects – a so-called mono repository. However, due to the huge amount of source code, this leads to various performance problems, which the team circumvents by using the Btrfs file system, among other things. The Btrfs developer Josef Bacik reported in a lecture, which the magazine LWN.net summarizes.
Accordingly, code must not be entered directly into the repository. Rather, a series of automated tests must first be run, for which the source code must also be cloned for the test system. However, this process was so slow that the responsible team looked for alternatives and therefore tried Btrfs, said Bacik.
So instead of cloning the repository with all of its files, just take a Btrfs snapshot. The special properties of the modern file system therefore make it possible to do without actually creating many existing files in a new location. The snapshot is basically just a virtual copy that points to the actual files. According to Bacik, creating and deleting the code repository for the tests can be carried out with almost no delays.
This approach is interesting in view of the companies mentioned at the beginning, who were faced with similar problems. For example, Microsoft also uses functions of a virtual file system to speed up the clone process, but does not actually have to copy the entire source code every time. A similar procedure, as now reported by Facebook.
Facebook also uses the Btrfs Linux file system intensively for its own container system, with which updates to the various services of the provider can be carried out very quickly. The company calls the technology Tupperware and introduced it several years ago.