350 points · by d23 · 9y ago · 166 comments
I remember looking into this a while ago and was bewildered to find that when I upvoted or downvoted, there was no XHR call to the backend! There was no hidden iframe/image, no silent form post. Absolutely no network activity. Yet when I refreshed, my vote was shown correctly. I thought I was going crazy.
This was long ago so I'm a bit fuzzy on the details but after a bit of digging, I found the most elegant data collection technique I've ever seen. Instead of sending network data when I voted, a local cookie was set with the link id and vote value. Then when I went to another page, my browser naturally sent the cookie to the server, where I believe it was processed, and then a fresh cookie was sent back to my browser. I could vote on 10 links, the local cookie would get large and then on the next page refresh, the backend would receive my batch of votes, process them, and send me a fresh cookie again.
I don't think they do that now and I've never seen anyone do something like this. Even HN just makes an XHR call on voting. After twenty years on the web, it's not often that I am surprised so this was quite a thrill.
This would mean none of my votes would ever have made it to the server!
You could add an onunload handler that fires off a request with the cookie to mitigate this.
It took 8.4 seconds to load the Reddit front page on my phone. Hacker News took 1.1 seconds. This feels like advice from the overweight gym teacher on how to do pushups.
The desktop Reddit site took 2.2 seconds over the same connection, by the way. It seems like it would be much more valuable to optimize whatever is taking up >75% of page time on mobile.
To be totally honest I'd say the comment is verging on toxicity. They're basically telling these backend engineers to piss off and save the blog post until the mobile site loads faster. It's quite likely they have little-to-no control over the mobile site and caching improvements are one of the few indirect ways they can improve it. This exactly the opposite of what we should see in response to content like this.
When I go to reddit.com, I see a list of stories from subreddits I've personally selected.
They just released for beta a new mod-mail that is unusable, so I'm guessing this new trendy but shitty design will eventually replace the whole site. I don't know what will happen after that, but I won't stick around to see it.
The subreddits vary from highly toxic to well moderated (spacex for example), but most are so lightly moderated that they have some good links but little interesting comment content. The contrast with HN is interesting - I think the moderation here is much better and the culture is more welcoming as a result, but the home page here now just goes past too fast for it to function as a firehose on specific subjects.
and you've got basically all of human civilization there.
All it's missing is search and it'll be perfect.
I think it's more like slashdot. I didn't leave slashdot for reddit or HN. I just left. It got bad. I'm thinking the same thing is about to happen for me on reddit as well.
HN, hubski, voat, etc. are picking up the slack. I'm also trying to spend less time socializing and more working on stuff.
They just spent the past year relaunching "reddit - the startup" so their team is now plenty big, they just don't have much to show for it.
That's just not true. Reddit has a ton of extra functionality, including creation of subs, subscription to subs, controls of voting rules, user bots that run on reddit's servers (example: RemindMe), theming, tons of settings even for the regular users, moderators/admins interfaces, apps (example: ChangeTip), reply notifications, self-serving ad management system, image/video embeds.
I'm sure there's a lot more, these are just the obvious features that HN doesn't have.
If that were true, this would be a much better site.
I'm probably overreacting but reading this really got to me. My apologies if I came off too aggressive or negative.
But regardless, what does the second page load take? What does the 3rd take?
For many people, they go on reddit and stay on there for a significant amount of time. So that first page load is much less impactful, especially if it can enable them to have faster "pageloads" while on the site. If the site is optimized for them, then having the image/text post load in a fraction of a second, and the comments in under a second (which it does for me) seems like a good bet.
That being said, they really could spend some time reducing that impact.
And just to throw my experience in with the others, I'm getting much faster load times. Timed using the chrome dev tools connected to my phone, it takes 2.76 seconds to the "load" event and about 3 seconds until it's fully usable. (cache disabled, 4g tmobile network, high-end android phone, obviously these will be much worse on slower phones, slower networks, etc...)
Most menus don't open for me on the first try (especially in landscape) or open in the wrong place with touch targets that are "off" so I have to rotate the phone a few times.
The old iOS 6 style site didn't age well visually, but it sure was fast. I miss the days when mobile sites were the fast and light version meant to work over 2G.
To me it's insane a non-SPA desktop site would become a SPA mobile site
Not to me. Yes, you might pay additional time on the first load, but you save massive amounts of data (and thus, due to TCP, highly latency bound packets) when you just transfer small bytes of JSON. Oh, and that saves battery too - mobile data transfer is the hugest drain on any phone's battery.
T 0: white page
T 5: to see the reddit header with logo, the rest of the page is still white
T 16: to see the bar stating that I should use the app, click on the tiny mobile site link
T 25: page visible behind the "app" bar stating I should use the app
T 32: the bar is gone, and the site is "usable"
The interface is great. You can swipe for (almost) everything, which makes it easy to use one-handed.
https://github.com/reddit/reddit-mobile/compare/e3f1119e3358...
I
This was over a different connection, so I tried HN again. It took 1.0 seconds.
which they insist (for me anyway) on every single page I load.
The new mobile version is a complete pile of junk!
Use the old one by adding '.compact' to a normal reddit link, it's better in almost every aspect.
How could you compare the 2? The former has images and rich media. The latter is all text, like a unix terminal. LOL
General guidelines: Always doubt advice from startup folks. Usually the more unicorn and hype they are, the less qualified they actually are.
Basically, they grow by recruiting a lot of people (most inexperienced in average) and grow in all directions without a plan. To caricature, it's like a big playground.
By the way, and I'm going out on a limb with my shameful plug, I built a Varnish-as-a-Service kind of infrastructure called Cachoid ( https://www.cachoid.com ). But to my own defense, I'm putting my energy, time, and money where my mouth is.
Logged out users see a "snapshot" of the page updated every so often.
And I really don't think that caching pages per session would really help with their load all that much. Why not just use HTTP cache headers at that point?
Plus while you don't really need to show votes ASAP, logged in users will want up to date comments.
> For example, when new comments are added or votes are changed, we don’t simply invalidate the cache and move on—this happens too frequently and would make the caching near useless. Instead, we update the backend store (in Cassandra) as well as the cache. Fallback can always happen to the backend store if need be, but in practice this rarely happens. In fact, permacache is one of our best hit rates—over 99%.
They basically have their application state duplicated in both places. Interesting architectural choice.
Most of my current job involves solving problems that are caused by cloud limitations.
Reddit, on the other hand, is the worst performing out of all the top sites that I can think of.
The on-prem alternative is to run something like OpenStack, which is a major PITA.
54 x R3.2xlarge EC2 instances
On demand = $314,571.6/year
w/ 1 year term = $166,860/year
w/ 3 year term = $110,340/year
w/ convertible 3 year term = $150,174/year
Is that a lot? Seems like a lot
Going from a 50th site in the world in a niche topic (stack overflow) to a 27th worldwide that target all audience. It's entirely possible that it grows the traffic by 100x.
Anyway, who cares about money? 100k a year is peanuts. At this scale, if you have a solution that works well, you're good. Not even worth thinking about it.
They're better now then they were ages ago, but it still happens. Combine that with slow load times, etcetc.
Now, don't get me wrong they're likely doing better than i could - it's a very difficult problem to solve. But, something must be fundamentally wrong if a site who's growth has been steady and not "overnight", it just seems like it's always been very very slow. By overnight i just mean, it's growth has appeared predictable; Unlike the poor sites that get HN/Reddit hug of death.
edit: Not sure why i was downvoted, but i'll elaborate:
From a user perspective, Google never goes down. It's a big event when that happens. I've never seen Amazon down (again, personally!). I've never seen most of the big players down. Yet i've seen Reddit down more times than i can count. It's a meme on the site.
Regardless of how difficult the problem domain is, the end user doesn't care. All i'm saying is that the end user experience is not good enough, in my opinion. I don't think that is an unfair statement.
So if this caching is what is powering the current state of things, what can be done better? From a technical perspective, is this the best that can be achieved? I surely hope not. Would you argue it's the best we can hope for?
Anecdotally, I also get way more errors/dropped connections/random slowness on Reddit than on any of the other massive sites. Plus the mobile site is beyond terrible, unusable on my phone.
I'm sure it's not an easy problem to solve, but they should be able to afford some hosting with all the reddit gold that seems to get thrown around.
1. You use less bandwidth in/out of the box. This matters in AWS because your bandwidth is (relatively) limited.
2. Your CPU usage to (de)compress is distributed over a larger fleet. The clients spend the CPU time, not the cache servers.
Maybe only small because most californians were still sleeping? I was only up due to a sick kid. :D
But... their use case is IMHO one that you can accelerate tremendously by using Redis. I ran the most popular Italian Reddit-alike site for years, and I wrote a simple Reddit clone that uses Redis so I had the opportunity of exploring the problem a bit.
That said - we use Redis in at least 2 (soon to be 3) capacities across the site for different services (outside of the monolith) and it works really well.
(This is a joke please. Understand it as such. I know reddit has the problems it has because it is severely understaffed)