Our Mastodon Clone

We rebuilt the Mastodon backend from scratch and made it able to handle Twitter-scale (500M users, 20M writes/second, unbalanced social graph, etc.). Our implementation is only 10k lines of code and is also significantly simpler than the existing Mastodon implementation. Our clone is running at mastodon.redplanetlabs.com.

Code

Twitter's original consumer product is comparable to Mastodon today. It has a similar feature set and similar technical challenges. To reach scale, Twitter had to write about 1M lines of code, much of which was a lot of specialized infrastructure built from scratch.

Twitter
1.000.000 lines of code
Mastodon
10.000 lines of code

Total engineering hours

Besides writing product code, Twitter spent a significant amount of time on other tasks involved in the productionization of their product. This includes deployment, monitoring, and other operational work, all of which significantly added to the total hours spent getting Twitter to production. Because Rama simplifies backend development so much, we saw major cost savings not just in coding the product but in these other areas as well.

Twitter
200 person years
Mastodon
3/4 person year

Performance

Rama's integrated nature enables our Mastodon instance to have performance even better than Twitter. Below are charts demonstrating its performance on three of the most important metrics for the product: scalability, the time from posting a status to it being available on follower timelines, and the time to render a home timeline.

Mastodon

MASTODON CLONE OPEN-SOURCE

Go to GitHub repository
Scaling Mastodon

How we reduced the cost of building Twitter at Twitter-scale by 100x

Twitter's original consumer product cost 1M lines of code and 200 person-years to build. Read about how we rewrote Mastodon, a similar product to Twitter, to be fully scalable in only 10k lines of code and nine person-months of time.

Read More
planet
planet