The main aim of the study is to compare the performance of two API approaches, REST and GraphQL, in the context of data retrieval. Two applications with identical functionality have been developed in NestJS using a PostgreSQL database. Performance tests have been carried out using Grafana k6, simulating loads from 1,000 to 24,000 users. REST achieves better response times and throughput in simple queries from a single table. GraphQL shows better performance in scenarios involving complex queries from four related tables. In scenarios involving partial field selection, GraphQL returns significantly smaller responses – up to 94% smaller than REST. The results indicate that REST is more efficient in simple and high-load scenarios, while GraphQL performs better in complex data structures.
References
[1] R.T. Fielding, Architectural Styles and the Design of Network-based Software Architectures, PhD dissertation, University of California, Irvine, 2000.
[2] P. Linjanja, Scalable Application Development with NestJS. Leverage REST, GraphQL, microservices, testing, and deployment for seamless growth, Pact Publishing, 2025.
[3] M. Niswar, R. A. Safruddin, A. Bustamin, I. Aswad, Performance evaluation of microservices communication with REST, GraphQL, and gRPC, Int. J. Electron. Telecommun. 70(2) (2024) 429–436, https://doi.org/10.24425/ijet.2024.149562.
[4] L. Kamiński, M. Kozłowski, D. Sporysz, K. Wolska, P. Zaniewski, R. Roszczyk, Comparative review of selected Internet communication protocols, Found. Comput. Decis. Sci. 48(1) (2023) 39–56, https://doi.org/10.2478/fcds-2023-0003.
[5] A. Lawi, B. L. Panggabean, T. Yoshida, Evaluating GraphQL and REST API services performance in a massive and intensive accessible information system, Computers 10(11) (2021) 138, https://doi.org/10.3390/computers10110138.
[6] D. A. Hartina, A. Lawi, B. L. E. Panggabean, Performance analysis of GraphQL and RESTful in SIM LP2M of the Hasanuddin University, In 2018 2nd East Indonesia Conference on Computer and Information Technology (EIConCIT) IEEE (2018) 237–240, https://doi.org/10.1109/EIConCIT.2018.8878524.
[7] R. Ala-Laurinaho, J. Mattila, J. Autiosalo, J. Hietala, H. Laaki, K. Tammi, Comparison of REST and GraphQL Interfaces for OPC UA, Computers 11(5) (2022) 65, https://doi.org/10.3390/computers11050065.
[8] E. Lee, K. Kwon, J. Yun, Performance Measurement of GraphQL API in Home ESS Data Server, In 2020 International Conference on Information and Communication Technology Convergence (ICTC) IEEE (2020) 1929–1931, https://doi.org/10.1109/ictc49870.2020.9289569.
[9] P. Margański, B. Pańczyk, REST and GraphQL comparative analysis, J. Comput. Sci. Inst. 19 (2021) 89–94, https://doi.org/10.35784/jcsi.2473.
[10] Y. Marchuk, I. Dyyak, I. Makar, 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) IEEE (2023) 174–176, https://doi.org/10.1109/ELIT61488.2023.10310748.
[11] N. Vohra, I. B. K. Manuaba, Implementation of REST API vs GraphQL in microservice architecture, In 2022 International Conference on Information Management and Technology (ICIMTech) IEEE (2022) 45–50, https://doi.org/10.1109/ICIMTech55935.2022.9915244.
[12] S. M. Ireland, A. C. R. Martin, GraphQL for the delivery of bioinformatics web APIs and application to ZincBind, Bioinform. Adv. 1(1) (2021) vbab023 https://doi.org/10.1093/bioadv/vbab023.
[13] O. Hartig, J. Pérez, An initial analysis of Facebook's GraphQL language, Proceedings of the 11th Alberto Mendelzon International Workshop on Foundations of Data Management (AMW), CEUR Workshop Proceedings 1912 (2017) 1–10.
[14] M. Vogel, S. Weber, C. Zirpins, Experiences on migrating RESTful web services to GraphQL, In Service-Oriented Computing – ICSOC 2017 Workshops: ASOCA, ISyCC, WESOACS, and Satellite Events, Málaga, Spain, November 13–16, 2017, Revised Selected Papers, Springer, Cham (2018) 283–295, https://doi.org/10.1007/978-3-319-91764-1_23.
[15] O. Bhamare, P. Gite, A. Lohani, K. Choudhary, J. Choudhary, Design and Implementation of Online Legal Forum to Complain and Track UGC Cases using NextJs and GraphQL, In 2023 10th International Conference on Signal Processing and Integrated Networks (SPIN) IEEE (2023) 230–234, https://doi.org/10.1109/SPIN55947.2023.10074892.
[16] G. Brito, T. Mombach, M. T. Valente, Migrating to GraphQL: A practical assessment, In 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER) IEEE (2019) 140–150, https://doi.org/10.1109/SANER.2019.8667986.
[17] M. Mikuła, M. Dzieńkowski, Comparison of REST and GraphQL web technology performance, J. Comput. Sci. Inst. 16 (2020) 309–316, https://doi.org/10.35784/jcsi.2077.
[18] N. Braunisch, T. Reiplinger, R. Lehmann, Leveraging GraphQL for Large-Scale Queries on Digital Twins in Industry 4.0, In 2024 IEEE International Conference on Industrial Technology (ICIT) IEEE (2024) 1–6, https://doi.org/10.1109/ICIT58233.2024.10541016.
[19] I. Koren, N. Jansen, J. Michael, B. Rumpe, E. Böse, A Low-Code Approach for Data View Extraction from Engineering Models with GraphQL, In 2023 ACM/IEEE International Conference on Model Driven Engineering Languages and Systems Companion (MODELS-C) IEEE (2023) 888–892, https://doi.org/10.1109/MODELS-C59198.2023.00139.
[20] A. Quiña-Mera, P. Fernández, J. M. García, A. Ruiz-Cortés, GraphQL: A systematic mapping study, ACM Comput. Surv. 55(10) (2023) 1–35, https://doi.org/10.1145/3561818.
[21] S. L. Vadlamani, B. Emdon, J. Arts, O. Baysal, 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) IEEE (2021) 10–17, https://doi.org/10.1109/SERIP52588.2021.00009.
[22] A PostgreSQL port of the Northwind database, https://github.com/pthom/northwind_psql, [11.05.2025].