Design Trade-offs in Public Web APIs: An Empirical Comparison of REST and GraphQL under Multi-Entity Access Patterns
Resumo
Web APIs are essential to modernWeb systems, but providers of public APIs cannot always anticipate how external clients will retrieve and combine related resources. API design choices can therefore affect response time, client-side composition effort, maintainability, and system evolution. This paper empirically compares three Web API design strategies for multi-entity data retrieval: resource-oriented REST, aggregated REST, and GraphQL. We implemented all alternatives using the same technology stack and database schema and evaluated them under 12 controlled scenarios varying the number of related entities and retrieved records. Results show that resource-oriented REST becomes inefficient when clients require multiple sequential requests to compose related data, while GraphQL reduces response time by retrieving nested data in a single request. However, when access patterns are known in advance, aggregated REST achieved lower median response times than GraphQL, with API-G being approximately 1.06 to 1.17 times slower across multi-entity scenarios. These findings reveal a key trade-off: aggregated REST favors efficiency for stable access patterns, whereas GraphQL provides greater flexibility for heterogeneous and evolving client needs. The study provides empirical evidence to support Web API design decisions balancing efficiency, flexibility, and evolvability.
Palavras-chave:
Web APIs, API Design, Multi-Entity Data Retrieval, REST, GraphQL, Software Architecture Evolution
Referências
Riku Ala-Laurinaho, Joel Mattila, Juuso Autiosalo, Jani Hietala, Heikki Laaki, and Kari Tammi. 2022. Comparison of REST and GraphQL Interfaces for OPC UA. Computers 11, 5 (2022). DOI: 10.3390/computers11050065
Alan Cha, Erik Wittern, Guillaume Baudart, James C. Davis, Louis Mandel, and Jim A. Laredo. 2020. A principled approach to GraphQL query cost analysis. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (Virtual Event, USA) (ESEC/FSE 2020). Association for Computing Machinery, New York, NY, USA, 257–268. DOI: 10.1145/3368089.3409670
Roy Thomas Fielding. 2000. Architectural Styles and the Design of Network-based Software Architectures. Ph. D. Dissertation. University of California, Irvine, CA.
GraphQL Foundation. 2025. Introduction to GraphQL. [link]. Accessed: 2025-07-03.
Yaroslav Marchuk, Ivan Dyyak, and Ihor Makar. 2023. Performance Analysis of Database Access: Comparison of Direct Connection, ORM, REST API and GraphQL Approaches. In 2023 IEEE 13th International Conference on Electronics and Information Technologies (ELIT). 174–176. DOI: 10.1109/ELIT61488.2023.10310748
Sam Newman. 2015. Backends for Frontends. [link]. Accessed: 2026-05-27.
Muhammad Niswar, Reza Arisandy Safruddin, Anugrayani Bustamin, and Iqra Aswad. 2024. Performance evaluation of microservices communication with REST, GraphQL, and gRPC. International Journal of Electronics and Telecommunication 70, 2 (2024), 429–436.
Red Hat. 2022. What is an API? [link]. Accessed: 2025-07-03.
Carlos Rodríguez, Marcos Báez, Florian Daniel, Fabio Casati, Juan Carlos Trabucco, Luigi Canali, and Gianraffaele Percannella. 2016. REST APIs: A Large-Scale Analysis of Compliance with Principles and Best Practices. In Web Engineering: 16th International Conference, ICWE 2016. Springer, 21–39. DOI: 10.1007/978-3-319-38791-8_2
Sri Lakshmi Vadlamani, Benjamin Emdon, Joshua Arts, and Olga Baysal. 2021. Can GraphQL Replace REST? A Study of Their Efficiency and Viability. In 2021 IEEE/ACM 8th International Workshop on Software Engineering Research and Industrial Practice (SER&IP). 10–17. DOI: 10.1109/SER-IP52554.2021.00009
Naman Vohra and Ida Bagus Kerthyayana Manuaba. 2022. Implementation of REST API vs GraphQL in Microservice Architecture. In 2022 International Conference on Information Management and Technology (ICIMTech). 45–50. DOI: 10.1109/ICIMTech55957.2022.9915098
Bari Hade Variant Wahono, Asfihani, and Umi Laili Yuhana. 2024. Comparative Analysis of Database Access Method Performance on Containerized Application. In 2024 IEEE International Conference on Artificial Intelligence and Mechatronics Systems (AIMS). 1–6. DOI: 10.1109/AIMS61812.2024.10513113
Claes Wohlin, Per Runeson, Martin Höst, Magnus C. Ohlsson, Björn Regnell, and Anders Wesslén. 2024. Experimentation in Software Engineering (2 ed.). Springer.
Alan Cha, Erik Wittern, Guillaume Baudart, James C. Davis, Louis Mandel, and Jim A. Laredo. 2020. A principled approach to GraphQL query cost analysis. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (Virtual Event, USA) (ESEC/FSE 2020). Association for Computing Machinery, New York, NY, USA, 257–268. DOI: 10.1145/3368089.3409670
Roy Thomas Fielding. 2000. Architectural Styles and the Design of Network-based Software Architectures. Ph. D. Dissertation. University of California, Irvine, CA.
GraphQL Foundation. 2025. Introduction to GraphQL. [link]. Accessed: 2025-07-03.
Yaroslav Marchuk, Ivan Dyyak, and Ihor Makar. 2023. Performance Analysis of Database Access: Comparison of Direct Connection, ORM, REST API and GraphQL Approaches. In 2023 IEEE 13th International Conference on Electronics and Information Technologies (ELIT). 174–176. DOI: 10.1109/ELIT61488.2023.10310748
Sam Newman. 2015. Backends for Frontends. [link]. Accessed: 2026-05-27.
Muhammad Niswar, Reza Arisandy Safruddin, Anugrayani Bustamin, and Iqra Aswad. 2024. Performance evaluation of microservices communication with REST, GraphQL, and gRPC. International Journal of Electronics and Telecommunication 70, 2 (2024), 429–436.
Red Hat. 2022. What is an API? [link]. Accessed: 2025-07-03.
Carlos Rodríguez, Marcos Báez, Florian Daniel, Fabio Casati, Juan Carlos Trabucco, Luigi Canali, and Gianraffaele Percannella. 2016. REST APIs: A Large-Scale Analysis of Compliance with Principles and Best Practices. In Web Engineering: 16th International Conference, ICWE 2016. Springer, 21–39. DOI: 10.1007/978-3-319-38791-8_2
Sri Lakshmi Vadlamani, Benjamin Emdon, Joshua Arts, and Olga Baysal. 2021. Can GraphQL Replace REST? A Study of Their Efficiency and Viability. In 2021 IEEE/ACM 8th International Workshop on Software Engineering Research and Industrial Practice (SER&IP). 10–17. DOI: 10.1109/SER-IP52554.2021.00009
Naman Vohra and Ida Bagus Kerthyayana Manuaba. 2022. Implementation of REST API vs GraphQL in Microservice Architecture. In 2022 International Conference on Information Management and Technology (ICIMTech). 45–50. DOI: 10.1109/ICIMTech55957.2022.9915098
Bari Hade Variant Wahono, Asfihani, and Umi Laili Yuhana. 2024. Comparative Analysis of Database Access Method Performance on Containerized Application. In 2024 IEEE International Conference on Artificial Intelligence and Mechatronics Systems (AIMS). 1–6. DOI: 10.1109/AIMS61812.2024.10513113
Claes Wohlin, Per Runeson, Martin Höst, Magnus C. Ohlsson, Björn Regnell, and Anders Wesslén. 2024. Experimentation in Software Engineering (2 ed.). Springer.
Publicado
27/10/2026
Como Citar
GRANATO NETO, Valter; OLIVEIRA, Johnatan; SOUZA, Maurício; MALHEIROS, Neumar.
Design Trade-offs in Public Web APIs: An Empirical Comparison of REST and GraphQL under Multi-Entity Access Patterns. In: BRAZILIAN SYMPOSIUM ON MULTIMEDIA AND THE WEB (WEBMEDIA), 32. , 2026, Lavras/MG.
Anais [...].
Porto Alegre: Sociedade Brasileira de Computação,
2026
.
p. 208-216.
DOI: https://doi.org/10.5753/webmedia.2026.29731.
