Facebook created an alternative to Git – Who would use Sapling? – Software Craftsmanship Weekly #112

In the previous edition, drama chased drama, so today’s topics are more heavily “engineering ones”: The new version control system from Facebook and the scaling of Mastodon. In addition, there will also be an unexpected (?) move by Apple.

Article cover

1. Facebook creates an alternative to Git

For years, Facebook was known for being one of the biggest promoters of its alternative, Mercurial, in a world dominated by Git. The argument for using this particular version control system was one – according to the company, it worked much better for Monorepo.

If only to avoid such situations

However, when you’re that Facebook, “much better” further down the road may not be good enough. That’s why the company has been working at creating its own – this time Git-compatible – version control system called Sapling for more than a decade, and finally they decided to share it with the world.

Why is Meta creating its own solution? Because it turns out that even the aforementioned Mercurial began to reach its limits at some point. As it is an open-source project, Facebook began to evolve it in its own fashion. Still, the moment they started working on it, it gradually moved more and more away from the “mothership” in favor of something basically wholly new. First of all, since it is Git that is best known to developers and widespread in the community, they decided to go in the direction of maximum compatibility with it. At the same time – all the while maintaining a high level of scalability – it was decided to solve several problems with Git’s user experience. For example, let’s take as an example the intelligent way of browsing the history tree:

There are quite a few such smaller and larger UX add-ons. For example, Sapling has commands to create CodeReview-first code – shared in such a way that the developer is quickly able to get feedback on a particular slice of work, without throwing the reviewer off with redundant details.

And if you like tooling internals, the article devotes a lot of space to scalability and the challenges that Sapling’s developers had to overcome. So you can learn how they approach the topic of “lazy” downloading of codebase fragments, history searching, or storing large files. It turns out, for example, that the tool’s purpose was created…. virtual file system. This shows how advanced the project is and how widely engineers have approached the problem space.

It will be interesting to see if this compatibility combined with scalability and the “Meta Engineering” stamp will make Sapling see a lot of market adoption. And now I treat Sapling premiere as an opportunity to remind you of the existence of the site, which helps you find your way around Monorepo practices and tools. It will guide you by the hand if you want to try this pattern.


Discover more IT content selected for you
In Vived, you will find articles handpicked by devs. Download the app and read the good stuff!

phone newsletter image

2. Tales from the battleground – how to scale Mastodon under the constant onslaught of new users

Mastodon, an alternative to Twitter (I promise this is the last time I used that name today), is definitely having its high time. Interest in the project has peaked, and tutorials on how to start using the whole thing (because it’s not that obvious at all) are being spit out like a machine gun. It turns out that the high entry threshold is not the only difficulty Mastodon has to face. With great interest comes the need to scale the infrastructure of individual servers. The Mastodon architecture seems to be not that well prepared for such a mean peak in popularity. At least in its default configuration.

Leonora Tindall recently shared her experience of troubleshooting the sudden surge of users, giving us an interesting insight into how Mastodon behaves under the hood and where the biggest bottlenecks appear in the system. The thing that first catches the newbie’s (like myself) attention is the fact that the whole thing is written in… Ruby. I used to have the pleasure of developing one application in this language, but I’ll admit that it’s becoming increasingly rare for me to come across any major “headlines” related to it – and here you go, Mastodon. Because of the language model, Ruby has never been one of the easiest languages to scale (for more details, I refer you to the text To Thread or Not to Thread: An In-Depth Look at Ruby’s Execution Models from Shopify), but one of the more popular solutions available on the market today is Sidekiq. This thread-based (rather than separate processes like most other Ruby web servers) also powers Mastodon. It turns out, however, that like any other technology, Sidekiq requires a good understanding of its model if you want to get into any bottlenecks.

Default admin response

This is why I recommend Leonora’s text. After all, thanks to the publication you can better understand how Sidekiq works and the challenges of using threads and connection pools in Ruby. Even if you don’t program in that language, knowing the concepts used in other ecosystems broadens your horizons and allows you to approach your own problems in a more out-of-the-box way. An additional flavor is that the text is about Mastodon, which is unlikely to be out of the headlines for a while yet. So if you’re curious about the underneath architecture of November 2022’s (and maybe all of 2022) hottest software, I invite you to read Scaling Mastodon in the Face of an Exodus.


3. Apple plans to move processor production to the US

And finally, let me conclude this heavily technical issue with a bit of less technical, but quite relevant information about the industry. 2022 will probably be remembered as a significant year in the process of deglobalization of the world. Time will tell whether at some point we will not return to the beaten path of international cooperation, but the decisions that are being made at the moment seem to be taking a completely different direction – a strongly isolationist one.

The U.S. administration, headed by the president, is aiming to encourage companies to produce chips on their soil – among other things through financial incentives – and they have just found a major ally. Apple, which has made no secret of the fact that it is looking for a way to reduce its dependence on manufacturing in an increasingly unpredictable Asia, has announced through the mouth of Tim Cook that as early as 2024 it plans to manufacture at least some of its processors in the US. While the exact suppliers were not specified, the reference is likely to be to a TSMC factory to be opened in Arizona.

And it’s clear who will be the first customer

I have two thoughts on the above situation. First, it is apparent that Taiwan’s status is at least precarious if the US initiative manages to draw companies as large as Apple into making a rather risky move. After all, the Chinese authorities have made no secret of their annoyance with the incentives the Joe Biden Administration is giving to TSMC, which could make it difficult for Apple to do business in China territory. The second – no less interesting – aspect is how much such a move will affect the price of end devices and whether a kind of “flag effect” will work here.

We will see whether consumers will be willing to pay more for “Made in USA” phones in this time of recession.


Discover more IT content selected for you
In Vived, you will find articles handpicked by devs. Download the app and read the good stuff!

phone newsletter image

Bonus: Windows Subsystem for Linux (WSL) gets rid of Beta label and hits Microsoft Store

Windows Subsystem for Linux 2 (WSL2) – a collaborative effort between Microsoft and Canonical, the compatibility layer between Linux and Windows that allows software from the former to run on the latter – was released back in 2019, but has remained in perpetual Preview for the past three years. Now, at long last (as you can see in the project’s repository) we’ve lived to see the first stable release, which is set to hit the Microsoft Store.

Interestingly, Microsoft hasn’t yet decided to make an official announcement, so for now, I’ll just chime in on the topic – if for some reason it pains you that this fantastic tool is not stable, I think you can expect significant announcements soon.