Evaluating GraphQL and REST API Services Performance in a Massive and Intensive Accessible Information System
Abstract
:1. Introduction
2. Materials and Methods
2.1. Evaluated System Architecture
2.2. Data Sources
2.3. Application Programming Interface (API)
2.3.1. Representational State Transfer (REST)
2.3.2. GraphQL
2.3.3. Architectural Difference of REST and GraphQL
2.4. Performance Measurements
3. Experiment Design
3.1. Data Model
3.2. REST Implementation
3.3. GraphQL Implementation
4. Results
4.1. Response Time
4.2. Throughput
4.3. CPU Load
4.4. Memory Utilization
5. Discussion
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Brito, G.; Valente, M.T. REST vs GraphQL: A Controlled Experiment. In Proceedings of the 2020 IEEE International Conference on Software Architecture (ICSA), Salvador, Brazil, 16–20 March 2020; pp. 81–91. [Google Scholar]
- Vadlamani, S.L.; Emdon, B.; Arts, J.; Baysal, O. Can GraphQL Replace REST? A Study of Their Efficiency and Viability. In Proceedings of the 2021 IEEE/ACM 8th International Workshop on Software Engineering Research and Industrial Practice (SER&IP), Madrid, Spain, 4 June 2021; pp. 10–17. [Google Scholar]
- Eizinger, T. API Design in Distributed Systems: A Comparison between GraphQL and REST. Master’s Thesis, University of Applied Sciences Technikum Wien, Vienna, Austria, 4 May 2017. Available online: https://eizinger.io/assets/Master-Thesis.pdf (accessed on 9 March 2021).
- Ghebremicael, E.S. Transformation of REST API to GraphQL for OpenTOSCA. Master’s Thesis, Universität Stuttgart, Stuttgart, Germany, 8 November 2017. [Google Scholar]
- Fielding, R.T. Architectural Styles and the Design of Network-Based Software Architectures. Ph.D. Thesis, University California at Irvine, Irvine, CA, USA, 2000. Available online: https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation.pdf (accessed on 21 June 2021).
- Lyu, S. REST APIs. In Practical Rust Web Projects, 1st ed.; Lyu, S., Ed.; Apress: Berkeley, CA, USA, 2021; pp. 55–102. [Google Scholar]
- Ozdemir, E. A General Overview of RESTful Web Services. In Applications and Approaches to Object-Oriented Software Design: Emerging Research and Opportunities, 1st ed.; Altan, Z., Ed.; IGI Global: Hershey, PA, USA, 2020; pp. 133–165. [Google Scholar]
- Facebook Inc. GraphQL Specification (Draft). Available online: http://spec.graphql.org/July2015/ (accessed on 9 March 2021).
- Jamil, H.M. Design of declarative graph query languages: On the choice between value, pattern and object based representations for graphs. In Proceedings of the IEEE 28th International Conference on Data Engineering Workshops, Arlington, VA, USA, 1–5 April 2012; pp. 178–185. [Google Scholar]
- Welch, N. An Introduction to GraphQL. In Proceedings of the SREcon19Americas, USENIX Association, Brooklyn, NY, USA, 25–27 March 2019; Available online: https://www.usenix.org/conference/srecon19americas/presentation/welch (accessed on 10 September 2021).
- Byron, L. GraphQL: A Data Query Language. FACEBOOK Engineering, Core Data, Developer Tools. 2015. Available online: https://engineering.fb.com/2015/09/14/core-data/graphql-a-data-query-language/ (accessed on 9 March 2021).
- Mikuła, M.; Dzieńkowski, M. Comparison of REST and GraphQL web technology performance. J. Comput. Sci. Inst. 2020, 16, 309–316. [Google Scholar] [CrossRef]
- Seabra, M.; Nazário, M.F.; Pinto, G. REST or GraphQL? A Performance Comparative Study. In Proceedings of the ACM XIII Brazilian Symposium on Software Components, Architectures and Reuse (SBCARS), Salvador, Brazil, 23–27 September 2019; pp. 123–132. [Google Scholar]
- Vesić, M.; Nenad Kojić, N. Comparative Analysis of Web Application Performance in Case of Using REST versus GraphQL. In Proceedings of the Fourth International Scientific Conference on Recent Advances in Information Technology, Tourism, Economics, Management and Agriculture (ITEMA), Online-Virtual, 8 October 2020; pp. 17–24. Available online: https://www.itema-conference.com/wp-content/uploads/2021/03/0_Itema-2020-Conference-Proceedings_Draft.pdf#page=23 (accessed on 21 June 2021).
- Gustavsson, K.; Stenlund, E. Efficient Data Communication between a Webclient and a Cloud Environment. Master’s Thesis, Dept. Electrical and Info. Technology, Faculty of Engineering, LTH, Lund University, Lund, Sweden, 23 June 2016. Available online: https://lup.lub.lu.se/luur/download?func=downloadFile&recordOId=8885754&fileOId=8885760 (accessed on 21 June 2021).
- Hartina, D.A.; Lawi, A.; Panggabean, B.L.E. Performance analysis of GraphQL and REST in SIM LP2M of the Hasanuddin University. In Proceedings of the IEEE 2nd East Indonesia Conf. on Computer and Information Technology (EIConCIT), Makassar, Indonesia, 6 November 2018; pp. 237–240. [Google Scholar]
- Dudjak, M.; Martinović, G. An API-first methodology for designing a microservice-based Backend as a Service platform. Inf. Technol. Control 2020, 49, 206–223. [Google Scholar] [CrossRef]
- Muehlen, M.Z.; Nickerson, J.V.; Swenson, K.D. Developing web services choreography standards—The case of REST vs. SOAP. Decis. Support Syst. 2005, 40, 9–29. [Google Scholar] [CrossRef]
- Choi, M. A performance analysis of RESTful open API information system. In Proceedings of the International Conference on Future Generation Information Technology (FGIT 2012), Gangneug, Korea, 16–19 December 2012; Lecture Notes in Computer Science. Kim, T., Lee, Y., Fang, W., Eds.; Springer: Berlin/Heidelberg, Germany, 2012; Volume 7709, pp. 59–64. [Google Scholar]
- Cederlund, M. Performance of Frameworks for Declarative Data Fetching: An Evaluation of Falcor and Relay+ GraphQL. Master’s Thesis, KTH, School of Information and Communication Technology (ICT), Stockholm, Sweden, 4 July 2016. Available online: https://www.diva-portal.org/smash/record.jsf?pid=diva2%3A1045900&dswid=9212 (accessed on 9 March 2021).
- Hartig, O.; Pérez, J. An initial analysis of Facebook’s GraphQL language. In Proceedings of the 11th Alberto Mendelzon International Workshop on Foundations of Data Management and the Web, Montevideo, Uruguay, 7–9 June 2017; pp. 1–10. Available online: http://repositorio.uchile.cl/handle/2250/169110 (accessed on 21 June 2021).
- Wittern, E.; Cha, A.; Davis, J.C.; Baudart, G.; Mandel, L. An Empirical Study of GraphQL Schemas. Service-Oriented Computing; ICSOC 2019. Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2019; Volume 11895. [Google Scholar] [CrossRef] [Green Version]
- Helgason, A.F. Performance Analysis of Web Services: Comparison between RESTful & GraphQL Web Services. Master’s Thesis, School of Informatics, University of Skövde, Skövde, Sweden, 11 June 2017. Available online: https://www.diva-portal.org/smash/record.jsf?pid=diva2%3A1107850&dswid=8398 (accessed on 21 June 2021).
- Cha, A.; Wittern, E.; Baudart, G.; Davis, J.C.; Mandel, L.; Laredo, J.A. 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, Online, 4–9 November 2020; pp. 257–268. [Google Scholar] [CrossRef]
Trial Test | GraphQL (ms) | RESTful (ms) | Trial Test | GraphQL (ms) | RESTful (ms) |
---|---|---|---|---|---|
1 | 1840 | 938 | 11 | 1840 | 906 |
2 | 1830 | 969 | 12 | 1860 | 907 |
3 | 1860 | 906 | 13 | 1840 | 922 |
4 | 1830 | 907 | 14 | 1860 | 906 |
5 | 1860 | 891 | 15 | 1840 | 891 |
6 | 2020 | 906 | 16 | 1810 | 938 |
7 | 1860 | 907 | 17 | 1840 | 1000 |
8 | 1810 | 922 | 18 | 1830 | 938 |
9 | 2130 | 891 | 19 | 1840 | 921 |
10 | 1860 | 891 | 20 | 1830 | 1000 |
Time Interval (ms) | GraphQL (#requests) | RESTful (#requests) | Time Interval (ms) | GraphQL (#requests) | RESTful (#requests) |
---|---|---|---|---|---|
00–10 | 3117 | 5175 | 100–110 | 2818 | 4545 |
10–20 | 3000 | 4500 | 110–120 | 2917 | 4583 |
20–30 | 2666 | 4666 | 120–130 | 2923 | 4615 |
30–40 | 2750 | 4500 | 130–140 | 2857 | 4571 |
40–50 | 2800 | 4200 | 140–150 | 2867 | 4600 |
50–60 | 3000 | 4333 | 150–160 | 2875 | 4625 |
60–70 | 2857 | 4285 | 160–170 | 2823 | 4584 |
70–80 | 2875 | 4250 | 170–180 | 2778 | 4611 |
80–90 | 2777 | 4555 | 180–190 | 2789 | 4631 |
90–100 | 2900 | 4500 | 190–200 | 2750 | 4600 |
Time (ms) | GraphQL (%) | RESTful (%) | Time (ms) | GraphQL (%) | RESTful (%) |
---|---|---|---|---|---|
10 | 48.0 | 82.5 | 110 | 47.0 | 75.8 |
20 | 49.0 | 73.4 | 120 | 48.6 | 72.0 |
30 | 44.4 | 77.8 | 130 | 48.7 | 76.9 |
40 | 45.8 | 75.0 | 140 | 47.6 | 76.2 |
50 | 46.7 | 70.0 | 150 | 47.8 | 78.8 |
60 | 50.0 | 72.2 | 160 | 47.9 | 77.1 |
70 | 47.6 | 70.0 | 170 | 47.1 | 76.4 |
80 | 47.9 | 70.8 | 180 | 46.3 | 76.9 |
90 | 46.3 | 75.9 | 190 | 46.5 | 75.0 |
100 | 48.3 | 80.8 | 200 | 45.8 | 76.7 |
Time (ms) | GraphQL (MB) | RESTful (MB) | Time (ms) | GraphQL (MB) | RESTful (MB) |
---|---|---|---|---|---|
10 | 45.20 | 67.50 | 110 | 40.86 | 65.18 |
20 | 43.50 | 77.63 | 120 | 42.30 | 78.75 |
30 | 38.66 | 69.99 | 130 | 42.38 | 69.23 |
40 | 39.88 | 67.50 | 140 | 41.43 | 68.57 |
50 | 40.60 | 63.00 | 150 | 41.57 | 59.00 |
60 | 43.50 | 65.00 | 160 | 41.69 | 69.38 |
70 | 41.43 | 78.33 | 170 | 40.93 | 68.76 |
80 | 41.69 | 63.75 | 180 | 40.28 | 69.17 |
90 | 40.27 | 68.33 | 190 | 40.44 | 79.47 |
100 | 42.05 | 57.50 | 200 | 39.88 | 69.00 |
Response Time (ms) | Throughput (requests) | CPU Load (%) | Memory Utilz. (MB) | |||||
---|---|---|---|---|---|---|---|---|
GraphQL | REST | GraphQL | REST | GraphQL | REST | GraphQL | REST | |
Average | 1864.50 | 922.85 | 2856.95 | 4546.45 | 47.37% | 75.50% | 41.43 | 68.75 |
Stdev | 75.77 | 32.99 | 103.01 | 201.18 | 1.31% | 3.34% | 1.49 | 6.06 |
p-value | 7.37117 × 10−21 | 2.10916 × 10−19 | 2.35697 × 10−18 | 4.69417 × 10−14 |
Response Time (ms) | Throughput (requests) | CPU Load (%) | Memory Utilz. (MB) | |||||
---|---|---|---|---|---|---|---|---|
GraphQL | REST | GraphQL | REST | GraphQL | REST | GraphQL | REST | |
Average | 1864.50 | 922.85 | 2856.95 | 4546.45 | 47.37% | 75.50% | 41.43 | 68.75 |
Maximum | 2130 | 1000 | 3117 | 5175 | 50.00% | 82.45% | 45.20 | 79.47 |
Quartile 3 | 1860 | 938 | 2904 | 4612 | 48.08% | 76.96% | 42.11 | 69.53 |
Median | 1840 | 907 | 2857 | 4577 | 47.62% | 76.05% | 41.43 | 68.66 |
Quartile 1 | 1830 | 906 | 2786 | 4500 | 46.44% | 73.10% | 40.40 | 65.13 |
Minimum | 1810 | 891 | 2666 | 4200 | 44.43% | 70.00% | 38.66 | 57.50 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Lawi, A.; Panggabean, B.L.E.; Yoshida, T. Evaluating GraphQL and REST API Services Performance in a Massive and Intensive Accessible Information System. Computers 2021, 10, 138. https://doi.org/10.3390/computers10110138
Lawi A, Panggabean BLE, Yoshida T. Evaluating GraphQL and REST API Services Performance in a Massive and Intensive Accessible Information System. Computers. 2021; 10(11):138. https://doi.org/10.3390/computers10110138
Chicago/Turabian StyleLawi, Armin, Benny L. E. Panggabean, and Takaichi Yoshida. 2021. "Evaluating GraphQL and REST API Services Performance in a Massive and Intensive Accessible Information System" Computers 10, no. 11: 138. https://doi.org/10.3390/computers10110138
APA StyleLawi, A., Panggabean, B. L. E., & Yoshida, T. (2021). Evaluating GraphQL and REST API Services Performance in a Massive and Intensive Accessible Information System. Computers, 10(11), 138. https://doi.org/10.3390/computers10110138