News API implementation with serverless GraphQL

Loading...
Thumbnail Image

URL

Journal Title

Journal ISSN

Volume Title

Perustieteiden korkeakoulu | Master's thesis

Department

Major/Subject

Mcode

SCI3042

Language

en

Pages

50 + 0

Series

Abstract

GraphQL is a query language for web applications to query server APIs. With GraphQL, web application client declaratively describe the data format they want to receive from the server. The GraphQL server then executes this query and returns the data in the format described by the client. Amazon offers a serverless GraphQL service, called AppSync. With AppSync, the developers do not need to operate and maintain their own servers to implement a GraphQL API. Instead they can setup an AppSync instance that takes care of the GraphQL engine implementation and scales the service capacity automatically according to demand. This thesis evaluated and compared the usage of serverless GraphQL and REST in a case study of implementing a news feed service for a modern web application. The GraphQL performance was evaluated by measuring the overall response time of a single query and subtracting the time that was used in the business logic. Analysing the complexity of the GraphQL implementation was done by comparing the code of GraphQL implementation of the news feed component in the frontend with other frontend components that used REST. The results showed that AppSync has on average 147.0ms overhead latency in the news feed service. However, GraphQL was simpler and easier to use in the frontend development than REST. In addition, GraphQL requires fewer changes in the codebase when a new API endpoint is needed.

GraphQL on kyselykieli, jolla web-sovellukset voivat tehdä API-pyyntöjä palvelimelle. GraphQL:ää käyttäessä web-sovelluksen asiakaslaite kuvailee haluamansa datan deklaratiivisesti ja lähettää tämän pyynnön palvelimelle. GraphQL-palvelin sitten suorittaa saadun kyselyn ja palauttaa datan asiakaslaitteen pyytämässä muodossa. Amazon tarjoaa ''serverless'' GraphQL-palvelua, nimeltä AppSync. AppSync:llä kehittäjien ei tarvitse hallita ja ylläpitää omaa palvelinta toteuttaakseen GraphQL-API:n. Sen sijaan he voivat pystyttää AppSync instanssin, joka hoitaa GraphQL-moottorin toteutuksen ja skaalaa palvelun kapasiteettia automaattisesti kysynnän mukaan. Tämä työ arvioi ja vertasi ''serverless'' GraphQL:n ja REST:n käyttöä tapaustutkimuksen kautta. Tapaustutkimus käsitteli uutissyöteen toteuttamista modernissa web-sovelluksessa. GraphQL:n suorituskyky arvioitiin mittaamalla yksittäisen kyselyn kokonaisvastausaika ja vähentämällä siitä muun muassa tietokantahakuun kulunut aika. GraphQL-toteutuksen kompleksisuuden analysointi tapahtui vertaamalla uutissyötteen frontend-komponentin koodia muihin frontend-komponentteihin, jotka käyttivät REST:iä. Tulokset osoittivat, että AppSync:llä on 147.0ms ylimääräinen latenssi verrattuna REST:iin. Toisaalta, GraphQL:n käyttö frontend-kehityksessä oli yksinkertaisempaa ja helpompaa. Lisäksi, GraphQL:ää käyttäessä koodikantaan tarvitsee tehdä vähemmän muutoksia kun uudelle API-päätteelle on tarvetta.

Description

Supervisor

Vuorimaa, Petri

Thesis advisor

Huhtinen, Virpi

Other note

Citation