{'fraction_non_alphanumeric': 0.021637426900584796, 'fraction_numerical': 0.0035087719298245615, 'mean_word_length': 5.5807692307692305, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Implementation of REST API vs GraphQL in Microservice Architecture

Recently, microservices have become a popular web architecture that implements Application Programming Interfaces (API) for main communication between its services. The Representational State Transfer (REST) has been recognized as a popular framework to develop web APIs. However, the presence of “GraphQL,” an alternative technology to REST, leads to a lot of debates and discussions to see which technology is more effective for communication between clients and server. Although many studies have discussed these two technologies, there is still limited study which covers the details on their implementation and performance in a microservice architecture scenario. Therefore, this paper discusses the implementation of REST and GraphQL technologies and performs a comparative study on the performance of each technology in a microservice architecture system, based on an identical freelance marketplace scenario. In addition, two corresponding gateways, the Ocelot and the HotChocolate, were implemented in this study. The gateways were tested in a local system on 17th March 2022. The test was conducted using a tool called “JMeter” which enables three test cases with distinct numbers of users and loop counts to be produced, with each test case impacting the gateways differently. For comparative analysis, the average “response time” and “throughput” parameters were analyzed. Results indicate that in every test case, REST and GraphQL perform comparably when dealing with queries of type POST and PUT but shows a significant performance difference when processing (GET) queries that involve data retrieval from more than one service.