Live data from Hacker News

We reduced the cost of building Mastodon at Twitter-scale by 100x

blog.redplanetlabs.com

131–140 of 376 posts

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#131

I'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 "…

This 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.

Just curious, what advantage over Clojure did reverting to "pure Java" give you? Perf or something else?

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#132
post #55

Earlier quoted context omitted.

The short answer is write-through cache. You write the update directly to the cache closest to the user and into the eventually consistent queue. We did this at reddit. When you make a comment the HTML is rendered and put straight into the cache, and the raw text is put into the queue to go into the database. Same with votes. I suspect they do this client side now, which is now the closest cache to the user, but back…

DynamoDB’s DAX cache espouses the same approach. I have to say in my ~12 years as an active Redditor I can’t recall a time where I saw any real state issues, even with rapidly changing votes, etc. Bravo!? Now that we’re beyond the days of molten servers, I have to say its overall reliability in the face of massive spiky traffic is quite a feat.

Really? I see this all the time even now.

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#133
post #55
post #25

I'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 chang…

The short answer is write-through cache. You write the update directly to the cache closest to the user and into the eventually consistent queue. We did this at reddit. When you make a comment the HTML is rendered and put straight into the cache, and the raw text is put into the queue to go into the database. Same with votes. I suspect they do this client side now, which is now the closest cache to the user, but back…

This explains so many bugs I came across on Reddit. I guess it works, but man I dislike this implementation.

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#134
post #119

Earlier quoted context omitted.

"Rama is programmed entirely with a Java API".

The customer API in Java, and the implementation of that API is in Clojure.

Will there be a first-party Clojure wrapper? Or, would the expectation be that users would use Java interop?

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#135

Earlier quoted context omitted.

This is usually what I do. Don't even want to wait for an HTTP roundtrip for some of these, e.g. "liking" a post should fill in the heart icon or whatever instantly. One famous example of this going to far: Mac Mail app used to play a whoosh sound when your email is actually sent. They changed it to whoosh instantly no matter what. Given how often an email might fail to send or get delayed, this meant an actually use…

> Don't even want to wait for an HTTP roundtrip for some of these, e.g. "liking" a post should fill in the heart icon or whatever instantly. HN does this, and on slow days, about half of my upvotes don't go through.

yea but does hn have any client side js?

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#136
post #118

Looks 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 Rai…

It’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.

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#137
post #6

The 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…

That 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.

did you ever consider starting from something already technically performant like pleroma or misskey?

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#138
post #75

Earlier quoted context omitted.

We'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…

What is the licensing of Rama? Is it libre/open?

> We're keeping it closed-source for now.

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#139

Earlier quoted context omitted.

The customer API in Java, and the implementation of that API is in Clojure.

Will there be a first-party Clojure wrapper? Or, would the expectation be that users would use Java interop?

We're not releasing one as we don't have the bandwidth right now to maintain and document another API. That said, making a Clojure wrapper around the Java API should be pretty easy.

Re: We reduced the cost of building Mastodon at Twitter-scale by 100x

#140
post #131

Earlier quoted context omitted.

This 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.

Just curious, what advantage over Clojure did reverting to "pure Java" give you? Perf or something else?

Presumably approachability for programmers that would be scared away by Clojure. Smart marketing move.
Post reply on HN