Blaze:编译 JSON Schema 以实现 10 倍加速验证
Blaze: Compiling JSON Schema for 10x Faster Validation
AI总结:
Blaze 通过将 JSON Schema 提前编译为高效表示并融合多项独特优化,在多种数据集上实现平均约 10 倍的验证加速,同时严格遵循规范并避免现有验证器的错误结果。
摘要:
JSON Schema 为 Web API 开发者提供了有用的防护机制,以保证客户端提供的半结构化 JSON 输入符合预定义结构。这对于确保所接收输入数据的正确性以及避免因处理未正确验证的输入而引发的潜在安全问题都十分重要。然而,这一验证过程可能非常耗时,并为每个请求增加额外开销。JSON Schema 规范中不同关键字的复杂交互可能会增加验证时间。由于热门 API 每秒可能处理数千个请求,而 Schema 变化并不频繁,我们观察到可以提前解决部分复杂性,从而实现更快的验证。我们的 JSON Schema 验证器 Blaze 能在数秒到数分钟内将复杂 Schema 编译为高效表示,在构建阶段仅增加极小的开销。Blaze 融合了多项独特的优化技术,在多种数据集上与现有验证器相比,平均将验证时间缩短约 10 倍。在某些情况下,与次快的验证器相比,Blaze 实现了多个数量级的验证时间缩减。我们还证明,若干流行的验证器在某些情况下会产生错误结果,而 Blaze 始终保持对 JSON Schema 规范的严格遵循。
英文摘要:
JSON Schemas provide useful guardrails for developers of Web APIs to guarantee that the semi-structured JSON input provided by clients matches a predefined structure. This is important both to ensure the correctness of the data received as input and also to avoid potential security issues from processing input that is not correctly validated. However, this validation process can be time-consuming and adds overhead to every request. Different keywords in the JSON Schema specification have complex interactions that may increase validation time. Since popular APIs may process thousands of requests per second and schemas change infrequently, we observe that we can resolve some of the complexity ahead of time in order to achieve faster validation. Our JSON Schema validator, Blaze, compiles complex schemas to an efficient representation in seconds to minutes, adding minimal overhead at build time. Blaze incorporates several unique optimizations to reduce the validation time by an average of approximately 10x compared existing validators on a variety of datasets. In some cases, Blaze achieves a reduction in validation time of multiple orders of magnitude compared to the next fastest validator. We also demonstrate that several popular validators produce incorrect results in some cases, while Blaze maintains strict adherence to the JSON Schema specification.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。