Learning GraphQL Query Cost - Inria - Institut national de recherche en sciences et technologies du numérique Access content directly
Conference Papers Year : 2021

Learning GraphQL Query Cost


GraphQL is a query language for APIs and a runtime for executing those queries, fetching the requested data from existing microservices, REST APIs, databases, or other sources. Its expressiveness and its flexibility have made it an attractive candidate for API providers in many industries, especially through the web. A major drawback to blindly servicing a client's query in GraphQL is that the cost of a query can be unexpectedly large, creating computation and resource overload for the provider, and API rate-limit overages and infrastructure overload for the client. To mitigate these drawbacks, it is necessary to efficiently estimate the cost of a query before executing it. Estimating query cost is challenging, because GraphQL queries have a nested structure, GraphQL APIs follow different design conventions, and the underlying data sources are hidden. Estimates based on worst-case static query analysis have had limited success because they tend to grossly overestimate cost. We propose a machine-learning approach to efficiently and accurately estimate the query cost. We also demonstrate the power of this approach by testing it on query-response data from publicly available commercial APIs. Our framework is efficient and predicts query costs with high accuracy, consistently outperforming the static analysis by a large margin.
Fichier principal
Vignette du fichier
ase21.pdf (493.25 Ko) Télécharger le fichier
Origin Files produced by the author(s)

Dates and versions

hal-03469475 , version 1 (07-12-2021)


  • HAL Id : hal-03469475 , version 1


Georgios Mavroudeas, Guillaume Baudart, Alan Cha, Martin Hirzel, Jim A Laredo, et al.. Learning GraphQL Query Cost. ASE 2021 - IEEE/ACM International Conference on Automated Software Engineering -- Industry Showcase, Nov 2021, Melbourne / Virtuel, Australia. ⟨hal-03469475⟩
37 View
394 Download


Gmail Mastodon Facebook X LinkedIn More