Hacker News new | ask | show | jobs
by ndriscoll 842 days ago
Facebook makes over 300 requests for me just loading the main logged in page while showing me exactly 1 timeline item. Hovering my mouse over that item makes another 100 requests or so. Scrolling down loads another item at the cost of over 100 requests again. It's impressive in a perverse way just how inefficient they can be while managing to make it still work, and somewhat disturbing that their ads bring in enough money to make them extremely profitable despite it.
4 comments

This is the company that instead of ditching PHP created a full on PHP to C++ transpiler and then deployed their while site on that for a few years.
FB still runs on Hack.
> deployed their while site

??

Obviously "whole".
That's why it's so inefficient!
Wasn't the whole point of GraphQL in mitigating this?
Yeah, that's why you have only 100 requests* when you hover over an item instead of 800.

(* allegedly, didn't verify it myself)

No.

Here is the thing, hypermedia is cacheable. React/Graphql not so much.

Facebook is now just an application that runs in the browser.

As a poor, small developer who doesn't want to hemorrhage money, I tend to want things to be more hypermedia and less app. It saves on complexity and bandwidth and costs.

Do you have an ad blocker stopping the requests and causing retries?
I do have ublock origin on everything of mine, so conceivably it's reacting to that somehow. I'm no longer at my computer to be able to look more closely at what it's doing.
Whenever you're running this kind of eyeball test with DevTools, make sure the "Disable Cache" option is _not_ checked. And even then, make sure the requests you're counting were not served from your browser cache. It's possible that only the first page load sends hundreds of requests, and subsequent loads may still initiate those requests, but have their responses served from your browser cache (or your cache is disabled).

I would check myself, but I haven't logged into Facebook in many years. :)

Could someone tell me what these hundreds of requests could do?
A lot of them appear to be that they've split their javascript into a gazillion files for whatever reason (I suppose because they have several MB of it). But someone or lots of people there did seem to get addicted to dynamic loading. Like I've got 100 or so friends, but my friends page loads them 8-16 at a time as I scroll. Just send all 100 and set the profile pictures to deferred fetch. It'd probably be smaller than the js they have to make it do "infinite" scroll.

Similarly, after getting to the bottom of their "infinite" scroll, my friend feed (which is annoyingly hidden away) gives me... 15 items. Just send me all 15. It's like 1-2 kB worth of data. If you're going to end the scroll after a dozen items, why is it using infinite scroll?

Could be so they can track what you're looking at on the back end
Track you, probably with a thousand layers of redundancy, tech bloat, and decades of mold.