Snooping on Facebook Instant Articles
John Gruber piqued my curiosity:
I’m intrigued by the emphasis on speed. Not only is native mobile code winning for app development, but with things like Instant Articles, native is making the browser-based web look like a relic even just for publishing articles. If I’m right about that, it might pose a problem even for my overwhelmingly-text work at Daring Fireball. Daring Fireball pages load fast, but the pages I link to often don’t. I worry that the inherent slowness of the web and ill-considered trend toward over-produced web design is going to start hurting traffic to DF.
I had to take this for a spin to find out how fast it is. Instant Articles are aptly named — they load really fast. I tested a series of articles from Facebook’s various publishers — including from the Atlantic, the New York Times, and Buzzfeed — and found that most content loads near instantaneously, including high-resolution imagery. Videos were the only exception, which sometimes exhibited a few tenths of a second of lag before autoplaying on my 50 mbps home connection.
But even videos loaded faster than pretty much any page on Pixel Envy. My site is pretty damn fast, but not compared to Instant Articles, which is a little ridiculous given that this site is nearly entirely textual.
What’s enabling this super speed? It’s all within the iOS app, so there’s not a lot of information an idiot like me can cull, but I ran a session through Squid and collected the logs. Nearly everything Facebook delivers is sent over HTTPS, so I couldn’t cache its data or see many specific loading events. Nevertheless, here are the logs for a Buzzfeed “article” about grown men playing with kittens, and some article from the Times.1 A few observations:
All of the article content is hosted on Facebook’s servers, including text, images, and video. Ads, on the other hand, are either provided by Facebook or through whatever network or exchange the publisher likes. In the case of Buzzfeed, that’s Moat; in the case of this Times article, it’s the newspaper itself serving the ads.
To get things to load fast, Facebook doesn’t appear to use tricks beyond what you might expect: mighty data centres located all around the world, and compressing the hell out their assets. It also loads media lazily. But there’s probably some other, more invisible stuff going on. I poked around the app bundle and didn’t spot anything obviously exciting to my eyes.
Facebook automatically loads all content — including video — by default. That seems like a rather generous assumption on the part of Facebook, given that most people are probably on metered plans. You can turn this off under the More tab, in Account Settings, then in Videos and Photos, then under Auto-play.
There’s also a bunch of crap from various backgrounded services. Ignore those lines; they’re just there for completeness. I did remove one confidential line, however. ↩︎