-

Amsterdam, Netherlands
Back to Schedule

Benjamin Rabier

Deep Dive Into a GraphQL Federation Gateway, From Query Planning To the Execution

Studio
GraphQL in ProductionIntermediateFederation and distributed systems

Session description

Traditional GraphQL servers execute queries field by field with a depth-first algorithm as defined in the GraphQL specification. In contrast, GraphQL federation gateways need to partition the query and retrieve chunks of data from external data sources, creating new challenges. We'll present how we solved those challenges with a focus on performance. The first, query planning, is to find the best possible plan with the multiple possibilities federation offers to unify your data and the various data sources with their requirements. We express this problem as a graph of possibilities and solve it as a Steiner Tree problem. The second challenge is performant execution. As we need to read and write overlapping chunks of the response in parallel, it's hard to be as efficient as a traditional GraphQL server writing a response iteratively with independent fields. We build an execution DAG with field dependencies, parallelizing work as much as possible without any lock on the response. We also pre-compute the expected data shape to ingest and validate incoming data into the response without any intermediate memory allocation.


Session speakers

Benjamin Rabier

Grafbase, Software Engineer

Federation & distributed systems

Living close to Paris, I've been at Grafbase for over two years building the GraphQL federation gateway among other things.

Get your ticket

Join three transformative days of expert insights and innovation to shape the next decade of APIs!

Get tickets
COMMUNITYDEVELOPER EXPERIENCEAPIsTOOLS & LIBRARIESCOMMUNITYDEVELOPER EXPERIENCEAPIsTOOLS & LIBRARIES
OPEN SOURCEFEDERATIONECOSYSTEMSTRACING & OBSERVABILITYOPEN SOURCEFEDERATIONECOSYSTEMSTRACING & OBSERVABILITY
BEST PRACTICESWORKSHOPSSCHEMASSECURITYBEST PRACTICESWORKSHOPSSCHEMASSECURITY