[论文解读] A Benchmark of JSON-compatible Binary Serialization Specifications
本文提出了一项可复现的、开源的基准测试,涵盖13种与JSON兼容的二进制序列化格式,使用了来自各行业的27份真实JSON文档。该研究提出了一种基于文档大小、结构和冗余度的新型分层分类法(Tier 1–3),并发现顺序的、基于模式的格式(如ASN.1 PER和Apache Avro)在空间效率方面优于无模式格式和压缩JSON。
We present a comprehensive benchmark of JSON-compatible binary serialization specifications using the SchemaStore open-source test suite collection of over 400 JSON documents matching their respective schemas and representative of their use across industries. We benchmark a set of schema-driven (ASN.1, Apache Avro, Microsoft Bond, Cap'n Proto, FlatBuffers, Protocol Buffers, and Apache Thrift) and schema-less (BSON, CBOR, FlexBuffers, MessagePack, Smile, and UBJSON) JSON-compatible binary serialization specifications. Existing literature on benchmarking JSON-compatible binary serialization specifications demonstrates extensive gaps when it comes to binary serialization specifications coverage, reproducibility and representativity, the role of data compression in binary serialization and the choice and use of obsolete versions of binary serialization specifications. We introduce a tiered taxonomy for JSON documents consisting of 36 categories classified as Tier 1, Tier 2 and Tier 3 as a common basis to class JSON documents based on their size, type of content, characteristics of their structure and redundancy criteria. We built and published a free-to-use online tool to automatically categorize JSON documents according to our taxonomy that generates related summary statistics. In the interest of fairness and transparency, we adhere to reproducible software development standards and publicly host the benchmark software and results on GitHub.
研究动机与目标
- 解决现有针对与JSON兼容的二进制序列化格式的基准测试中的关键缺口,包括覆盖范围、可复现性和代表性。
- 开发一个标准化、自动化且可扩展的基准测试平台,用于评估多样化真实JSON数据的空间效率。
- 研究数据压缩对基于模式和无模式二进制序列化格式在空间效率方面的影响。
- 基于大小、结构、内容类型和冗余度,建立新的JSON文档分类体系(Tier 1–3),以提升基准测试的代表性。
- 提供一个透明的、开源的框架,包含公开托管的结果和代码,以支持可复现研究和未来扩展。
提出的方法
- 构建了36类JSON文档的分层分类体系(Tier 1:<100字节,Tier 2:100–1000字节,Tier 3:≥1000字节),依据大小、内容类型、结构和冗余度进行分类。
- 从真实工业应用场景中收集并整理了27份具有代表性的JSON文档,与SchemaStore的测试套件保持一致。
- 使用GitHub Actions实现了一个自动化、确定性的基准测试平台,用于执行13种二进制格式及不同压缩级别的序列化操作。
- 测量了所有格式、压缩级别和文档类别组合下的原始大小和聚合大小指标(中位数、平均值、压缩率)。
- 生成可视化图表(柱状图和箱线图),并将结果和源代码公开托管在GitHub上,采用Apache-2.0许可证。
- 采用一致且可复现的流水线,确保公平性和透明度,并支持未来对新格式和数据集的扩展。
实验结果
研究问题
- RQ1与JSON相比,与JSON兼容的无模式二进制序列化规范在空间效率方面如何?
- RQ2与JSON和无模式格式相比,与JSON兼容的基于模式的二进制序列化规范在空间效率方面如何?
- RQ3与基于指针的二进制序列化规范相比,顺序二进制序列化规范在空间效率方面如何?
- RQ4与未压缩和压缩的二进制序列化规范相比,压缩JSON在空间效率方面如何?
主要发现
- 无论是否基于模式,顺序二进制序列化格式始终比基于指针的格式更具空间效率。
- 无模式二进制格式(如MessagePack、Smile和FlexBuffers)仅在特定文档类型上提升空间效率:MessagePack在Tier 1(<100字节)上表现更优,Smile在Tier 3(≥1000字节)上更优,FlexBuffers在高冗余文本数据上更优。
- 无论是未压缩还是压缩的无模式二进制格式,与压缩JSON相比,其空间压缩率的中位数和平均值均为负值,表明其空间效率更低。
- 基于模式的格式(如ASN.1 PER Unaligned、Apache Avro unpacked)在所有文档层级上均实现正向的中位数和平均大小压缩率,优于JSON和无模式格式。
- 在全部27个测试用例中,压缩的顺序基于模式的二进制格式在空间效率上严格优于压缩JSON,展现出一致且显著的压缩优势。
- 基准测试表明,数据压缩进一步放大了基于模式格式的优势,使其在带宽受限环境中成为最优选择。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。