by r0bbbo · 3y ago · 0 comments
IMHO sharding traffic by subreddit doesn't pass the smell-test, though. Different subreddits have very different traffic patterns, so the system would likely end up with hotspots continuously popping up, and it'd probably be toilsome to constantly babysit hot shards and rebalance. (Consider some of the more academic subreddits vs. some of the more meme-driven subreddits — and then consider what happens when e.g. a particular subreddit takes off, or goes cold.)
Sharding on a dimension that has a more random/uniform distribution is usually the way to go. Off the top of my head (still speculating wildly and basically doing a 5-minute version of the system-design question just for fun), I'd be curious to shard by a hash of the post ID, or something like that. The trick is always to have a hashing algorithm that's stable when it's time to grow the number of shards (otherwise you're kicking off a whole re-balancing every time), and of course I'm too lazy to sort that out in this comment. I vaguely remember the Instagram team had a really cool sharding approach that they blogged about in this vein. (This would've been pre-acquisition, so ancient history by Silicon Valley standards.)
As for subreddit metadata (public, private, whatever), I'd really expect all of that to be in a global cache at this point. It's read-often/write-rarely data, and close-to-realtime cache-invalidation when it does change is a straightforward and solved problem.
The founding Reddit team was non-technical (Even Spez. I've been to UVA; it's not an engineering school; and spez had never done any real engineering before coming onto Reddit). They ran a skeleton crew of some 10ish people for a long time (none from any exceptional backgrounds. One of them was from Sun & Oracle, after their prime).
Same group that started with a node front-end, python back-end monolith, with a document-oriented database structure (i.e., they had two un-normalized tables in Postgres to hold everything). Later they switched to Cassandra and kept that monstrosity -- partly, because back then no one knew anything about databases except sysadmins.
Back then they were running a cache for listing retrieval. Every "reddit" (subreddit and the various pages, like front-page, hot, top, controversial, etc.) listing is kept in a memcache. Inside, you have your "top-level" listing information (title, link, comments, id, etc.). The asinine thing is that cache invalidation has always been a problem. They originally handled it using RabbitMQ queues: votes come in, they're processed, and then the cache is updated. Those things always got backed up, because no one thought about batching updates on a timer (or how to use lock-free) (and no one knew how to do vertical scaling, and when they tried, it made things even harder to reason about). You know what genius plan they had next to solve this? Make more queues. Fix throughput issues by making more queues, instead of fixing the root cause of the back-pressure. Later, they did "shard"/partition things more cleanly (and tried lock-free) -- but they never did any real research into fixing the aforementioned problem (how to handle millions of simple "events" a day... which is laughable thinking back to it now).
That's just for listings. The comment trees are another big bad piece. Again, stored un-normalized -- but this time actually batched (not properly, but it is a step up). One great thing about un-normalized databases and trees, is that there are no constraints on vertices. So a common issue was that you could back-up your queue (again) for computing the comment trees (because they would never get processed properly) (and you could slow the entire site to a crawl because your message broker was wasting its time on erroneous messages).
Later, they had the bright idea to move from a data center to AWS -- break everything up into microservices. Autoscaling there has always been bungled.
There was no strong tech talent, and no strong engineering culture -- ever.
-------
My 2 cents: it's the listing caches. The architecture around it was never designed to handle checking so many "isHidden" subreddits (despite that they're still getting updates to their internal listings) -- and it's coming undone.
If you search for r/news for example, it's nowhere on that page.
This is likely shifting load in very unpredictable ways... I'm sure a sibling comment is right that it's probably less load overall in general, but it'll be going down codepaths that aren't normally being exercised by >95% of requests and aren't working on the assumption that virtually all content is being hidden.
There's probably some microservice instances that are currently melting themselves into a puddle until they can deploy additional instances, additional DB shards, or roll out patches to fix dumb shit that wasn't dumb until the usage assumptions were suddenly inverted. Meanwhile there's tons of other instances that are probably sitting idle.
Speculation, but having major subs private change the load profile which may result in the outage. Reddit certainly wasn't optimized for this.
I could easily be wrong though, I haven't done web development for years.
You can’t treat the scaling as a binary feature, that it does or doesn’t
You start getting a lot more DB queries than usual, bypassing cache, the DB's remote, it's clustered or whatever, now you've got a ton more internal network traffic and open sockets, latency goes up, resources start to get exhausted...
Reddit goes wrong often so I expect this outage could have any number of causes.
That's not necessarily true. Perhaps the status of subreddits is cached (because there's no reason to hit the DB 100 times/second to check if r/funny is private or public). But for a given request to a private sub, it would need to check each user.
Obviously I can't reference the comment in question right now, but I'll try to remember to circle back and add a reference when(/if?) Reddit comes back up.
Edit: /u/andrewsmith1986's comment can be found at https://old.reddit.com/r/dankmemes/comments/1477psa/all_3_ar...
https://old.reddit.com/r/TrophyWiki/comments/mohrlg/reddit_t...
There is some whitewash in the comments there: "[violentacrez] received the trophy because all the work he did to moderate the site..." as if he got the award for keeping things clean, but consider that he contributed the vast majority of those subreddits' content himself by cruising social media for salacious pictures of minors to share while he was in his 40's, and the award is named "Pimp Daddy."
I'm not naive, user content is hard to moderate. But is it hard to say "any subreddits with these keywords go on a list for review"?
Remember when Phrack was added to the LOC ... and was over 7 years old already (http://phrack.org/issues/42/1.html)?
More seriously, you really start to feel "ancient" when your body goes from "new year, pretty much the same as old year" ... to ... "new year, who removed vital organs and bodily fluids while I slept last night?! The bastards!!!"
Of course, it is a classic trope nevertheless ... and I did start to feel ancient even 15+ years ago ... but once you start noticing real changes, then you REALLY get that feel (and you know more is coming, lol): https://youtu.be/MqBNSMbEzI0
>Back in the day, you used to be able to add anyone as a moderator and it auto accepted.
>People would make shitty subs and add people, take a screenshot, shut down the sun or make private, then use that screenshot to start a witch hunt. Violentacrez could have added you as a mod of the sub and you'd be in the same situation.
>TL:DR I used to mod a sub with Barack Obama and Snoop Dogg.
Consider: spez was the voluntary "mod" of the entire platform as CEO, and he maintained that subreddit.
Excusing him for the unsolicited mod invite is just optics management. It would be like saying lowtax had no responsibility as co-signer for the existence of subforums that his paid or unpaid staff maintained.
EDIT: to clarify -- a big stretch to connect editing comments (which was well-known to have happened) with other actions.
https://www.theverge.com/2016/11/23/13739026/reddit-ceo-stev...
In either case, it’s easily as speculative as the parent comment above, maybe slightly more so, since the parent came from Twitter.
Fabricating? Or do you have some reason to believe this is true.
The wayback machine doesn't list him as a mod (SFW): https://web.archive.org/web/20100420183707/http://nl.reddit....
PS. Wow, the sidebar makes that sub seem even scummier than I assumed it was.
That said, that meme is propaganda and defamation. Anyone could add anyone as a mod anywhere for a time, and violentacrez added spez "for the lulz" or however people like that think. I'd be beside myself it there's evidence that he was an active moderator working on that sub. Although, given the prevailing winds of the modern left, in a few years he'll probably be trying to claim that he was.
> According to Reddit, the blackout is responsible for the problems. “A significant number of subreddits shifting to private caused some expected stability issues, and we’ve been working on resolving the anticipated issue,” spokesperson Tim Rathschmidt tells The Verge.
https://www.theverge.com/2023/6/12/23758002/reddit-crashing-...
The official Reddit Status Twitter account proves that it happens very, very regularly: https://twitter.com/redditstatus
Edit: I wonder if it’s because all the subreddits I’m on are low or medium traffic. I’ve unsubscribed from the front page and /r/all and tend to only read niche subs.
Maybe it is a regional thing?
I always just assume the uptimes absolute dogshit.
Source: I'm finally breaking a 13 year Reddit addiction.
Interestingly, HN is being really slow for me right now and also gave an error when I first loaded it. Maybe something more global is going on, like network or cdn issues?
HN seems to be groaning under the load too and might go down with Reddit.
A place I once worked had a 404 handler that was extremely expensive, but nobody noticed for a while because 404s are relatively rare. One time a vulnerability scanner took down the site because it was just hitting known vulnerability paths which all 404'd. The code that executed during a 404 was n^2.
Hyperbolic I know, but that’s what it feels like.
For example, maybe it causes reads from the database take a lot longer than they normally would, locking up the database or causing the process the crash (again, that’s just pure speculation).
What happens when a user has 99% of their posting in subs that are now hidden, and the API is programmed to produce a fixed 30 comments of history on the overview page? The answer is extremely deep database pulls... you might pull a year of comment history to get 30 comments that aren't hidden. And depending on how they do that, it may actually pull the whole comment history for that timespan, since most of the time posts aren't hidden like this.
I worked at a backend team at work with some very overburdened legacy tables in mongo, and this is the kind of thing we'd think about. Yeah you can use an index, but then you have to maintain the index for every record, and change it every time a sub goes private/public (and we literally were hitting practical limits on how many indexes we could keep, we finally instituted a 1-in-1-out rule). And how often does that happen? Even deleted comments are overall probably a minority such that indexes don't matter, but, this is relational data, you have to know which subreddits are closed before you can filter their results, and mongo sucks at joins. And the mongo instance can become a hotspot, so, just filter it in the application instead for those "rare" instances. Even if they are doing it in mongo, the index/collection they're joining may suddenly be 100x the size, which could blow stuff up anyway.
edit: for me, one overview page is now taking me back one month in comment history. And I comment a lot on subs that are currently closed, so it could easily be throwing away 5-10 comments for every comment it displays.
E.g. many Google searches lead into private communities now. Word is spreading.
If they see a "this sub is private because reddit is dumb and also evil" they may come back later, they may not.
As for the forced reopening, beside the conspiracy this is something that could happen. It's a private company, moderator on strike are a loss of business, they would be 100% in their right to remove all the "traitors" (I'm not saying this would be a smart move, simply that if they really plan to go down this self destructive path it's the best time to do this and prove potential investor they still have control).
Legally, of course. Morally, it is completely unacceptable. This isn't "oh they're jerks"; this is "the system is broken".
A meatspace analogy:
You host a weekly gathering at a restaurant. You decide to temporarily boycott the restaurant to protest some behavior of theirs -- your actions are a loss of business, _so the restaurant decides to host your weekly gathering without you_.
We'd never accept that in the real world, but for some reason we do online -- we fall back to the legal argument that It's A Private Business (which is true) and completely ignore that Reddit doesn't own the community, that the community doesn't _belong_ to Reddit. They own the platform (the restaurant); they don't own the community.
Less if you add "competent" to the qualifications list :)
My first thought this morning was "if I was reddit, I would re-open all closed subreddits and instate my own moderators"... I'm kind of surprised they didn't. I'd have to imagine that if they wanted to, the attempt wouldn't fail - this seems like it could be done almost trivially.
> I think it's extremely unlikely that this is deliberate. The way that Reddit builds "mixed" subreddit listings (where you see posts from multiple subreddits, like users' front pages) is inefficient and strange, and relies heavily on multiple layers of caches. Having so many subreddits private with their posts inaccessible has never happened before, and is probably causing a bunch of issues with this process.
https://tildes.net/~tech/163e/reddit_appears_to_be_down_duri...
however, they have stated that may do this if the protest extends beyond the 48h mark.
Others look like they got the hostile takeover and a new mod.