Netflix content engineers pick GraphQL over REST, Falcor
When the Netflix content engineering team chose a data query language for a new system to pull data from a variety of back-end services, they passed over REST to go with GraphQL.
NEW YORK -- When season three of the Netflix original series Stranger Things debuts on July 4, or when you watch the gripping Netflix miniseries When They See Us, you can thank GraphQL.
Netflix has used GraphQL for a bit more than a year, primarily as the data query and manipulation language to pull data into systems that support its content engineering group, said Garrett Heinlen, a Netflix software engineer who spoke at the QCon New York conference here.
Netflix has two main engineering organizations: product engineering, which handles streaming, and a content engineering team that builds the tools that are used to create the streaming service's popular shows.
"Since we were building a new thing, we had a bit more freedom to experiment," Heinlen said. "GraphQL had a lot of traction in the industry, coming from Facebook, who had just recently made React."
Facebook created GraphQL in 2012 and contributed the project to the open source community in 2015. Last year, the company moved the technology over to the GraphQL Foundation, an independent group under the auspices of the Linux Foundation.
GraphQL enables users to define a schema that models their business domain as a graph. Heinlen's team built a single-entity graph over the last year to support several downstream integrations, including Java, Ruby and REST integrations.
The back-end stack doesn't matter, because GraphQL can connect with any back end, Heinlen said. "We define a GraphQL schema ... and then we build UIs around that," he said.
Historically, siloed downstream services slow down access to information, but moving to the graph model makes data accessible regardless of where it is stored.
After the success of Heinlen's group with GraphQL, they have helped other Netflix teams over the last year spin up "many dozen" applications using single-entity graphs, Heinlen said.
"We have a team inside the company building a multientity graph, which is a holistic view of all our content engineering entities and domains and operations we can do on them," Heinlen said.
Netflix also is working to deliver a UI to put in front of this federated graph.
"Having this unified graph is going to allow us to answer questions from the product teams that we haven't been able to answer before, because the information was in siloed systems," Heinlen said. "Now, all the data in your organization is accessible and available, and you just build against it."
Although GraphQL simplifies the process to query data and build APIs, it is not a silver bullet, Heinlen said. Netflix still faces challenges such as schema management, error handling and distributed writes when it comes to the technology.
It took several months before Heinlen became sold on GraphQL, and it wasn't the technical merits of the technology as much as how it changes how teams and organizations behave and communicate, he said.
Garrett HeinlenSoftware engineer, Netflix
"[GraphQL] starts teams talking to each other on how they can evolve the schema," Heinlen said. "It improves the way front-end and back-end engineers work together. And it acts as a living source of documentation for your system."
Meanwhile, concerns about using technology stewarded by one major company -- Facebook -- dwindled with the formation of the GraphQL Foundation, Heinlen said.
"That helped the people [who] were skeptics to become more interested, since it was no longer dominated by Facebook, and now there's a foundation of multiple companies putting their minds behind it," he said.
Despite Netflix's choice to use GraphQL, Heinlen expressed support for REST, which "has gotten us a very long way and has a lot of good things about it," he said. But GraphQL goes further to help an organization's teams communicate more efficiently and combine multiple product schemas, he said.
"GraphQL promotes a new type of service, a higher-order service. It's like a giant map function in the cloud, and countless clients can develop against it," he said.
Limitations with REST have others looking at GraphQL, as well.
"We use REST, and it feels like we're pushing the limits of what it can do. That's why I wanted to see what Netflix was doing with GraphQL," said Ulf Culbert, an engineer at AB-Tron in Aschaffenburg, Germany.