Apache Fury 团队很高兴宣布 0.6.0 版本发布。这是一个重要版本,包含来自 12 位贡献者的35 PR。请参阅Install页面了解如何获取适用于你平台的库。
亮点
在这个版本中,我们为 Java 的 Schema 演进引入了 scoped meta share 模式,并在 CompatibleMode=Compatible 时默认启用:
- 相比之前的 KV compatible 模式,该模式性能提升约 50%,序列化载荷体积仅为此前的 1/6。
- 在复杂对象场景下,该模式比 Protobuf 快约 4 倍,序列化体积小于 Protobuf 的 1/2。


Protobuf/JSON 会以 KV 形式写入消息字段元信息和值。当序列化消息列表时,通常会遇到两个问题:
- 即使消息类型相同,也会重复写入元信息。
- KV 布局较为离散,不利于压缩。
meta share 模式会对同类型多个对象只写入一次字段名与字段类型元信息,因此相比 Protobuf 能显著节省空间并提升性 能。
借助 meta share,我们可以仅写入一次 struct 的字段名与类型元信息,同时还可提前把元信息编码为二进制,再通过一次内存拷贝直接写入,从而进一步提升速度。
序列化数据
public static class NumericStruct {
public int f1;
public int f2;
public int f3;
public int f4;
public int f5;
public int f6;
public int f7;
public int f8;
public static NumericStruct build() {
NumericStruct struct = new NumericStruct();
struct.f1 = 1;
struct.f2 = 2;
struct.f3 = 3;
struct.f4 = 4;
struct.f5 = 5;
struct.f6 = 6;
struct.f7 = 7;
struct.f8 = 8;
return struct;
}
}
public static class NumericStructList {
public List<NumericStruct> list;
public static NumericStructList build() {
NumericStructList structList = new NumericStructList();
structList.list = new ArrayList<>(1000);
for (int i = 0; i < 1000; i++) {
structList.list.add(NumericStruct.build());
}
return structList;
}
结果
性能:
Benchmark Mode Cnt Score Error Units
fury_deserialize thrpt 30 49667.900 ± 3004.061 ops/s
fury_kv_compatible_deserialize thrpt 30 33014.595 ± 3716.199 ops/s
fury_kv_compatible_serialize thrpt 30 23915.260 ± 3968.119 ops/s
fury_serialize thrpt 30 63146.826 ± 2930.505 ops/s
protobuf_deserialize thrpt 30 14156.610 ± 685.272 ops/s
protobuf_serialize thrpt 30 10060.293 ± 706.064 ops/s
体积:
| Lib | Serialized Payload Size |
|---|---|
| fury | 8077 |
| furystrict | 8009 |
| furykv | 48028 |
| protobuf | 18000 |
功能特性
- feat(java): support nonexistent class deserialization in meta share mode by @chaokunyang in https://github.com/apache/fury/pull/1646
- feat(java): scoped meta share mode for type forward/backward compaibility by @chaokunyang in https://github.com/apache/fury/pull/1660
- feat(java): support meta compression by Deflater by @chaokunyang in https://github.com/apache/fury/pull/1663
- perf(java): Add ClassInfo ClassBytes generation conditions. by @LiangliangSui in https://github.com/apache/fury/pull/1667
- feat(javascript): use TextDecoder to decode buffer by @bytemain in https://github.com/apache/fury/pull/1699
- feat(Python): meta string encoding algorithm in Python by @pandalee99 in https://github.com/apache/fury/pull/1702
- feat(C++): String detection is performed using SIMD techniques by @pandalee99 in https://github.com/apache/fury/pull/1720
- feat(C++): The use of SIMD accelerated to implement and optimize utf16 utf8 by @pandalee99 in https://github.com/apache/fury/pull/1732
- feat(java): enable scoped meta share for compatible mode by default by @chaokunyang in https://github.com/apache/fury/pull/1733
- perf(java): optimize scoped meta share mode perf by @chaokunyang in https://github.com/apache/fury/pull/1734
缺陷修复
- chore(doc): fix example by @wangjie-fourth in https://github.com/apache/fury/pull/1657
- fix(java): fix scala object type codegen by @chaokunyang in https://github.com/apache/fury/pull/1659
- fix(java): Fix header offset issue in MetaStringBytes hashcode by @LiangliangSui in https://github.com/apache/fury/pull/1668
- fix(java): return fury to pooled which get from by @MrChang0 in https://github.com/apache/fury/pull/1697
- fix(doc): codestyle version in python by @pandalee99 in https://github.com/apache/fury/pull/1706
- fix(java): fix nested map serialization codegen by @chaokunyang in https://github.com/apache/fury/pull/1713
- fix(java): fix fastjson object serialization by @chaokunyang in https://github.com/apache/fury/pull/1717
其他改进
- chore: Add IssueNavigationLink and icon for IDEA by @lvshaokang in https://github.com/apache/fury/pull/1665
- chore(rust): resolve deprecate warnings by @waynexia in https://github.com/apache/fury/pull/1662
- chore(doc): fix doc example code by @wangjie-fourth in https://github.com/apache/fury/pull/1666
- chore(rust): Setup rustfmt and toolchain for rust by @Xuanwo in https://github.com/apache/fury/pull/1677
- chore(rust): Make rust clippy happy by @Xuanwo in https://github.com/apache/fury/pull/1678
- chore(doc): add incubating DISCLAIMER by @chaokunyang in https://github.com/apache/fury/pull/1681
- chore(java): Update github URL in IntelliJ vcs.xml by @pjfanning in https://github.com/apache/fury/pull/1689
- ci: fix ci error by @LiangliangSui in https://github.com/apache/fury/pull/1691
- docs: fix badge x by @vesense in https://github.com/apache/fury/pull/1694
- chore(doc): fix compiler error by @wangjie-fourth in https://github.com/apache/fury/pull/1698
- refactor(java): move latin language checker method from string serializer to string util by @anagh07 in https://github.com/apache/fury/pull/1708
- chore(doc): the more complete readme is in python by @pandalee99 in https://github.com/apache/fury/pull/1709
- build: update scala build by @pjfanning in https://github.com/apache/fury/pull/1725
- build: publish jars for fury-scala by @pjfanning in https://github.com/apache/fury/pull/1729
- chore(java): merge reflect.Types into TypeRef by @chaokunyang in https://github.com/apache/fury/pull/1731
新贡献者
- @wangjie-fourth made their first contribution in https://github.com/apache/fury/pull/1657
- @lvshaokang made their first contribution in https://github.com/apache/fury/pull/1665
- @waynexia made their first contribution in https://github.com/apache/fury/pull/1662
- @Xuanwo made their first contribution in https://github.com/apache/fury/pull/1677
- @anagh07 made their first contribution in https://github.com/apache/fury/pull/1708
完整更新日志:https://github.com/apache/fury/compare/v0.5.1...v0.6.0
