A Principled Approach to GraphQL Query Cost Analysis

09/11/2020
by   Alan Cha, et al.
0

The landscape of web APIs is evolving to meet new client requirements and to facilitate how providers fulfill them. A recent web API model is GraphQL, which is both a query language and a runtime. Using GraphQL, client queries express the data they want to retrieve or mutate, and servers respond with exactly those data or changes. GraphQL's expressiveness is risky for service providers because clients can succinctly request stupendous amounts of data, and responding to overly complex queries can be costly or disrupt service availability. Recent empirical work has shown that many service providers are at risk. Using traditional API management methods is not sufficient, and practitioners lack principled means of estimating and measuring the cost of the GraphQL queries they receive. In this work, we present a linear-time GraphQL query analysis that can measure the cost of a query without executing it. Our approach can be applied in a separate API management layer and used with arbitrary GraphQL backends. In contrast to existing static approaches, our analysis supports common GraphQL conventions that affect query cost, and our analysis is provably correct based on our formal specification of GraphQL semantics. We demonstrate the potential of our approach using a novel GraphQL query-response corpus for two commercial GraphQL APIs. Our query analysis consistently obtains upper cost bounds, tight enough relative to the true response sizes to be actionable for service providers. In contrast, existing static GraphQL query analyses exhibit over-estimates and under-estimates because they fail to support GraphQL conventions.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/25/2021

Learning GraphQL Query Costs (Extended Version)

GraphQL is a query language for APIs and a runtime for executing those q...
research
07/06/2023

A Logical Way to Negotiate Services

Service providers commonly provide only a fixed catalog of services to t...
research
07/30/2019

An Empirical Study of GraphQL Schemas

GraphQL is a query language for APIs and a runtime to execute queries. U...
research
02/13/2019

SaGe: Web Preemption for Public SPARQL Query Services

To provide stable and responsive public SPARQL query services, data prov...
research
08/02/2020

Privacy-Aware Data Cleaning-as-a-Service (Extended Version)

Data cleaning is a pervasive problem for organizations as they try to re...
research
08/08/2021

Data Analysis: Communicating with Offshore Vendors using Instant Messaging Services

The purpose of this study is to find whether the choice of correct analy...
research
09/17/2018

"FabSearch" : A 3D CAD Model Based Search Engine for Sourcing Manufacturing Services

In this paper, we present "FabSearch", a prototype search engine for sou...

Please sign up or login with your details

Forgot password? Click here to reset