Return to search

Communication with databases : Comparing GraphQL with REST / Kommunikation med databaser : Jämförelse mellan GraphQL och REST

REST and GraphQL are the two dominant Application Programming Interface (API) architectures being used for communication with databases. They differ in a lot of aspects, and as such it is not immediately obvious which architecture is preferable. This thesis aims to shed some light onto this problem by exploring two aspects, developer experience, and performance. The method used to measure the developer experience was a case study, in which participants had to write code that communicates with a REST API and a GraphQL API and then answer questions that describe their experience communicating with both. To test the performance, a case study was done in which 5 different benchmarks were ran comparing the two. The results of the first case study show that GraphQL solutions were perceived to give a more overall picture of what is happening than REST solutions. REST was, however, viewed as easier to complete the tasks with. The results of the second case study show that a server that implements REST architecture has better performance during normal circumstances, but GraphQL shows better performance if data is being requested with specified fields. / REST och GraphQL är de två dominerande applikationsprogrammeringsgränssnitten (API) arkitekturerna som används för att kommunincera med databaser. De skiljer sig i många aspekter och därav är det inte uppenbart vilken arkitektur som föredras. Denna avhandling har som mål att reda ut detta problem genopm att utforska två aspekter, utvecklarupplevelsen och prestandan. Metoderna som användes för att mäta utvecklarupplevelsen var en fallstudie, där deltagarna fick skriva kod som kommunicerar med en REST server och en GraphQL server och sedan besvara frågor som beskriver deras upplevelse med att kommunicera med dessa. För att testa prestandan gjordes en fallstudie där 5 olika benchmarks kördes för att jämföra de två servrarna. Resultatet från våran första fallstudien visar på att GraphQL ansågs ha en bättre helhetbild av vad som händer gentemot REST, men när det kom till själva implementaionen av uppgifterna, ansågs REST vara lättare. Resultaten av den andra fallstudien visar att REST arkitekturen har bättre prestanda under normala omständigheter, men att GraphQL har bättre prestanda när datan efterfrågas med enbart specifika fält.

Identiferoai:union.ndltd.org:UPSALLA1/oai:DiVA.org:kth-319220
Date January 2022
CreatorsShahwali, Ali, Mattsson, Lukas
PublisherKTH, Skolan för elektroteknik och datavetenskap (EECS)
Source SetsDiVA Archive at Upsalla University
LanguageEnglish
Detected LanguageEnglish
TypeStudent thesis, info:eu-repo/semantics/bachelorThesis, text
Formatapplication/pdf
Rightsinfo:eu-repo/semantics/openAccess
RelationTRITA-EECS-EX ; 2022:260

Page generated in 0.0022 seconds