Performance evaluation of REST and GraphQL API aproaches in data retrieval scenarios using NestJS - Stępień, Kacper; Skublewska-Paszkowska, Maria (Journal of Computer Sciences Institute, 2025)
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.