What news from AWS re:Invent last week will have the most impact on you?
Amazon Q, an AI chatbot for explaining how AWS works.
Super-fast S3 Express storage.
New Graviton 4 processor instances.
Emily Freeman leaving AWS.
I don't use AWS, so none of this will affect me.
Software Development

Apollo Does GraphQL at Scale via Contracts, New Rust Router

GraphQL tooling company Apollo introduced a number of new features and products to support its push to enable the use of GraphQL at scale, including a new Contracts feature and a new Rust-based Apollo Router.
Nov 22nd, 2021 8:00am by
Featued image for: 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.”

Rusty Router

Another aspect of GraphQL at scale comes in the ability to operate quickly, and Apollo’s new Apollo Router provides just that. The Router was built entirely in Rust, replacing the JavaScript and Node.js previously used for the Apollo Gateway, which, the company writes in a blog post, “adds less than 10ms of latency to each operation, and it can process 8x the load of the JavaScript Apollo Gateway.” The choice of Rust was an obvious one, explained DeBergalis, as previously you would have to choose between either speed or safety, and now “we don’t have to choose, anymore.”

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.

“If you think about the scale of a Walmart, or a lot of these other companies that are putting their core consumer-facing experience on the graph, every CPU cycle that you can save is material,” he said. “One of the advantages Rust has with its multi-concurrency model and the way that you’re managing memory without having garbage collection and all of this background processing happening is that you get crazy throughput numbers. We’ve got benchmarks that are showing north of 10,000 concurrent requests on a single machine, all far lower latency than what you can get out of JavaScript or Node. That’s just the strength of the language in our view.”

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.”

Group Created with Sketch.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.