当前位置: X-MOL 学术arXiv.cs.DB › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Learning GraphQL Query Costs (Extended Version)
arXiv - CS - Databases Pub Date : 2021-08-25 , DOI: arxiv-2108.11139
Georgios Mavroudeas, Guillaume Baudart, Alan Cha, Martin Hirzel, Jim A. Laredo, Malik Magdon-Ismail, Louis Mandel, Erik Wittern

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.

中文翻译:

学习 GraphQL 查询成本(扩展版)

GraphQL 是一种用于 API 的查询语言和用于执行这些查询、从现有微服务、REST API、数据库或其他来源获取请求数据的运行时。它的表现力和灵活性使其成为许多行业的 API 提供商的有吸引力的候选者,尤其是通过网络。在 GraphQL 中盲目地为客户端的查询提供服务的一个主要缺点是查询的成本可能会出乎意料地大,从而为提供者造成计算和资源过载,以及为客户端造成 API 速率限制和基础设施过载。为了减轻这些缺点,有必要在执行之前有效地估计查询的成本。估算查询成本具有挑战性,因为 GraphQL 查询具有嵌套结构,GraphQL API 遵循不同的设计约定,并且隐藏底层数据源。基于最坏情况静态查询分析的估计取得了有限的成功,因为它们往往会严重高估成本。我们提出了一种机器学习方法来高效准确地估计查询成本。我们还通过在来自公开可用商业 API 的查询-响应数据上对其进行测试来展示这种方法的强大功能。我们的框架是高效的,可以高精度地预测查询成本,始终在很大程度上优于静态分析。我们还通过在来自公开可用商业 API 的查询-响应数据上对其进行测试来展示这种方法的强大功能。我们的框架是高效的,可以高精度地预测查询成本,始终在很大程度上优于静态分析。我们还通过在来自公开可用商业 API 的查询-响应数据上对其进行测试来展示这种方法的强大功能。我们的框架是高效的,可以高精度地预测查询成本,始终在很大程度上优于静态分析。
更新日期:2021-08-26
down
wechat
bug