Advanced Data Fetching with GraphQL: Case Bakery Service

Loading...
Thumbnail Image
Journal Title
Journal ISSN
Volume Title
Perustieteiden korkeakoulu | Master's thesis
Date
2019-03-11
Department
Major/Subject
Computer Science
Mcode
SCI3042
Degree programme
Master’s Programme in Computer, Communication and Information Sciences
Language
en
Pages
56
Series
Abstract
In today's world building modern applications for multiple environments requires deep knowledge of advanced data fetching solutions. While many longstanding technologies, such as REST and SOAP, have provided robust solutions for most use cases a more advanced data fetching solution is still needed to alleviate issues in efficiency, complexity, and maintainability of current web services. This thesis studies and compares two data fetching approaches: REST and GraphQL in the context of a case study for a web application, called Bakery Service, which possess several issues related to data fetching in its current REST API. An experiment was conducted by first creating separate API implementations for REST and GraphQL. Then the data fetching performance was measured by fetching a single recipe, extracted from the Bakery Service, followed by calculating the total network time of all requests in conjunction with the total size of the response payload and the data utilization percentages based on predetermined set of recipe fields. Additionally, the complexity and maintainability of both technologies were analyzed to gain a better understanding of the non-measurable qualities. The results of the experiment showed that GraphQL performed considerably better than REST in most test cases. Only REST with field level filtering was able to overcome GraphQL in the data utilization part of the test. Also, the qualitative analyzing hinted that by adopting GraphQL the complexity of an API could be reduced while additionally gaining enhanced development capabilities. These results resemble the findings from other similar studies and strengthen the conclusion that GraphQL can be proposed as an advanced data fetching solution for modern data-heavy applications. However, some future work is needed to broaden the study to take aspects such as caching, mutations, and security into account.

Nykyajan modernien sovelluksien luominen eri ympäristöille vaatii syvällistä tietämystä kehittyneistä tiedonhakuratkaisuista ja vaikka monet teknologiaratkaisut, kuten REST tai SOAP, ovat tarjonneet tiedonhakuratkaisuja yleisimpiin käyttötarkoituksiin, on kehittyneemmille tiedonhakuratkaisulle siitä huolimatta tarve. Myös verkkopalvelujen kompleksisuuden ja ylläpidettävyyden hallinnointi sekä datan tehokas hakeminen vaativat uusia ratkaisuja. Tämä työ tutkii ja vertailee kahta tiedonhakumenetelmää: REST ja GraphQL tapaustutkimuksen kontekstissa. Tapaustutkimus kohdistuu verkkopalveluun, jota työssä kutsutaan nimellä Bakery Service, ja jonka nykyinen rajapintatoteutus sisältää useita tiedonhakuongelmia. Työn ohella suoritettiin koe, jota varten luotiin omat rajapintaratkaisut molemmille tutkittaville teknologioille. Kokeessa testattiin tiedonhaun tehokkuutta mittaamalla palvelusta otetun reseptin hakunopeutta rajapinnoista. Myös rajapinnan palauttaman datan koko ja käyttöaste sovelluksessa laskettiin esimääriteltyjen reseptikenttien perusteella. Lisäksi molemmat teknologiat analysoitiin kompleksisuuden ja ylläpidettävyyden suhteen tarkemman kokonaiskuvan saamiseksi. Tutkimuksen tulokset osoittivat sen, että GraphQL suoriutui selkeästi paremmin kuin REST lähes jokaisessa testissä. REST suoriutui paremmin vain data käyttöasteen suhteen, kun haussa hyödynnettiin kenttäkohtaista suodattamista. Laadullinen analyysi antoi myös vihjettä siitä, että GraphQL:n käyttöönotto vähentäisi rajapintatoteutuksen kompleksisuutta antaen samalla käyttöön tehostettuja kehitysominaisuuksia. Saadut tulokset muistuttavat muiden vastaavien tutkimusten tuloksia antaen tukea sille, että GraphQL:n käyttäminen tehokkaaseen tiedonhakuun on suositeltavaa nykyajan dynaamisissa sovelluksissa. Jatkotutkimusta on kuitenkin suoritettava laajemman ymmärryksen saamiseksi ainakin seuraavista osa-alueista: välimuistin käyttö, mutaatiot ja tietoturva.
Description
Supervisor
Hyvönen, Eero
Thesis advisor
Keski-Luopa, Jukka
Kario, Janne
Keywords
GraphQL, REST, data fetching, performance, complexity, maintainability
Other note
Citation