paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A principled approach to GraphQL query cost analysis

一种原则化的 GraphQL 查询代价分析方法
FSE Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering2020匹配度 2/10 · 该论文是 GraphQL 查询代价的静态分析与形式语义工作,虽涉及程序分析和工业落地,但与用户核心方向(PL 与 AI/LLM/Agent 交叉、浮点程序分析、贝叶斯程序分析)没有直接关联。引用 15 inbox
Alan Cha, Erik Wittern, Guillaume Baudart, James C. Davis, Louis Mandel, Jim A. Laredo
crossref: 2026-09-12

AI 速览

一句话:提出线性时间、可证正确的 GraphQL 查询代价静态分析,无需执行即可给出紧致的代价上界。

GraphQL 兼具查询语言与运行时,客户端能简洁地请求极大量数据,过复杂的查询会造成高昂开销甚至影响服务可用性;而现有 API 管理手段不足以估计查询代价。本文提出一种线性时间的 GraphQL 查询代价静态分析,无需执行查询即可度量代价,可部署于独立 API 管理层并适配任意 GraphQL 后端;不同于已有静态方法,它支持影响代价的常见 GraphQL 约定,并基于形式化的 GraphQL 语义证明了正确性。作者在两个商业 GraphQL API 上构建查询—响应语料进行评测:该分析持续给出相对真实响应足够紧致的代价上界,而现有静态分析因不支持这些约定而高估或低估。

问题
GraphQL 查询的表达力使客户端可简洁地请求海量数据,复杂查询代价高昂甚至危及服务可用性,而服务提供方缺乏原则化的手段在执行前估计查询代价。
方法
设计线性时间的 GraphQL 查询静态代价分析,可置于独立 API 管理层并适配任意后端;作者给出 GraphQL 的形式化语义并据此证明分析的正确性,且覆盖影响代价的常见 GraphQL 约定。
评估
在两个商业 GraphQL API 上构建新的查询—响应语料,对比分析预测的代价与真实响应大小;该分析持续给出紧致上界,而现有静态分析因不支持相关约定而高估或低估。
原文摘要(Abstract)

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.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot5867,
  title = {A principled approach to GraphQL query cost analysis},
  author = {Alan Cha and Erik Wittern and Guillaume Baudart and James C. Davis and Louis Mandel and Jim A. Laredo},
  booktitle = {FSE},
  year = {2020},
  doi = {10.1145/3368089.3409670}
}