REST and GraphQL comparative analysis
The article presents a comparative analysis of the two most commonly used API web design standards - REST and GraphQL. The time and size of HTTP responses returned by applications were tested. Two applications with the same functionalities, performing CRUD operations, on data stored in the non-relational MongoDB database were used for the research. Both applications were based on NodeJS technology. The JMeter tool was used to collect and analyze the data. On the basis of the obtained results, it was found that there were no significant differences in reading the data with a small number of queries and when removing resources. With the increase in the number of queries, a clear advantage of the REST standard was observed. The advantage of GraphQL, both in response time and size, was demonstrated when retrieving specific data.
REST; GraphQL; API; application performance
M. Miłosz, Aplikacje internetowe - od teorii do praktyki, Polskie Towarzystwo Informatyczne, Warszawa, 2008.
What is an API?, Mulesoft, https://www.mulesoft.com/resources/api/what-is-an-api, [22.01.2021].
R. T. Fielding, Architectural Styles and the Design of Network-based Software Architectures, Dissertation, University of California, Irvine, 2020, https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm, [01.12.2020].
P. Erlandsson, J. Remes, Performance Comparison between GraphQL, REST & SOAP, University of Skovde, Dissertation, http://his.divaportal.org/smash/record.jsf?pid=diva2%3A1449837&dswid=7389, 2020, [19.01.2021].
G. Brito, M. T. Valente, REST vs GraphQL: A Controlled Experiment, IEEE International Conference on Software Architecture (ICSA), Salvador, Brazil, (2020) 81-91, doi: 10.1109/ICSA47634.2020.00016, [21.01.2021].
C. Oggier, How fast GraphQL is compared to REST APIs, Haaga-Helia University of Applied Sciences, 2020, http://urn.fi/URN:NBN:fi:amk-2020052714286, [28.01.2021].
T. Eizinger, API Design in Distributed Systems: A Comparison between GraphQL and REST, Master Thesis, University of Applied Science Technikum Wien, 2017, [20.01.2021].
M. Seabra, M. E. Nazario, G. Pinto, REST or GraphQL?: A Performance Comparative Study, Proceedings of the XIII Brazilian Symposium on Software Components, Architectures, and Reuse. Association for Computing Machinery, New York, NY, USA, 2019, https://doi.org/10.1145/3357141.3357149, [29.01.2021].
Apache JMeter, https://jmeter.apache.org/, [20.11.2020].
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.