How Facebook helped tweak Chrome and Firefox to download pages faster

1485451466 facebook to build a standalone camera app similar to snapchat one touch photo and video sharing

facebook-to-build-a-standalone-camera-app-similar-to-snapchat-one-touch-photo-and-video-sharing.jpg

Facebook says it has worked with Firefox and Chrome engineers on tweaks to their browsers that should make web pages download “dramatically” faster.

Over the past two years Facebook has been working with the Chrome and Firefox teams to improve browser caching. As a result, both have recently launched features that make their caches significantly more efficient for Facebook and the rest of the web.

ADVERTISEMENT

Facebook’s Ben Maurer and Nathan Schloss said the changes have helped reduce static resource requests to its servers by 60 percent and improved page load times as a result.

A static resource is a file that a server reads from disk and serves to the browser without running any extra code. Browsers often reuse things like logos or JavaScript code across different pages, and it’s wasteful if browsers download them over and over again.

To prevent this, HTTP servers can specify an expiration time and a validator for each request. The expiration time tells the browser how long it can reuse the latest response for, and the validator allows the browser to continue to reuse the response even after the expiration time by allowing the browser to check with the server.

This raises other questions for web developers: how long should expiration times be? Too short and browsers will be checking in with servers too much; too long and browsers will be showing out-of-date information.

To get around this, Facebook uses the concept of ‘content addressed URLs’ so that its URLs are a hash of its content, which can then have a very long expiration time — a year, for example. And because the contents of the URLs never change, Facebook’s servers respond with a 304 not-modified response for any and all conditional requests for static resources, which saves on CPU cycles.

A 304 response is more efficient than downloading unneeded code, but it doesn’t eliminate the latency of the browser talking to the server.

“Every time a not-modified response is sent, the browser already had the correct resource. We want to avoid these wasted revalidation by allowing the client to cache for longer,” Facebook said.

Tweaking the browsers

But in 2014 Facebook found that 60 percent of requests for static resources resulted in a wasteful 304 response, and starting looking for ways to cut these down. It also noticed that there were substantial differences between the performance of different browsers: 63 percent of requests from Chrome were conditional, compared to 13 percent for Firefox, 14 percent from IE and 22 percent from Safari.

Facebook worked with Chrome’s engineering team to fix the issue and Chrome’s conditional requests dropped to 24 percent. Further tweaks saw the percent of Chrome conditional requests drop “dramatically” Facebook said.

In testing the Chrome team found that for mobile users with a 3G connection across all websites, reloading was 1.6 seconds faster with this change.

Facebook also worked with Firefox to add a new cache-control header for some resources in order to tell the browser that this resource should never be revalidated.

“Chrome and Firefox’s measures have effectively eliminated revalidation requests to us from modern version of those browsers. This reduces traffic to our servers, but more importantly improves load time for people visiting Facebook,” the company said.

(via PCMag)



Notice an issue?

Arabian Post strives to deliver the most accurate and reliable information to its readers. If you believe you have identified an error or inconsistency in this article, please don't hesitate to contact our editorial team at editor[at]thearabianpost[dot]com. We are committed to promptly addressing any concerns and ensuring the highest level of journalistic integrity.


ADVERTISEMENT
Social Media Auto Publish Powered By : XYZScripts.com
Just in:
Europe and China Must Pivot from Tech Rivalry to “Constructive Engagement” in AI Era, Warn Leaders at CEIBS Forums // Paddles up! Hong Kong marks 50 Years of international dragon boat thrills // ADNOC Drilling puts AI rig to work early // Pulsar International (“Pulsar”) announces agreement as an authorized reseller of Amazon Leo to bring high-speed satellite internet to commercial maritime customers // Hong Kong celebrates surge of global enterprises driving investment and opportunities // VinEnergo partners with SunAsia Energy to develop Solar-on-Water projects integrated with aquaculture in the Philippines // Varenne Capital opens Dubai base for regional push // J.P. Morgan pares Brent outlook on softer demand // Dubai summit sets global sports agenda // Collapse Of TMC In Bengal Has Given A Big Opportunity For A Left Turn-Around // Foreign bank branch fined over compliance failures // AI browsers face new credential leak warning // Putting Scientific Research Agents Within Reach — SCNet.AI Accelerates AI4S Innovation Powered by AI & HPC // Rubio seeks Gulf backing for Iran accord // Gaslight malware exposes AI triage blind spot // Security Is the New Market Access: Kigen Is Leading the IoT Security Mandate // HKRITA Signs MoU with Jeanologia and Looptworks to Establish the Green Machine Circular Textile Ecosystem, Marking a Breakthrough in Scalable Textile Recycling // ADNOC group secures Bab gas cap concession // Trashure Hunt Opens at Raffles City, Turning Singapore’s Waste Challenge Into Public Art // Emirates SkyCargo widens Asian freight reach //