BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Netflix.com Adopts Universal JavaScript, Drops Java from Rendering Pipeline

Netflix.com Adopts Universal JavaScript, Drops Java from Rendering Pipeline

Leia em Português

This item in japanese

Lire ce contenu en français

Bookmarks

The team behind Netflix.com has switched from a Java-based HTML renderer to a JavaScript one that they can run on both the server and the client.

To decrease the time users spent waiting, Netflix has removed the Java server-based renderer and reduced the amount of HTML sent down the wire. In a post describing the change, Kristofer Baxter, said that by not rendering pieces of the app that the user will never see (among other changes), they've been able to speed up the time til interaction by 70%.

Every time a visitor came to any page on netflix.com our Java tier would generate the majority of the response needed for the entire page's lifetime and deliver it as HTML markup. Often, users would be waiting for the generation of markup for large parts of the page they would never visit.

Dubbed "Universal JavaScript", Netflix architected their new UI renderer so that they can run it in the browser or in a node.js server. Baxter says that this technique "allows for the application to render the exact same output independent of the location of the rendering. The hard separation is no longer present and it's far less likely for the server and client to be different than one another."

As applied to JavaScript, Charlie Robbins presented the idea in 2011. He called it "Isomorphic JavaScript" which has resulted in years of debate over the poor name. In recent months, the term Universal JavaScript has gained acceptance.

Switching to a Universal JavaScript model is not easy and requires a solid foundation. Baxter told InfoQ that code quality is of the utmost importance. "Ensuring the two JavaScript environments have a shared context is paramount. Without a solid architectural solution to this problem, code can easily fracture into server versus client branching," said Baxter.

While Netflix has chosen React.js to provide them with this ability, it isn't the only option. Ember.js has an upcoming technology called FastBoot that promises to do something similar. There are also many other libraries available to try out.

Netflix opted for the Universal JavaScript system after a head-to-head duel inside the company. Baxter says another prototype built using SPA techniques was also considered:

When we started the prototyping phase of this project, we built two complete prototypes of competing designs using different architectures. The first was a client-side only JavaScript architecture based heavily on Backbone and jQuery. The second, a competing early design using Universal JavaScript and React.js. After a three week period, the two architectures were presented to the larger team and Universal JavaScript with React.js was the clear winner. However, we'll continue to try new and differing approaches to building web applications going forward.

The list of companies building with Universal JavaScript is growing. Hotel Tonight, AutoDesk, Tesco, and AirBnb have built or are building products with the architecture.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • No editor on this site?

    by Bob Jones,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    It's duel not dual. As in "head-to-head duel inside the company".

  • Re: No editor on this site?

    by David Iffland,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Good spot! Corrected.

  • Older idea

    by Kevin Isom,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    You credit the wrong person. Dav Glass of YAHOO! was working on the idea's behind isomorphic content well before Charlie Robbins coined a terrible phrase. He presented the idea's at YUI Conf in 2010 yuiblog.com/blog/2010/09/29/video-glass-node/ and had been talking about it for a while before then.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT