API Composition at Scale: GraphQL Federation vs. REST Aggregation

Kiran Kumar Pappula, Sunil Anasuri · International Journal of Emerging Trends in Computer Science and Information Technology · 2021

With the emergence of distributed systems in the contemporary world, orchestration and composition of a wide variety of microservices has become an essential aspect of developing scalable and maintainable software systems. In the following sections, the paper will guide the reader through the concept of API composition at scale and compare the two most popular approaches: GraphQL Federation and REST-based Aggregation. As microservice architectures have increasingly gained popularity, so have API gateways and composition layers to make sense of the relations between heterogeneous services. GraphQL Federation: The addition of GraphQL Federation enables services to expose a single, combined GraphQL schema to clients, allowing them to execute queries that cross service boundaries transparently. On the contrary, REST Aggregation is based on the composition of the REST endpoint responses on an API gateway or an aggregation level. In this work, the approaches are compared with each other in terms of latency, developer experience, and maintainability complexity. With empirical data and analysis of architecture and performance, we demonstrate that although GraphQL Federation offers better extensibility and a schema-driven development experience, REST Aggregation is more approachable and easier to work with in less-connected service environments. We employ architectural design, real-world testing, and benchmarking. Observations show that GraphQL Federation can significantly decrease client-side logic and accelerate the development pace, however, at the expense of increased orchestration complexity. The paper extends the knowledge in the area of scalable API composition. It serves as a guide for system architects to select the most suitable approach for addressing the context-specific situation of large-scale service integration

Read the paper · More papers on PaperTik