Reddit's technical architecture. How is it so fast ?

I checked out their API, and it’s incredibly heavy… especially for nested comment replies.

I would be curious to know more about the technical architecture - also whether they use graphql.

I would also be interested in knowing this Specifically how they get instances up and down so fast

They did an AMA a while back:
https://www.reddit.com/r/aws/comments/ecf5i3/were_reddits_infrastructure_team_ask_us_anything/

Any TLDRers?

https://www.reddit.com/r/aws/comments/ecf5i3/were_reddits_infrastructure_team_ask_us_anything/fbb4gk1/?utm_source=share&utm_medium=ios_app&utm_name=iossmf&context=3

Ec2 Cassandra memcached

Autoscalling

I dont find it that fast. The search on reddit is pretty bad. And also load comments? We are not even talking about complicated queries. When you think about it, there is nothing worthy of mentioning about reddit app, except the idea

I agree to some degree.
Loading of posts takes a long time for many things, and it relies heavily on async requests and loading placeholders to deliver an OK user-experience. The web-player for videos is extremely buggy and loads slowly. And I notice short periods of “downtime” at least once a week.

However there are definitely interesting things to share about Reddit’s architecture - but not certainly not about the backend being fast (as OP mentioned). And for the few things that do work fast, it´s not a big surprise: caching, caching and caching.

Once their EC2 instances CPUs pass a certain threshold, they begin to auto scale and bring up more instances to handle the load. If they know their servers will be under a load before hand, they can manually scale it up themselves to handle the traffic

Also, CDNs and caching are a big part of performance.

Is it really that fast? I see slow page load times a lot, and weird errors like timeouts when sending messages and stuff. I feel like they prioritize certain operations but especially if you’re looking at stuff that’s not popular in your geographic region, there is lots of lag and errors.

I dont think they cache anything except the feed. Does not really make sense to cache the actual comments thread since it could be an active discussion and you need live data there. The feed counts, as i could observe, its a bit behind the reality most of the times. Which is ok because when you scroll, the app should serve the titles, the thumbnails and a stored count. It would be slow to count everything while scrolling the feed, especially on active subs. So imho they only cache the feed, keys being composed of user subsribed subs

This app is all about devops

And I notice short periods of “downtime” at least once a week.

If Reddit was a SaaS product with at least a single half-big customer, it would be out of business for how much downtime it has. And that’s not even mentioning the 10-times a week that the webpage simply decides to log off for no reason and that only happens to me in Reddit.

This is a good talk which covers a lot of it - The Evolution of Reddit.com’s Architecture

Their webpage kills the memory of my browser every time.

I’d be really surprised if they didn’t use microcaching (caching for short periods, like a second) for comments in popular posts. Nobody would notice and it’d reduce load on the infrastructure significantly.

And for older posts, maybe longer cache that busts on a new comment.

Anything can be fast if you throw enough money at it.

There appears to be some kind of caching going on, as frequently comments that I know exist do not show up for a while. Might be read only slave replication delays?

Makes no sense to cache this thread or any thread or all threads as it makes no sense to cache a chat. Reddit is kinda big, just think about ehat would mean to cache everything. Its just bad practice