18 ms·
We reduced the cost of building Mastodon at Twitter-scale by 100x
- jitl 3y agoThis architecture seems very similar to existing offerings in the "in-memory data grid" category, like Apache Ignite and Hazelcast. I'm more familiar with Ignite (I built a toy Notion backend with it over a few afternoons in 2020). The way Ignite works overall is similar. You make a cluster of JVM processes, your data partitioned and replicated across the cluster, and you upload some JARs of business logic to the cluster to do things. Your business logic can specify locality so it runs on the same nodes as the relevant data, which ideally makes things a lot faster compared to systems where you need to pull all your data across the wire from a DB. Like Rama, Ignite uses a Java API for everything, including serializing and storing plain 'ol java objects. Ignite's architecture isn't focused on "ETL" into "PStates". Instead it's more about distributed "caches" of data. It does have streaming for ingestion (https://ignite.apache.org/docs/latest/data-streaming https://ignite.apache.org/docs/latest/data-streaming), but you can transactionally update the datastore directly (https://ignite.apache.org/docs/latest/key-value-api/transactions https://ignite.apache.org/docs/latest/key-value-api/transact...). It also has a "continuous query" feature for those reactive queries to retrieve data (https://ignite.apache.org/docs/latest/key-value-api/continuous-queries https://ignite.apache.org/docs/latest/key-value-api/continuo...). Rama's data-structure oriented PState index seems easier to work with than building indexes yourself on top of Ignite's KV cache, but Ignite also offers an SQL language, so you can insert your data into the KV cache however, add some custom SQL functions, and then accept more flexible SQL querying of your data compared to the very purpose-built PCache things, but still be able to do lower-level or more performance-oriented logic with data locality. Anyways, if you like some of this stuff but want to use an existing, already battle-tested open source project, you can look for these "in-memory data grid", "distributed cache", kind of projects. There's a few more out there that have similar JVM cluster computing models.
- theptip 3y agoHazelcast has been on my list to explore for a while. Anyone have pointers to a good sample project / deep-dive in the same sort of spirit as the OP here? Also would love to hear folks’ thoughts on the sort of usecase where this data grid excels.
- stuaxo 3y agoLovely, I could see this paradigm spreading to other languages, something was definitely needed.
- Huhuhn 3y agoWould this framework also be useful for building a Lemmy instance?
- RomanPushkin 3y ago> ...10k lines of code. This is 100x less code than the ~1M lines Twitter I wish I didn't see this comparison, which is not fair at all. Everyone in their right mind understands that the number of features is much less, that's why you have 10k lines. Add large-scale distributed live video support at the top of that, and you won't get any close to 10k lines. It's only one of many many examples. I really wish you compare Mastodon to Twitter 0.1 and don't do false advertising > 100M bots posting 3,500 times per second... to demonstrate its scale I'm wondering why 100M bots post only 3500 times per second? Is it 3500 per second for each bot? Seems like it's not, since https termination will consume the most of resources in this case. So I'm afraid it's just not enough. When I worked in Statuspage, we had support of 50-100k requests per second, because this is how it works - you have spikes, and traffic which is not evenly distributed. TBH, if it's only 3500 per second total, then I have to admit it is not enough.
- nathanmarz 3y agoWe're comparing just to the original consumer product, which is about the same as Mastodon is today. That's why we said "original consumer product" and not "Twitter's current consumer product". Mastodon actually has more features than the original Twitter consumer product like hashtag follows, global timelines, and more sophisticated filtering/muting capabilities. Some people argue it's not so expensive to build a scalable Twitter with modern tools, which is why we also included the comparison against Threads. That's a very recent data point showing how ridiculously expensive it is to build applications like this, and they didn't even start from scratch as Instagram/Meta already had infrastructure powering similar products.
- ehutch79 3y agoAre you sure about that. With things like twitter, the ui is not the hard part. Things like moderation are the secret sauce. All the corner cases and support for devopsy stuff likely account for a lot. Routing to specific instances for celebrities and such.
- justrealist 3y ago
- kyle-rb 3y agoKinda disappointed by the simulation, where are all the viral posts? I've been digging around for a while and haven't found any posts with more than 20 faves. The accounts I've found with ~1 million followers have little to no engagement. I want to see how a post with a million faves holds up to the promises of "fast constant time". I'm especially curious about these queries — fave-count and has-user-faved — since a couple years ago Twitter stopped checking has-user-faved when rendering posts more than a month or so old, so I imagine it was expensive at scale.
- nathanmarz 3y agoThe load generator generates boosts/favorites for a subset of posts that are randomly picked to be "popular". However, since the rate of posts is so high even individual posts picked to be "popular" are only getting ~70 reactions. Tracking reactions is considerably easier than timeline fanout though, as a favorite does a small handful of things (updates set of users favoriting a status and sending a notification), while fanout has to do an operation on every follower (403 operations on average, sometimes up to 22M). The code getting the favorite count for a status looks like: .localSelect("$$statusIdToFavoriters", Path.key("*statusId").view(Ops.SIZE)).out("*numFavorites") Because the nested set is subindexed, that's an extremely fast operation (looking at our telemetry, about 0.05ms). Determining "has-user-faved" looks like: .localSelect("$$statusIdToFavoriters", Path.key("*statusId").view(Ops.CONTAINS, "*accountId")).out("\*hasFavorited") The API server doesn't do these queries individually, which would be two roundtrips. It does them together in a query topology along with fetching other needed information (like number of boosts, number of replies, "has boosted", "has muted this status", etc.).
- kyle-rb 3y agoThanks for the response, I'm still curious about the details of the subindexing and how that scales. I'll be keeping an eye out for the release!
- nathanmarz 3y agoA lot of detail on subindexing and everything else in Rama is coming next week when we release the docs.
- ltr_ 3y agoi always had this question: how realistically is to, having an standard spec and interoperable protocols, for toxic apps of big international tech companies that provides """services""", so instances of implementations can be maintained by municipalities or local tech business and talent with 100x less employees and money? what policies should be in place to achieve that? what would be the challenges? it would be better/healthier? is someone researching such things like transition to sustainable digital services? (sustainable in terms of local labor, privacy, economy, accountability, etc...) i mean if you think about this as public services not as a business, profit is secondary, and first is just to make the thing better and better for the users, no need for spying , no advertisement, no need for a rich piece of shit somewhere getting a piece of the money paid in your city for every taxi drive, food delivery or to give up privacy to a soulless/faceless entity just because you want to say something publicly or keep in touch with people. there is no disruption from their part, its just an old thing put on the internet, they are just in the middle of everyone's life, just sucking everything they can. is the actual state of affairs "efficient"? there must be fed up engineers and tech people everywhere with the sad state of IT industry.
- 5636588 3y agoThe EU already has regulations in place regarding open banking with its Payment Services Directive. I'd imagine a similar framework could be applied to big social tech.
- NoahTheDuke 3y agoCongrats! This looks super cool. Are there any plans for exposing a Clojure API? Given that it's implemented in Clojure, seems like it would be a natural fit. Interop with Java is nice but can be cumbersome compared to the more natural calling conventions and idioms (threading macros instead of `..` builder patterns, etc).
- nathanmarz 3y agoAnswered this in another comment: https://news.ycombinator.com/item?id=37138526 https://news.ycombinator.com/item?id=37138526
- NoahTheDuke 3y agoThanks.
- say_it_as_it_is 3y agoneed to port this to Go...
- endisneigh 3y agoI don’t really see the point of the comparison. They should show something you could only make with Rama or show how much faster it is to iterate with Rama. Saying this is 100 or even a million times cheaper is like saying taking a picture of Sistine chapel and printing out copies is a trillion times cheaper than making it originally. Many of us on this site could make a number of products very efficiently and cheaply given a static and fixed set of requirements as well as an existing implementation for reference. That being said it was a very detailed post, so kudos for that, but it’s far too vague to be actionable. Why not just release the code and post simultaneously instead of just bragging about how little code was required?
- dataangel 3y agoI do C++ backend work in a non-web industry and this entire post is Greek to me. Even though this is targeted at developers, you need a better pitch. I get "we did this 100x faster" but the obvious followup question is "how" but then the answer seems to be a ton of flow diagrams with way too many nodes that tell me approximately nothing and some handwaving about something called P-States that are basically defined to be entirely nebulous because they are any kind of data structure. I'm not saying there's nothing here, but I am adjacent to your core audience and I have no idea whether there is after reading your post. I think you are strongly assuming a shared basis where everybody has worked on the same kind of large scale web app before; I would find it much more useful to have an overview of, "This what you would usually do, here are the problems with it, here is what we do instead" with side by side code comparison of Rama vs what a newbie is likely to hack together with single instance postgres.
- ldayley 3y agoNathan Marz created Apache Storm, coauthored the book "Big Data", and founded an early real-time infrastructure team at Twitter. It's likely the 'curse of knowledge' of working on this specific problem for so long is responsible for the unique and/or unfamiliar style of communication here. EDIT: Specifics
- HaZeust 3y ago... Maybe the post isn't targeted to your audience at all? How is "C++" and "non-web work" adjacent to web work with web launguage audiences?
- slim 3y agohe's a developer and curious about the subject. Since it's a blog post, not a scientific paper, the fact that he did not understand could be a communication failure. I think he's being helpful
- rollcat 3y agoOP did not specify what their industry actually is. I've been doing "web work" for 17 years and I'm sharing their concern: where's the TL;DR for this? If this somehow can make me 100x as productive, how about starting with a "hello world" example that shows me how is it different from pip install django, etc?
- yayitswei 3y agoFor context, nathanmarz created what is now Apache Storm, which is used for stream processing at some of the world's largest companies, so he knows a thing or two about scale.
- FridgeSeal 3y agoSemi-related: Their homepage (https://redplanetlabs.com/ https://redplanetlabs.com/) has to be one of the best looking websites I’ve seen in a while, buttery smooth as well. I love it.
- alberth 3y agoIf you like the pretty static background look with light text, checkout https://carrd.co/ https://carrd.co/ It’s a website builder with lots of themes similar in design.
- itissid 3y agoTL;DR: Chat GPT summary of 5 "pages" of the thing: https://chat.openai.com/share/bd6eac38-5bac-4c6f-b405-7ca7d8a9213e https://chat.openai.com/share/bd6eac38-5bac-4c6f-b405-7ca7d8...
- chiefalchemist 3y ago"We stood on the shoulders of giants..." X years from now "We reduced the cost of building _____ at Mastodon-scale by 1000x". It's certainly interesting, certainly an accomplishment, but it's also the nature of the game. The present eating the past, to be eaten by the future. Rinse. Repeat.
- ThinkBeat 3y agoI am confused. This is meant to be hyped to sell your Rama platform/product/framework? That you have spent 10 years building in secret? During that time you have built a datastore and a Kafke competitor and ? Should not those 10 years be factored into the time it took to develop this technical demo? Is it 100x less code including every LOC in all of Rama? I mean I am sure you picked a use cast that is well suited to creating a Twitterish architecture implementation. If I went off and wrote a ThinkBeat platform for creating Twitterish systems and then created a Twitterish implementation on top if it, its real easy to reach low LOCs.
- nathanmarz 3y agoYour comment is addressed in another thread by other commenters: https://news.ycombinator.com/item?id=37137653 https://news.ycombinator.com/item?id=37137653
- softwaredoug 3y agoKind of reminds me of when FoundationDB came out, they really needed to demonstrate lots of different use cases to prove they were the database storage layer to rule them all... Not just one
- deleted 3y ago[deleted]
- primitivesuave 3y agoThe "N bots posting X times/second" isn't a very meaningful statistic. A system's reliability is mostly characterized by its performance under stress.
- miki123211 3y agoIs this just me, or does the code in the post feel like they've implemented what should have been a new programming language on top of Java? Their "variables" have names that you have to keep as Java strings and pass to random functions. If you want composable code, you don't declare a function, you call .macro(). For control flow and loops, you don't use if and for, but a weird abstraction of theirs. I feel like this code could have been a lot simpler if it was written in a specialized language (or a mainstream language with a specialized transpiler and/or Macro capabilities.) I'd quote the old adage about every big program containing a slow and buggy implementation of Common Lisp, but considering that this thing is written in Clojure, the authors have probably heard it before.
- nathanmarz 3y agoInternally there actually is a new programming language, implemented using Clojure macros (so it's also Clojure). The Java dataflow API is exposing a subset of that language. We did it this way rather than expose this new language directly because most people don't know Clojure and we don't feel it necessary or desirable to require people to have to learn a new language to benefit from this technology.
- doublepg23 3y agoHN seems to be putting you through the wringer, I for one am excited you guys made this and plan to open source it- it looks like a fantastic project.
- typon 3y agoWhy not? Incredible claims should have equal amount of scrutiny. I am glad that HN has a default skeptical bias - we don't want to be swept up in frenzies. If anything, HN is still relatively prone to these frenzies from time to time.
- nullspace 3y agoAdditionally to the “why not” sibling comment, I suspect nathanmarz can take it :). (Early Apache storm user here.) It takes strong conviction to work on something like this for a decade.
- DigitalSea 3y agoOne of these posts. Dig into the numbers and claims, and you'll see that they're not building something anywhere near Twitter scale.
- rugina 3y agoCan you implement a web shop like Amazon using Rama?
- jasonmp85 3y ago[dead]
- throwaway892238 3y agoAre people still thinking social media is a good thing? Hasn't every study showed that it's terrible for everybody?
- beders 3y agoThis is a lovely and very detailed showcase in how to combine streaming+ETL+materalized-view+query! That said: You need better advisors. Your investors and/or the board gave you bad advice on how to publish these accomplishments and talk about them. I hope your go-to-market strategy works out a little better. Hyperbole is fine, but at least on hacker news, the audience is a bit careful with regards to grandiose statements. What might work well on an investor presentation might backfire when you target engineers as audience.
- cduzz 3y agoI would hazard the guess that twitter's "show tweets to other people" is 1/40th of the functionality piled into twitter; some other large functions would be things like "track ad sales" or "improve engagement" or "allow random law enforcement organizations to engage in whatever access is needed for any particular part of the world" Each of those is going to be a huge pile of code and all of it working together is going to N! your complexity.
- reset2023 3y agoDon't worry, chatGPT will do the same think in 1000 lines
- freecodyx 3y agoLess code excluding dependencies
- crenwick 3y agoCongrats on the launch. Great read. Is there any rough infrastructure cost comparison? Excluding the cost of engineering effort, which I understand is the major pitch.
- elisbce 3y agoThe real reason why we can't easily replicate Twitter/Facebook/Google is because we don't have the distributed storage/caching/logging/data processing/serving/job scheduling/... infrastructures that they have built internally that are designed to provide some level of guaranteed SLAs for the desired scale, performance, reliability and flexibility, not because it is hard to replicate the application logic like posting to timelines. That's also why Threads were built by a small team rather quickly -- they already have the battle-tested infras that can scale. Any attempt to build a simplified version of the ecosystem will face the same fundamental distributed system tradeoffs like consistency/reliability/flexibility/... For example, one of the simplifications may be mixing storage/serving/ETL workloads on the same node. And the consequence is that without certain level of performance isolation, it could impact the serving latency during expensive ETL workload. For Rama to be adopted successfully, I think it is important to identify areas where it has the most strengths, and low LOCs might not be the only thing that matters. For example, demonstrating why it is much better/easier than setting up Kafka/Spark and a database and build a Twitter clone on top of that while providing similar/better performance/reliability/extensibility/maintainability/... is a much stronger argument.
- jonstewart 3y agoHow does Rama differ from Flink and timely-/differential-dataflow/Materialize? I see “microbatching” in the diagram and, maybe this isn’t a fair take, but it feels more 2013 than 2023.
- gexla 3y agoThis is fascinating, and I'm glad to have come across it. And your story is inspiring. Thank you! One question, why Google Groups rather than something like Discord? Not sure I would trust Google Groups to be around long.
- kitanata 3y ago[flagged]
- mlindner 3y agoBut it’s not at Twitter’s scale?
- nevi-me 3y agoIt sounds like the authors spent 10 years building a Twitter factory, and now they can produce a Twitter faster than Twitter could produce it "by hand".
- AnnoyedComment 3y ago[dead]
- donavanm 3y agoI appreciate the inversion/melding of the data model and compute. Im curious to know your perspective on two parts: How would multitenancy fit in to rama? Using your mastodon example, providing “hosted mastodon instances as a service”, where you _also_ allow for data governance, per customer encryption at rest, user IDP support, etc. Is it multiple single tenant rama deployments, running independent customers? Multitenant rama clusters with shared depos and each pstate includes “tenant id”? Something else? Second whats the product/business angle on customer confidence, technical novelty, and your business core competency? A dated example but Im thinking of somewhere like basho with riak. Super cool tool, takes some mental adjustment to “get”, challlenges selling hosting vs software vs pro services.
- nathanmarz 3y agoFor now it's going to be on-prem, so each user will just have their own cluster. Things like E2E encryption are pretty easy to implement on top of Rama's existing primitives (there was a good question about this on the rama-user group yesterday https://groups.google.com/u/1/g/rama-user/c/jj-ILcoMjtk https://groups.google.com/u/1/g/rama-user/c/jj-ILcoMjtk). We'll likely have a fully managed cloud version in the future. Riak was good technology at the time, but it was really hard to distinguish from other K/V databases and didn't really move the needle on core business metrics (like development cost). Rama dramatically changes the economics of building large-scale software. It will take awhile for many to grasp that, as is obvious from many of the comments here, but I expect that as more and more users have massive success with Rama, that understanding will come.
- leventov 3y agoThe big question is whether we really want more centralised cloud applications of this sort in the AI future, with its potentially exacerbated risks of data breaches, identity theft, spam, etc. Having a "Rama" for local-first, truly distributed (Solid Project style), self-sovereign-identity based apps would be differentially better probably.
- zubairq 3y agoAs someone who has worked in both startups and Enterprise IT for over 30 years (including large Java based systems) I see a use case for Rama in large companies who have a lot of difficulty glueing many different systems together to achieve scalability. So I think that Red Planet Labs could get several contracts in the 100k USD and over range in large Enterprises. This is for enterprises who have the problem of integrating many systems to achieve scalability and who are already large Java shops. However, I do not see Rama's initial market being startups, since they just want the simplest way possible to build UI + backend and want to iterate super fast with tech that their developers already know in the initial stages.
- runeks 3y ago> To demonstrate the scale of our instance, we’re also running 100M bot accounts which continuously post statuses (Mastodon’s analogue of a “tweet”), replies, boosts (“retweet”), and favorites. 3,500 statuses are posted per second, the average number of followers for each post is 403, and the largest account has over 22M followers. As a comparison, Twitter serves 7,000 tweets per second at 700 average fanout (according to the numbers I could find). Is Twitters 7k tweets per second the average? If so, what’s the peak rate, and have you tested your system under this load?
- alexcpn 3y agoWhy choose Java of all languages. Why not something more modern and less verbose like Go or Rust. Just asking as I have worked enough in Java and then spend a lot of time in GC tunining. Granted the code was not that great and from a diverse team with different skill levels causing all the leaks.. But still
- jillesvangurp 3y agoThey actually used clojure; which is an interesting choice. GC tuning on the JVM is much less of a topic these days than it used to be. The default garbage collector was changed at some point (G1). It has some configuration options but they come with sane defaults that mostly just work fine and adapt to your memory and cpus. You don't spend a lot (or any) time on tuning this typically. I know I haven't even looked at GC params in many years now. Never had to. And we run on modestly sized vms of 1 or 2 GB typically. This was different 10 or so years ago when G1 was still newish and not default. ZGC was introduced with Java 11 (I think), and aimed at very large heaps. It trades off additional overhead for guaranteeing very low latency. That tradeoff is why it is not default. For most users, G1 without any tuning whatsoever should be fine. Generally, if you are stressing your heap, you get more hardware. And if you are not, the GC should be keeping up just fine. Anyway, like it or not, the JVM has been a work horse for big data for ages. Things like Hadoop, Kafka, Cassandra, Elasticsearch, etc. all run on it and scale fine (and typically without a lot of GC tuning). The only feasible alternative to the jvm used to be things like C++. Lately, Go and Rust are pretty credible in this space as well and both have had to do a bit of catchup in terms of maturity of tooling, libraries, and language features. Things like generics (Go), async (Rust), etc. are still fairly recent additions and both kind of relevant in a project of this type. In any case, switching languages is hard for teams and these guys have been around for quite some time. When they started, Rust was a lot less mature than it is now and Go was still pretty new as well. Neither was an obvious choice for this stuff at the time.
- beefnugs 3y agoI think the marketing idea of this is amazing : I would probably never even consider learning and reading about such a framework if I heard of it straight up. But if you are really releasing a usable open source implementation of something performant that actually federates properly, that is a huge selling point that buys you a ton of respect up front.
- beefnugs 3y agowhoops nevermind "Once we open-source our Mastodon implementation in two weeks, you’ll be able to run it within a single process using this build." So no one will be able to run this except on the proprietary cloud
- RHSman2 3y agoEasy to copy something that has been done before and knowing what you want, need and responding to expected market traffic.
- runeks 3y agoSounds like Rama is also useful for small scale applications (where high scalability isn’t needed), since it simplifies how they’re implemented. Is this the case — ie. would a TodoMVC app implemented in Rama also be much simpler than a traditional frontend/backend/database CRUD implementation?
- runeks 3y agoSee https://news.ycombinator.com/item?id=37139410 https://news.ycombinator.com/item?id=37139410
- wink 3y agoLook, I don't want to defend Twitter but ignoring 15 years of changes and the whole journey of scaling and then using the cost op just building a snapshot of the 15y old version is pretty disingenuous. That's a bit like starting an Oracle clone now and summing up what they spent on developer salaries in the last 40 years. You basically can't not "reduce costs". And no "the original consumer product" is not a real cop-out, you probably still have tons of people building iterations.
- kennydude 3y agoYou didn't build Mastodon at Twitter-scale. You built a Mastodon-compatible clone in Spring/Reactor.
- mariusor 3y agoBut this is not a Mastodon instance. It's something else that maybe speaks the Mastodon API and/or ActivityPub, but we don't know since it doesn't really federate with anyone. I commend the effort to try to make happen a non-open fediverse service, but appropriating the Mastodon name is just wrong. You should know better.
- samsquire 3y agoThank you for sharing this! I am actually really impressed. Well done! Good work! There's lots of interesting lessons and knowledge in the design of this platform. I also like how you've decided to use Java as your API rather than Clojure. I hope you're not discouraged by HN's reaction to your hard work. Don't be discouraged!
- nathanmarz 3y agoThis isn't my first time releasing a big project, so I'm used to the HN knee-jerk reactions :) Thanks for the kind words.
- prepor 3y agoBased on what I read it's very similar to Kafka Streams + batteries ([semi]automatic workload orchestration, reactive queries, higher-level/slicker/"smarter" API (?)) Could you please compare Rama with Kafka Streams, especially from the point of view, if I would try to reimplement Rama API on top of Kafka Streams? What fundamental difficulties I'd face?
- ketang 3y agoIt's like Apache Camel if camels had 5 humps and 11 legs.
- jvans 3y agoI have often thought along similar lines, that the effort involved in building software seems to indicate a level of abstraction that is missing. The general theme of the comments seems roughly what you should expect from a very bold, paradigm shifting proposal. Good luck with your efforts and don't let this discourage you! I will make one minor suggestion that I hope is constructive. I found the post difficult to read, largely because you rapid fire introduce a bunch of completely new concepts and propose a solution to many problems at once. You make a passing comparison to "just event sourcing and materialized views", although this was the easiest way for me to understand what you are doing. Starting from event sourcing and materialized views puts the reader on a ground they already understand, and moving on from there to why rama is better/what it adds on top, would be an easier transition.
- nathanmarz 3y agoThanks for the feedback. The post is meant to give a taste of Rama by showing what it can do for building a full application end-to-end. Next week, we'll be releasing a set of guides, tutorials, and documentation which introduces the concepts in a much gentler way. We'll also be releasing a build of Rama that you can download to try Rama out yourself, and an open-source repository of example code from the documentation.
- elwell 3y agoNo Clojure? EDIT: Oh, I see in comments: "The customer API in Java, and the implementation of that API is in Clojure"
- romgrk 3y agoReally nice ideas here. The crucial advantage is having the storage+computation run as close as possible, which is a big advantage over a regular DB+app backend. But I won't ever consider investing in it unless it's some form of open-source. It's too much of a risk to have a closed-source core.
- Ramonatiny5 3y ago[flagged]
- deleted 3y ago[deleted]
- Ryan_HD 3y agoAnother try of Event Sourcing + CQRS. I thought it was great but after so many years it's still out of main stream. Lack of an integrated platform may contribute to, but can't explain everything. I guess most people can't accept things which is fundamentally harder in such architecture than normal ones.
- debadyutirc 3y agoThis is very interesting. I saw the Twitter post first and the blog next. The premise is compelling but it's been a promise made to the data and software world for decades together. The architecture and the core primitives are something that we agree with a lot. Use cases and business value are a whole different ballgame. We have invested the past 5 years at InfinyOn building Fluvio our open source rust implementation of core event streaming primitives which is implementing this architecture to orchestrate data as efficiently as computationally possible today. I am happy to see this project as an effort in the same direction.
- NoraCodes 3y agoI would argue that this is not "a Mastodon instance", since it is not running Mastodon - other than that, very very neat work! I'm excited for that "Source Code" link to be live :)
- ollien 3y agoYeah, I think this is just an ActivityPub server that supports the Mastodon extensions, right? I think we should embrace the fact that the federated world can be diverse, rather than just call everything "Mastodon"
- jauntywundrkind 3y agoMastodon has it's own API. It basically offers a very limited ActivityPub API too, but it's own API is very different. And it's a very slim ActivityPub inplementation. For example, I don't think you can do basic things like get an individual post in ActivityPub. This should be easy simple json-ld to get but it's just 404. https://www.w3.org/TR/activitypub/#retrieving-objects https://www.w3.org/TR/activitypub/#retrieving-objects
- colatkinson 3y agoMastodon for sure supports fetching individual posts over ActivityPub. For example: curl -L -H 'accept: application/activity+json' 'https://mastodon.social/users/Gargron/statuses/18614983' It does have a bunch of stuff that isn't federated though, such as Like counts/collections. And of course it only implements the server-to-server (S2S) part of AP, not the client-to-server (C2S) part.
- pmlnr 3y agoMastodon. o. not a.
- rvnx 3y agoI think it's smart from a legal perspective, because the team members seem to partially be coming from companies acquired by Twitter. So I guess, if you say "it's a Mastodon-clone", you cannot be accused of taking proprietary ideas from Twitter (this is just a guess, they know better). But technically very interesting and refreshing to see. I really like their approach. It feels they are innovative.
- deleted 3y ago[deleted]
- riffic 3y agothe group involved here may want to be mindful of the Mastodon gGmbH trademarks. Using the Mastodon logo on redplanetlabs.com to pitch a reimplementation of ActivityPub might be seen as infringing. https://joinmastodon.org/trademark https://joinmastodon.org/trademark removed part about the mastodon subreddit since this is clearly not about the Mastodon software per se.
- hedora 3y agoAny trademark case is going to have to prove that a reasonable person would think this article is from Mastodon gGmbH, or is talking about their product "Mastodon". The top of the page reads "Red Planet Labs", the title of the article is "How we reduced the cost of building Twitter at Twitter-scale by 100x" and the first line of the article is "We built a Twitter-scale Mastodon instance from scratch in only 10k lines of code." No reasonable person is going to think that this article has anything to do with the official Mastodon software, so there's no trademark issue here.
- riffic 3y agothere's this though: https://mastodon.redplanetlabs.com/timeline/local https://mastodon.redplanetlabs.com/timeline/local and this from the gGmbH trademark policy: > You may not use the Mastodon word mark, or any similar mark, in your domain name, unless you have written permission from Mastodon gGmbH.
- hedora 3y agoTrademark law doesn’t work like that. You don’t get to license your trademark in the same way you get to license copyrighted works. Otherwise, people could just say you can’t use their trademark in any document that says something negative about them, and then successfully sue the press and angry customers for complaining about them.
- riffic 3y agoThe WordPress Foundation has the same restrictions concerning use of their trademark as part of a domain name: https://wordpressfoundation.org/trademark-policy/ https://wordpressfoundation.org/trademark-policy/
- ceejayoz 3y agoHeadline: "building Twitter at Twitter-scale" Article: "building Mastodon at sub-Twitter-scale"
- hinkley 3y agoWe have twitter at home!
- dang 3y agoThank - I've changed the title to be consistent with what the article says.
- messe 3y agoMinor gripe, but there's a misspelling in the title: it should read Mastodon not Mastadon.
- dang 3y agoOops! Fixed now. Thanks to you, Fabricio20, and riffic.
- Fabricio20 3y agoHey dang, I think you have a typo in the title.. says Mastadon instead of Mastodon!
- riffic 3y agomasto not masta
- Kiro 3y agoThat's not the title of the article and also not what the article says. I would be really pissed if you editorialized the title of my article like that.
- dang 3y agoI'm happy to correct it if anyone suggests a better one. The intention is to find a neutral title that accurately reflects what the article itself is saying. We've learned that when an article's original title generates complaints like https://news.ycombinator.com/item?id=37137317 https://news.ycombinator.com/item?id=37137317, the thread is likely to get derailed by shallow arguing about the title. It's in both the author's interest and the community's for us to nip that in the bud by (1) putting an accurate and neutral title at the top (preferably using representative language from the article itself), and (2) marking the title complaint offtopic since it no longer applies. These steps nudge the thread toward discussing the article's content rather than merely its title.
- deleted 3y ago[deleted]
- sharms 3y agoThe performance on the example Mastodon instance is very responsive - almost anywhere I clicked loaded nearly instantly. I created an account and the only thing I found missing was it doesn't implement full text search unless my user was tagged, but that might be a Mastodon specific item. I think they have thought a lot about typical hard problems, such as having the timeline processing happen along side the pipeline, taking network / storage etc out of the picture. Nice work!
- nathanmarz 3y agoThat is indeed an intentional part of Mastodon's design, which we tried to be faithful to as much as possible. We originally implemented search across all statuses and had to reimplement it when we realized Mastodon is a little different.
- sitzkrieg 3y agodid you ever consider starting from something already technically performant like pleroma or misskey?
- nathanmarz 3y agoWell, we didn't start from anything as we implemented this completely from scratch. I believe Mastodon is much more widely used than those so it seemed like a better target for this.
- deleted 3y ago[deleted]
- sitzkrieg 3y agoyea i misspoke, good distinction lol. certainly makes sense, thanks
- whateverman23 3y agoctrl+f "ads" ctrl+f "monetization" ctrl+f "moderation" ctrl+f "existing infrastructure" ctrl+f "personalization" etc etc Yeah about what I expect from a "we rebuilt twitter for cheap" post. There's no point to the comparisons with the Twitter codebase size/cost. It completely distracts from what is probably a perfectly fine project.
- jscottmiller 3y agoThat's a fair criticism - this isn't an apples-to-apples comparison. What I find interesting about this is the cost of running the service. Being able to run a twitter-like thing on a hundred or so large aws instances is neat and I'm sure that many folks here dream of that kind of efficiency at their day jobs, but I'm more excited about how this scales down. Can you run a community of a thousand or so posters on a micro or nano instance for a few bucks a month or less? At that scale and cost, donations should easily be able to cover hosting fees and you would surely be able to deputize enough mods to keep things civil (for whatever definition of civil your instance lands on). Ads, monetization, personalization are non-issues (well, not major issues) at that scale.
- 10000truths 3y agoThe point is that much of that should be unnecessary to sustain the service because hosting costs are significantly (presumably 100x) cheaper.
- hobofan 3y agoThey never claimed that hosting costs would be 100x cheaper, and given what they show with amount of machines in the scaling chart, I doubt it is. It's a JVM application with all state duplicated N times, so at least on the memory side it's likely going to be a resource hog.
- raverbashing 3y agoThey deserve congrats for that since they built the load test to prove this Of course, for actual production use, there's probably a lot of things still, but this is a very nice works nonetheless
- nathanmarz 3y agoI wouldn't call our instance a load test, as it's a legitimate instance available for anyone to use. It's very much production-grade.
- mdaniel 3y agoI would not want to speak for raverbashing but I feel the same way: I actually can't tell if the bug is with soapbox or with your instance but clicking on the first link from your post practically locks up my browser due to every single Toot getting swapped out "at twitter scale" If one clicks quick enough to jump to an actual post, it seems relatively static so it's hard to tell if the bots are deleting and recreating their posts or what. In true Xitter clone fashion, trying to view the Posts & replies from any one user is "sign in Anyway, all of this is not to detract from your framework announcement as much as to have you consider that it's perfectly fine to label that instance as a load test, that's a fine thing, but calling it a legitimate instance seems to be a potential source of confusion
- nathanmarz 3y agoWe did notice on a less powerful machines the browser getting overwhelmed with the rate of new content (even though we're only streaming 10/s instead of the full 3.5k/s actually happening on the backend). I don't know if the poor performance in this context is due to Soapbox, the browser, or just the hardware. To get a better feeling of Rama's performance on your hardware, I suggest registering an account which will allow you to poke around the whole platform. It takes just a couple seconds to register and we don't send any emails.
- deleted 3y ago[deleted]
- LeifCarrotson 3y ago> How is it possible that we’ve reduced the cost of building scalable applications by multiple orders of magnitude? > You can begin to understand this by starting with a simple observation: you can describe Mastodon (or Twitter, Reddit, Slack, Gmail, Uber, etc.) in total detail in a matter of hours. It has profiles, follows, timelines, statuses, replies, boosts, hashtags, search, follow suggestions, and so on. It doesn’t take that long to describe all the actions you can take on Mastodon and what those actions do. So the real question you should be asking is: given that software is entirely abstraction and automation, why does it take so long to build something you can describe in hours? > At its core Rama is a coherent set of abstractions... This conclusion is alarming to read from a company that's trying to sell a new platform. The vast majority of the work in building Twitter or Reddit is not about building a coherent set of abstractions, it's working with an often incoherent reality, dealing with a myriad of laws that describe, as if your web app were a human clerk at a post office, how to handle PII and credit cards and CSAM filters and audits and copyright claims and on and on... I'm honestly shocked that the technical implementation of a simplified, coherent platform took a full 9 person-months. That shouldn't be the hard part. What I'd want to know as a prospective customer is how you handle exceptions to your beautiful, idealized architecture, when some foreign country requires that you only store comments posted by their citizens within their borders or something like that.
- amendegree 3y ago~~full text search doesn't appear to work... so it's possible they punted on one of the harder parts, which is fast efficient accurate fuzzy search, which moderation and a lot of those other harder things rely on.~~ eta: they say that had it but removed it because apparently it's not something mastodon supports. so I guess it is a pretty good high level implementation.
- ciconia 3y ago> I'm honestly shocked that the technical implementation of a simplified, coherent platform took a full 9 person-months. To be fair they developed this whole new platform to build this app with. I guess that's where the effort went.
- _dwt 3y agoHmmm, "Rama is programmed entirely with a Java API – no custom languages or DSLs" according to the landing page, but this sure looks like an embedded DSL for dataflow graphs to me - Expr and Ops everywhere. Odd angle to take.
- nathanmarz 3y agoI consider "DSL" as something that's its own language with it's own lexer and parser, like SQL. The Rama API is just Java – classes, interfaces, methods, etc. Everything you do in Rama, from defining indexes, performing queries, or writing dataflow ETLs, is done in Java.
- chc4 3y agoThis is usually referred to as an "embedded DSL" - you have a DSL embedded in a normal programming language using its first class constructs.
- runeks 3y agoMeh. By this definition all libraries expose an "embedded DSL" — their API. I'm honestly not sure this is a useful definition.
- jillesvangurp 3y agoWhether you like it or not; internal DSLs became a thing with Ruby back in the day. And these days things like Kotlin also lend themselves pretty well to creating internal DSLs. Java is not ideal for this. Kotlin and Ruby have a few syntax features that make it very easy.
- runeks 3y agoWhat's the distinguishing difference between a regular library and an embedded DSL?
- trollied 3y ago> We spent nine person-months building our scalable Mastodon instance. + the time spent creating Rama, the platform that enables it. Very dishonest leaving that out.
- nathanmarz 3y agoYou're missing the point. Rama is a generic platform that provides a new baseline for how expensive it is to build applications at scale. There's nothing about Rama specific to social networks. What we're showing is that Rama creates a new era in software engineering where the cost of building applications at scale is radically reduced. With Rama, anyone embarking on a new application today has a radically different economic outlook for the end-to-end cost of developing that application from prototype through large scale.
- yid 3y ago> What we're showing is that Rama creates a new era in software engineering where the cost of building applications at scale is radically reduced. Bold of you to come to HN with the breathless hyperbolic marketing fluff that may work on Twitter...
- nathanmarz 3y agoI think we provided a ton of substance backing up that claim, and we will provide even more next week when we release the build of Rama that anyone can use and its corresponding 100k words of documentation.
- 3cats-in-a-coat 3y agoIf I grasp the essence of Rama: - "Depots" are event streams (for event sourced data repositories) - ETL read one or more streams and project them to indexable read models... - Which read models are called "PStates" and represent nested combinations of indices like hashtables, b-trees, linked lists and so on. The point of those being they have the data in fast to query way. - And you have query engine which splits a query into 1+ index sub-queries and then aggregates. Am I missing something, this seems relatively standard event-sourced / CQRS-like architecture, but streamlined to avoid redundancy and reimplementation of common abstractions. It would've helped if the terms were less obscure than "depots" and "PStates".
- boredumb 3y agoneat read but I was expecting to read about twitter migrating and literally 100x savings being had.
- dunk010 3y agoYou never know.
- duped 3y agoThis is what they've been hyping on Twitter for a week? FWIW, why hype at all? Why "We'll more in a week. Then more in two weeks." Show the code today!
- newaccount74 3y agoConsidering the length and amount of detail in this blog post, I understand why they would need another week to get the code ready (assuming there will be more docs)
- nathanmarz 3y agoWe're releasing 100k words of high-quality documentation next week.
- dbish 3y agoMeasuring words and loc is not a great way, imho, to share what you’re doing. In fact, I’d love a much shorter set of documentation now to under and this better. Long docs will probably make it less likely to read.
- MisterBastahrd 3y agoWhat one finds useful from a web application and what the web application actually is are usually two entirely different things. I work in marketing automation, and I guess I have in one way or another my entire career. The clients who need to use the platform to communicate with their own clients over social networking may never touch our print delivery system, but that doesn't mean that print delivery doesn't exist or isn't important. If you are unwilling to recreate the totality of the application in terms of functionality, then you are lying if you say that you have recreated it.
- nathanmarz 3y agoNot sure what you're talking about as we implemented the entirety of Mastodon from scratch.
- Pxtl 3y agoI've seen many people describe frameworks like this - you know, first you have the slow back-end event-driven master database that you don't query live against, then you've got eventual-consistency flows against the various data-warehouses and data-stores and partitioned sharded databases in useful query-friendly layouts that you actually read live from... and I never see it clearly explained: how do you read a change back to the user literally just after they made the change? How do you say "other views eventual-consistency is fine but for this view of this bit of info we need it updated now". This write-up is very detailed but I couldn't find that explanation.
- chubot 3y agoYeah definitely, these ideas always sound very appealing to me, in theory -- I almost wonder why nobody has built it before e.g. they mention "event sourcing" and "materialized views" in the post -- sounds good But I thought I heard from a few people who were like "we ripped event sourcing" out of our codebase and so forth And yeah your question is an obvious good one, and the Reddit answer of "write through cache" ... is less than satisfying to me I FREQUENTLY have the problem where I reload the page and Reddit shows me stale data. It's SUPER buggy. --- Anyway I definitely look forward to hearing people try this and what their longer term impressions are ! I basically want to know what the tradeoffs are -- it sounds good, but there are always tradeoffs So is the tradeoff "eventual consistency" ? What are the other tradeoffs?
- chubot 3y agoHilariously, I went to edit the above comment, and HN was overloaded. Then it served me three or four 500's, AND it served me stale data in between I was pissed off that I would have to type my comment again, but actually it did save it, and refreshing worked. From what I understand Hacker News is architected more in-memory, on one big box ... Perhaps similar to the event sourcing model (not knocking hacker news -- it's generally a very fast site, MUCH better than Reddit. Just that scaling beyond a single machine is difficult and full of gotchas )
- 3y ago
- phillipcarter 3y agoIn the year of our lord 2023, people are still launching immature products with "we built a clone of a tiny subset of Twitter" as their use case? Come on. Twitter is huge because they have to support a huge number of use cases. Using this proprietary framework won't magically make complex use cases go away.
- DoesntMatter22 3y ago"We recreated a service from 2007 and it's so much faster!"
- nathanmarz 3y agoAs we mentioned in the article, Instagram just spent ~25 person-years building Threads which is a barebones clone of Twitter. Not only did we build our instance 30x faster than that, we have way more features like federation, hashtag follows, polls, DMs, global timelines, and more. And Instagram didn't start from scratch as Instagram/Meta already had infrastructure powering similar products. https://www.washingtonpost.com/technology/2023/07/29/meta-threads-mark-zuckerberg-rival-twitter-musk/ https://www.washingtonpost.com/technology/2023/07/29/meta-th...
- DoesntMatter22 3y agoYou said this in another post. > That's why we're comparing it to the cost of Twitter's original consumer product. Plus, you cloned a preexisting architecture. FB wrote theirs from scratch. Not apples to apples. This is much easier.
- deleted 3y ago[deleted]
- sixo 3y agoThe comparisons to Twitter are completely goofy, but the architecture is nothing short of enlightened. Nice work.
- softwaredoug 3y agoIt’s a massive ask, even if the platform was 100x better, for all developers to give up every programming language and database they’ve ever used to depend on a startups closed source platform for all functionality. It’s hard enough trusting Google or Amazons cloud offerings won’t change. It seems that’s what they’re proposing right? What am I missing?
- nathanmarz 3y agoWe're actually not asking anyone to give up anything. First off, it has a simple integration API (which you'll be able to see the details of next week) that allows it to seamlessly integrate with any other backend tool (databases, monitoring systems, queues, etc.). So Rama can be incrementally introduced into any existing architecture. Second, Rama has a pure Java API and is not a bespoke language. So no new language needs to be learned.
- kpw94 3y ago> Rama can be incrementally introduced into any existing architecture Big if true (and if the opposite, of incrementally removing it also works). There have been similar platform efforts in past, such as https://news.ycombinator.com/item?id=20985429 https://news.ycombinator.com/item?id=20985429 . For that one, the "massive ask to give up every programming language and database they’ve ever used to depend on a startups closed source platform" seems like the biggest hindrance to adoption.
- softwaredoug 3y agoI can imagine this being really useful from the ground up. Because it looks like it wants to be the source of truth, with different views on the data. It’s hard to imagine it for a complex legacy application without having lots of added complexity. It wants to be the unifying programming model for the application. It would seem like running with two RDMS sources of truth simultaneously. It’s like the xkcd “there are 12 ways of doing X, let’s create a standard to unify them” now there are 13 ways
- 3y ago
- throwaway7382 3y agoTheir big reveal after 10 years is "keep waiting". Move along, nothing to see here.
- frandroid 3y agoIf you're going to bother creating a throwaway, you should make a more impactful/meaningful statement...
- sandGorgon 3y agonice! is this is cloudflare worker & block storage built in Java ?
- dustingetz 3y agoSummarizing, now edited down with some editorializing for clarity: What is it? build web-scale reactive backends with an expressive java dataflow API. Instead of a database you develop your own custom app-specific indexes which are reactive, distributed and durable. It's like event sourcing and materialized views but integrated in a linearly scalable way. > I cannot emphasize enough how much interacting with indexes as regular data structures instead of magical “data models” liberates backend programming > It allows for true incremental reactivity from the backend up through the frontend. ... enable UI frameworks to be fully incremental instead of doing expensive diffs to find out what changed. Ok, so in my mind I am positioning this against Materialized / differential dataflow, whose key primitive is a efficient streaming incremental join that works across very large relational tables. Materialized makes SQL reactive, Rama gives you a java dataflow DSL for developing purpose-built reactive database indexes. How it works? 4 concepts: Depot, ETLs, PState, Query Depots: "distributed, durable, and replicated logs of data." [Event streams?] "like Kafka except integrated" "All data coming into Rama comes in through depot appends." ETLs: data arrives via depots, and is ETLed to PStates via "a Java dataflow API for coding topologies that is extremely expressive". "Most of the time spent programming Rama is spent making ETLs." PStates seem like reactive data structures that are also durable/replicated, these are meant to supersede your database and indexes, letting you build custom purpose-built indexes that contain 100M elements: > “partitioned states” are how data is indexed in Rama ... Unlike existing databases, which have rigid indexing models (e.g. “key-value”, “relational”, “column-oriented”, “document”, “graph”, etc.), PStates have a flexible indexing model. In fact, they have an indexing model already familiar to every programmer: data structures. A PState is an arbitrary combination of data structures. ... nested data structures can efficiently contain hundreds of millions of elements. For example, a “map of maps” is equivalent to a “document database”, and a “map of subindexed sorted maps” is equivalent to a “column-oriented database”. Any [composition] is valid – e.g. you can have a “map of lists of subindexed maps of lists of subindexed sets”. Query: once you develop PStates to aggregate relevant data into a custom index of the right ... shape?, query seems sorta like GraphQL selectors over your custom index: > Queries in Rama take advantage of the data structure orientation of PStates with a “path-based” API that allows you to concisely fetch and aggregate data from a single partition > “query topologies” ... real-time distributed querying and aggregation over an arbitrary collection of PStates. These are the analogue of “predefined queries” in traditional databases, except programmed via the same Java API as used to program ETLs and far more capable.
- skybrian 3y agoIt sounds like interesting technology for someone, but I wonder more about scaling down. What does a developer instance running on a laptop look like?
- nathanmarz 3y agoGreat question. There's actually two ways to look at this: what does it look like to run Rama in a unit test environment, and what does it look like to run a small-scale single-node Rama application in production? For the former, Rama has a class called "InProcessCluster" that works identically to a real cluster. It enables Rama applications to be tested and experimented with end-to-end. There's an example of this in the post and this is what we're releasing next week. For the latter, Rama can be run on a single node with each daemon and module being a separate process. We made it really easy to launch single-node Rama instances with just a couple commands with the "rama" script that comes with the release. That said, we haven't spent much time yet optimizing small-scale Rama deployments and there's likely things we can do to make it more efficient (e.g. combine the Conductor and Supervisor daemons into a single process).
- joelthelion 3y agoFollow up question : do you see Rama as being a good fit for applications that /don't/ need Twitter scale? These have simpler requirements, but I feel the integration you propose could still have value there.
- nathanmarz 3y agoYes, it's a better model for developing backends in general. Our comparison against Mastodon's official implementation demonstrates this, being at least 44% less code. It's the ability to avoid the impedance mismatches which dominate existing tooling that makes such a difference. With existing databases, including RDBMS's, you have to twist your application to fit their data models. The existence of things like ORMs help, but they add their own layers of complexity. With Rama, you mold your indexes to exactly match your application's needs. And you're always just working with objects represented however you want, whether appending data to depots, processing data in ETLs, or storing data in PStates. That computation and storage are integrated and colocated is another way that Rama simplifies application development and deployment.
- gfodor 3y agoSomething I'm immediately thinking about with this is change management and inertia at the early stages of a new, underdefined project. Less code is great, the big question is how such a system compares to the usual hack-and-slash method of getting a v1 up and running as you search for PMF from the perspectives of ops, cost, data migrations, rapid deployments, and so on. Presumably, the idea here is to start from the beginning with Rama, skipping over the usual "monolith fetches from RDBMS" happy paths, even for your basic prototype, this way you don't slip into a situation like Twitter did where that grew slowly into an unscalable monstrosity requiring a rewrite. So an article focused on the "easy" part that's required in the beginning of rapid change, as much as it's not as important as the "simple" part that shines later at scale, seems useful.
- nathanmarz 3y agoThanks, this is a good idea for a another post. The basic operation Rama provides for evolving an application over time is "module update". This lets you update the code for an existing module, including adding new depots, PStates, and topologies.
- polishdude20 3y ago"We spent nine person-months building our scalable Mastodon instance. " Nono, you can't say that when later on you say it's built on top of Rama. You literally spent 10 years building the framework to even make this. And yes, you built this in 10k lines of code but how many lines of code is Rama? This seems disingenuous.
- beders 3y agoNo it is not disingenuous. They didn't built Rama to build a twitter clone. And you can't take the "twitter engine" out of twitter and build other apps with it. A lot of it is custom built to fit the twitter data model. Unlike - it seems - Rama.
- colonwqbang 3y agoThe JVM took years to write. It took decades to develop the technology necessary to build a modern microcomputer. Before that, millennia to invent written language. And now that those platforms (including Rama) all exist, one can deliver a Mastodon server on top of them in about 9 man-months.
- kaba0 3y agoSo if one was building a database, and then later building an app against their own database, they should not get to claim how much time the latter took alone? There are enough hyped bullshit in the world to call out, but I would not be so quick to dismiss this one, especially given that the author does know what he talks about (he used to work at twitter)
- xmonkee 3y agoGoing by their claims, they are showing off their generalizable platform, Rama, by building an application on top of it. The application is an example, not the product. For example, someone implements a Todo app on their hot new javascript framework in 10 mins, your objection would be, "But it took you 2 years to make the framework, so actually it took you 2 years plus 10 mins". Why stop there? It also took many years to build the underlying language, networking layers, infrastructure, processors, materials etc etc. You have to draw the line at the point where the application specific code starts and the generalizable platform ends, no?
- jauntywundrkind 3y ago> The instance has 100M bots posting 3,500 times per second at 403 average fanout to demonstrate its scale. Mastodon has to send messages to each instance with a recipient. That server can then fan out to all it's subscribers. The way this point is worded makes me think all the bits are on just a single instance, meaning all the fan out can be dealt with internally without having to do any server-to-server at all. That is a fair comparison to Twitter, which is single instance. But it sounds like a much reduced ambition versus the task Mastodon has to do.
- nathanmarz 3y agoWe implemented federation fully exactly as you described.
- mping 3y agoCongrats on the (kinda) launch. I was curious to see what you guys were up to. The blog post is pretty detailed, and with good insights. Reducing modern app development complexity to mixing data structures sounds like a good abstraction. I'm sure you thought really hard about the building blocks of Rama and you know your problems better than most of the hn crowd. Now, the really hard part becomes selling. If companies start using your product to get ahead, that will be the real proof, otherwise its "just" tech that is good on paper. On a side note, did you guys got any inspiration from clojure? I see lots of interesting projects propping up from clojure people... Best of luck!
- nathanmarz 3y agoRama is written in Clojure :)
- mark_l_watson 3y agoNathan, we guessed that it was written in Clojure :-) Interesting to finally see the announcement.
- cutler 3y ago"Rama is programmed entirely with a Java API".
- nathanmarz 3y agoThe customer API in Java, and the implementation of that API is in Clojure.
- cgopalan 3y agoDoes a possibility of a Python API figure anywhere in your roadmap? Or am I missing the point here? Seems like it would be a smart choice to have one on the statically-typed side, and one on dynamically-typed side?
- fiddlerwoaroof 3y ago
- buro9 3y agoMeasuring "Twitter Scale" by tweets per second seems to be not how I would measure it. Updates per second to end users who follow the 7K tweets per second seems more realistic, it's the timelines and notifications that hurt, not the top of ingest tweets per second prior to the fan out... and then of course it's whether you can do that continuously so as not to back up on it.
- nathanmarz 3y agoThat's why we're saying "at 403 fanout". The bottleneck of Mastodon/Twitter is timeline writes, which is posts/second multiplied by the average number of followers per post. So our instance is doing 1.4M timeline writes / second. Another important metric is "time to deliver to follower timelines", which is tricky due to how much variance there can be every second due to the extremely unbalanced social graph. When someone with 20M followers posts, that multiples the number of needed timeline writes by 15x. We went into depth in our post on how we handled that to provide fairness by preventing these big users from hogging all the resources all at once.
- faitswulff 3y agoI heard somewhere that one of the particular challenges of Twitter's scale is not the average fanout, but the outliers where millions or tens of millions of users follow a single account. Does your simulation take that into account?
- nathanmarz 3y agoYes, we discussed this at length in the post.
- 2Gkashmiri 3y agowhats the server specs of this demo running at? is it baremetal? vps? how about doing a comparison on consumer grade vps like 1 vcpu/4GB ram setup comparison between your product and mastodon or pleroma for example? i mean sure you can build a twitter scale product but federation means people can do that on their own and with your tech, they dont have to worry about scaling issues.
- rubiquity 3y agoNoticeably missing are any details about concurrency control and replication or recovery protocols. A Twitter clone is one thing but any sort of application needing ACID Transactions is a whole other beast.
- nathanmarz 3y agoAll data on Rama is replicated automatically with a configurable "replication factor". Data written to Rama is not made visible until it's successfully replicated. The documentation we're releasing next week includes a page going into detail in how this works.
- runeks 3y agoDoes "replicated" here mean that the data is persisted to disk?
- nicechianti 3y ago[dead]
- clusterhacks 3y agoI'm excited to see the docs for Rama. But I am also a little scared of the comment " I came to suspect a new programming paradigm was needed" from Nathan. It's not so much that I think the comment is wrong or anything, but rather that it seems so similar to what I have heard in the past from power-lisp (or Clojure in this case) super-smart engineers. I feel like we have reached a point in software development where "better" paradigms don't necessarily gain much adoption. But if Rama wins in the marketplace, that will be interesting. And I am quite excited to see what a smart tech leader and good team have been able to grind out given a years-long timeframe in this programming platform space . . .
- nathanmarz 3y agoThis is why we exposed Rama as a Java API rather than Clojure or our internal language (which is defined with Clojure macros, so it's technically also Clojure). Rama's Java dataflow API is effectively a subset of our internal language, with operations like "partitioners" being implemented using continuations.
- cutler 3y agoJust curious, what advantage over Clojure did reverting to "pure Java" give you? Perf or something else?
- mwcampbell 3y agoPresumably approachability for programmers that would be scared away by Clojure. Smart marketing move.
- failuser 3y agoIs there a breakdown of effort Twitter spent doing the mastodon-level service (serving a feed of the accounts you are subscribed to) vs everything else like ads, algorithmic feed, moderation, fighting spam, copyright claims, localization, GR, PR, safety, etc?
- sourcecodeplz 3y agoWho cares. Mastodon was/is destined to fail. Trigger happy mods ban you from a server, then you're banned from a bunch.
- j45 3y agoJust on system design alone this was enjoyable to read. Clever architecture can help as much if not more than clever coding especially when keeping it simple but scalable is needed.
- lionkor 3y agoVery interesting, looking forward to reading the docs once they come out. Why Java?
- za3faran 3y agoThe more apt question I would argue is 'why not Java?' It's the most sane and reliable default for such projects.
- lionkor 3y agoIt doesnt change that it would be interesting to know why Java was chosen - its definitely not the default for anything anywhere I've worked
- nathanmarz 3y agoIt's one of the most widely used/known programming languages in the world. It's a Java API so any JVM language can be used (Clojure, Scala, etc.).
- afro88 3y agoLooks amazing and incredibly smart. But I found the LOC and implementation time comparisons to Twitter and Threads very disingenuous. It makes me wonder what other wool will be pulled over our eyes with Rama in future (or important real world details missed / future footguns). Still super impressive. Reminds me of when I discovered Elixir while building a social-ish music discovery app. Switching the backend from Rails to Elixir felt like putting on clothes that actually fit after wearing old sweats. Rama looks like a similar jump, but another layer up, encompassing system architecture.
- StephenAmar 3y ago+1 the comparisons are not great. How much engineer-hours did it take to build Rama itself? The numbers they got for Twitter likely include the time it took to build their infrastructure, common libraries (like finagle,…)
- paxys 3y agoDon't forget their entire ads system, data processing/analytics, monitoring, customer support, payments, internationalization. They have replicated at most a tiny bit of Twitter's core infra for sending Tweets. The company itself does a lot more than that.
- CuriousCosmic 3y agoHonestly I'm willing to accept the number they gave since the author (Nathan Marz) was one of the lead/founding devs for twitter's streaming compute backend in the past.
- softwaredoug 3y agoIt’s hard to construct a true randomized control trial for software engineering methods. People make many claims about programming paradigms or tools hard to validate. It’s also unsure what we would compare a tool like this to. I doubt you could just say “compare it to Rails” given how frameworks like rails are bound to specific data models, and most realistic applications. You’d have to compare it to some other opinion about how to wire together different data structures.
- teakie 3y ago[dead]