A Comparative Performance Study of REST and GraphQL APIs: Latency and Throughput under Varying Query Complexity
2026 (English)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE credits
Student thesis
Abstract [en]
Modern web and distributed systems rely heavily on Application Programming Interfaces (APIs), with Representational State Transfer (REST) and GraphQL serving as the primary architectural styles. While performance metrics such as latency and throughput are crucial for user experience and system efficiency, existing research often lacks a detailed analysis of how these APIs perform under varying levels of query complexity. This thesis investigates the performance differences between REST and GraphQL APIs by examining their behavior under comparable workloads and evaluating the impact of increasing query complexity on scalability. Using a design science methodology, a controlled experimental environment was developed with Python, Flask, and SQLite, while performance was evaluated using the Locust load testing tool. Measurements were conducted across three levels of query complexity, ranging from simple lookups to deeply nested relational data, under workloads of 50, 200, and 500 concurrent users. The results indicate that REST consistently delivers lower latency and higher throughput across all test scenarios, demonstrating superior scalability under high concurrency. While both architectures perform similarly for simple queries, GraphQL performance degrades more substantially as query complexity increases due to the additional server-side overhead associated with query parsing and resolver execution. However, GraphQL offers advantages when retrieving deeply nested relational data, where equivalent functionality in REST may require multiple client requests. The findings suggest that REST is better suited for high-volume, performance-critical systems, whereas GraphQL is more appropriate for applications requiring flexible and efficient retrieval of complex, interconnected data.
Place, publisher, year, edition, pages
2026. , p. 45
Keywords [en]
REST APIs, GraphQL, API Performance, Latency, Throughput, Query Complexity
National Category
Computer and Information Sciences
Identifiers
URN: urn:nbn:se:lnu:diva-149324OAI: oai:DiVA.org:lnu-149324DiVA, id: diva2:2096450
Subject / course
Computer Science
Educational program
Web Development Programme, 180 credits
Supervisors
Examiners
2026-08-292026-08-282026-08-29Bibliographically approved