Apollo Does GraphQL at Scale via Contracts, New Rust Router
GraphQL tooling company Apollo announced a number of new features and products around its federated approach to GraphQL during its annual GraphQL Summit this year. Apollo first launched Federation in 2019 to give organizations the ability to have a single graph for all of their data, while still allowing teams to have independence within that graph, “without experiencing the pitfalls of a monolith.”
Now, the company has launched Federation 2, what Apollo co-founder and Chief Technology Officer Matt DeBergalis calls “a major update to Federation” that was co-designed with Netflix, alongside a new feature called Contracts and “a clean sheet implementation” of the Federation runtime with Apollo Router. Together, DeBergalis said that these all work to enable companies to operate GraphQL at scale.
“We’ve seen comically rapid growth of the graph, and in particular in large companies, so our focus has been on how do we enable scale?” said DeBergalis. “The real story of the graph is about composability. It’s an architecture that lets multiple teams collaborate on a common API, and it’s going to have the same sort of transformative impact on agility and velocity that cloud native has had on the backend side of the stack, and that React and design systems and so on have had on the front end of the stack.”
Contracts for Subsets of the Graph
While Federation works to give organizations this large, unified graph, Contracts helps them to then separate out parts of that graph according to various factors.
“Contracts is an answer to the question, how do I have a unified graph for my whole organization? And how do I have different subsets or pieces of that that I can use in different settings?” said DeBergalis, pointing to APIs that grant access to integration partners as an example. “You need a story for how do I take not my entire graph, but just the piece that I want, to grant to a partner?”
Contracts allow graph teams to expose only specific parts of the graph to partner developers, limit access internally, and generally create a form of access management while still allowing for a single, unified graph. Contracts also allow for access to be limited to things like sensitive information and experimental parts of the graph. DeBergalis also pointed to mobile app development as a perfect use case for Contracts, given the lifecycle commitment necessary for mobile applications.
“One of the interesting things about mobile is that if you ship an app into the Play Store, for example, you can’t take it back and you can’t necessarily change it. It’s out there forever. So, the burden on teams as far as lifecycle management and the ability to understand exactly how mobile apps are using the graph is a lot more significant perhaps than it is with web development. And so what we find is companies that have a large graph don’t necessarily want mobile developers to use everything in the graph,” explained DeBergalis. “Companies are using contracts as a way to essentially draw a line around the parts of the graph that are now appropriate or supported for mobile use, as distinct from other parts of the graph.”
While latency is important with scale, DeBergalis also pointed to energy efficiency as something that comes with the move to Rust, which the company said offers a 4x increase in energy efficiency.
Everybody Gets a Graph
Both the Apollo Router and Apollo Federation 2 were released under the Elastic License, rather than the MIT license the company had previously used. While the Elastic license is not an Open Source Initiative approved license, DeBergalis described it as “permissive” and offering the right balance of openness alongside the ability to monetize, without fear that the product would be offered as-a-service by another company.
“My view is, the best vehicle for us to deliver world-class graph tools that meet the increasingly sophisticated needs of all these companies that are moving toward graph is to have a thriving business model, where increased adoption of the graph translates into increased investment in graph technology that works,” he said. “I think developers are getting pretty savvy about, if I’m going to make a bet on a technology, my evaluation starts with ‘Do I believe in the long term?’ because the worst thing is to pick a technology and then discover that it’s underinvested and it withers and dies.”
Withering and dying is certainly not DeBergalis’ plan — quite the opposite. He said he sees a future where every company has a graph, and those that have a plan for transitioning to GraphQL will outpace those that don’t. To that end, Apollo is investing in education around GraphQL, with its recently introduced online learning platform for GraphQL.
“There’s a roadmap here around how do you bring the graph to partners and other external teams,” said DeBergalis. “We’re really excited to build that out over time.”