Case Study / Events / Technology /

How Node.js Powers the Many User Interfaces of Netflix

3 Dec 2015 9:16am, by

Shifting its user interfaces to Node.js, Netflix has been able to streamline the development, cut the build times, and increase the level of customization of its UIs for each user.

Node was “a really attractive option for us, because it aligned well with the skills of the UI engineers, said Kim Trott, director of user interface engineering at Netflix. Trott will be speaking at the  Netflix’s use of Node at NodeSummit Interactive next week in Portland, Oregon.

Traditionally, Netflix has been an enterprise Java shop, but “as we migrated out of the data center to the cloud we moved to a more service-based architecture,” Trott said. The company is in the process of breaking up what used to be a monolithic Java application into a set of smaller services. Java still powers the backend of Netflix, but all the stuff that the user sees comes from Node. 

Node is a server-side JavaScript runtime that allows for developers to write the same code for both the front end and back end of a web application. As Node is built on an event-driven architecture, it is a framework that is particularly well-suited for working with microservices at scale.

UI work is demanding at Netflix. The company’s services stream out to a wide number of devices, from the Web to mobile applications to dedicated consoles. The front-end engineers “were having to write a lot of Java code to produce the website, but they also had to write a lot of JavaScript on the client side,”  Trott said. With Node, they can do all their work in JavaScript.  The UI team manages the Node platform for the video service.

Node also improves the build times considerably. The Java application could take as long as 40 minutes to start up, which doesn’t exactly lend itself to a speedy DevOps process. “The team was not able to move as quickly as they wanted to,” she said.

Pictured: Netflix Markup Architecture Implementing Node.JS

Pictured: Netflix Markup Architecture Implementing Node.js

The Future of Netflix and Node

In the future, Netflix will also be migrating to Node for its data access layer, in addition to the user interfaces. Netflix layers its client to write scripts against one API rather than writing to hundreds of services. When deploying scripts in the API service layer, clients draw from an aggregation of data layers, such as subscriber information, metadata about movies, subtitle information, and more. Currently, API scripts are deployed directly onto a single API service, which limits the ability to scale or isolate issues which arise.

As such, Netflix is currently developing a way to write scripts as individual Node applications. If a script performs badly, it will then only hamper or kill its own service, rather than the entire system. These Node applications will be running on Docker containers alongside Amazon Web Service’s Elastic Container Service (ECS), Netflix’s infrastructure provider of choice. This allows for containers to be run locally and debugged locally, rather than debugging their monolithic API server locally.

Pictured: Universal Javascript Client & Server Side at Netflix with Node.JS

Pictured: Universal Javascript Client & Server Side at Netflix with Node.JS

Node has proven so handy, that the company is expanding its use to other layers of the stack, Trott said.

Netflix is taking its use of Node a step further with Codex, which is a set of capabilities to deliver specific features to specific customers, depending on customer settings of what devices are being used.

For example, if a Netflix customer owns an XBox, within Codex, developers can customize a JavaScript package that will target that Netflix subscriber and their specific entertainment setup. Codex will be of particular interest to those companies working with Web services running across multiple platforms. It could also aid in A/B feature testing.

Netflix plans to release Codex next year as an open source project, Trott said.

TNS managing editor Joab Jackson contributed to this report.

A digest of the week’s most important stories & analyses.

View / Add Comments