Fundamentals 38 min read

Why Fury Serialization Beats Kryo: 20‑200× Faster Cross‑Language Performance

Fury is a JIT‑based native multi‑language serialization framework that automatically handles shared and cyclic references, offers zero‑copy support, and delivers 20‑200× speed improvements over existing solutions, making it a high‑performance drop‑in replacement for Java, Python, Go, and C++ serialization needs.

Alibaba Cloud Developer
Alibaba Cloud Developer
Alibaba Cloud Developer
Why Fury Serialization Beats Kryo: 20‑200× Faster Cross‑Language Performance

Introduction

Serialization is critical for cross‑process, cross‑language, and cross‑node data transfer, and its performance and usability directly affect system efficiency and developer productivity.

What is Fury

Fury is a JIT‑based native multi‑language serialization framework supporting Java, Python, Go, and C++. It provides fully automatic cross‑language object serialization without IDL files and achieves 20‑200× higher performance than existing frameworks.

Key Features

Supports major languages, automatic serialization of arbitrary objects, and shared/cyclic reference handling.

JIT dynamic compilation with method inlining, dead‑code elimination, and zero‑copy support.

Cache‑friendly binary row format for partial reads and seamless Arrow column‑store conversion.

Drop‑in replacement for JDK/Kryo/Hessian with up to 200× speedup.

Usage Examples

Java

import com.google.common.collect.*;
import io.fury.*;
import java.util.*;

public class CustomObjectExample {
  public static class SomeClass1 {
    Object f1;
    Map<Byte, Integer> f2;
  }
  public static class SomeClass2 {
    Object f1;
    String f2;
    List<Object> f3;
    Map<Byte, Integer> f4;
    Byte f5;
    Short f6;
    Integer f7;
    Long f8;
    Float f9;
    Double f10;
    short[] f11;
    List<Short> f12;
  }
  public static Object createObject() {
    SomeClass1 obj1 = new SomeClass1();
    obj1.f1 = true;
    obj1.f2 = ImmutableMap.of((byte) -1, 2);
    SomeClass2 obj = new SomeClass2();
    obj.f1 = obj1;
    obj.f2 = "abc";
    obj.f3 = Arrays.asList("abc", "abc");
    obj.f4 = ImmutableMap.of((byte) 1, 2);
    obj.f5 = Byte.MAX_VALUE;
    obj.f6 = Short.MAX_VALUE;
    obj.f7 = Integer.MAX_VALUE;
    obj.f8 = Long.MAX_VALUE;
    obj.f9 = 1.0f / 2;
    obj.f10 = 1 / 3.0;
    obj.f11 = new short[]{(short) 1, (short) 2};
    obj.f12 = ImmutableList.of((short) -1, (short) 4);
    return obj;
  }
}

Python

from dataclasses import dataclass
from typing import List, Dict
import pyfury

@dataclass
class SomeClass2:
    f1: any = None
    f2: str = None
    f3: List[str] = None
    f4: Dict[pyfury.Int8Type, pyfury.Int32Type] = None
    f5: pyfury.Int8Type = None
    f6: pyfury.Int16Type = None
    f7: pyfury.Int32Type = None
    f8: int = None  # can use pyfury.Int64Type
    f9: pyfury.Float32Type = None
    f10: float = None  # can use pyfury.Float64Type
    f11: pyfury.Int16ArrayType = None
    f12: List[pyfury.Int16Type] = None

@dataclass
class SomeClass1:
    f1: any
    f2: Dict[pyfury.Int8Type, pyfury.Int32Type]

if __name__ == "__main__":
    fury_ = pyfury.Fury(reference_tracking=False)
    fury_.register_class(SomeClass1, "example.SomeClass1")
    fury_.register_class(SomeClass2, "example.SomeClass2")
    obj2 = SomeClass2(f1=True, f2={-1: 2})
    obj1 = SomeClass1(f1=obj2, f2="abc", f3=["abc", "abc"], f4={1: 2}, f5=2**7-1, f6=2**15-1, f7=2**31-1, f8=2**63-1, f9=1.0/2, f10=1/3.0, f11=array.array("h", [1, 2]), f12=[-1, 4])
    data = fury_.serialize(obj1)
    print(fury_.deserialize(data))

Go

package main

import (
    "code.alipay.com/ray-project/fury/go/fury"
    "fmt"
)

func main() {
    type SomeClass1 struct {
        F1 interface{}
        F2 string
        F3 []interface{}
        F4 map[int8]int32
        F5 int8
        F6 int16
        F7 int32
        F8 int64
        F9 float32
        F10 float64
        F11 []int16
        F12 fury.Int16Slice
    }
    type SomeClass2 struct {
        F1 interface{}
        F2 map[int8]int32
    }
    fury_ := fury.NewFury(false)
    fury_.RegisterTagType("example.SomeClass1", SomeClass1{})
    fury_.RegisterTagType("example.SomeClass2", SomeClass2{})
    obj2 := &SomeClass2{F1: true, F2: map[int8]int32{-1: 2}}
    obj := &SomeClass1{F1: obj2, F2: "abc", F3: []interface{}{"abc", "abc"}, F4: map[int8]int32{1: 2}, F5: fury.MaxInt8, F6: fury.MaxInt16, F7: fury.MaxInt32, F8: fury.MaxInt64, F9: 1.0 / 2, F10: 1 / 3.0, F11: []int16{1, 2}, F12: []int16{-1, 4}}
    bytes, err := fury_.Marshal(obj)
    if err != nil { panic(err) }
    var newObj SomeClass1
    err = fury_.Unmarshal(bytes, &newObj)
    if err != nil { panic(err) }
    fmt.Println(newObj)
}

Comparison with Other Frameworks

Fury outperforms Kryo, Protobuf, FlatBuffers, and MsgPack in functionality, performance, and ease of use. It supports automatic serialization, shared/cyclic references, zero‑copy, and partial deserialization without requiring schema files.

Performance Benchmarks

JMH tests show Fury serializing struct objects up to 20× faster than Kryo and handling zero‑copy buffers with near‑zero overhead. Benchmarks also demonstrate superior performance on large‑scale data and buffer operations.

Future Work

Planned improvements include JIT‑generated compression modes, SIMD‑based data compression, expanded C++ macro registration, JIT for Go, Cython acceleration for Python, JavaScript and Rust support, and integration with RPC frameworks (SOFA, Dubbo, Akka) and big‑data engines (Spark, Flink).

References

https://github.com/EsotericSoftware/kryo

https://spark.apache.org/

https://flink.apache.org/

https://arrow.apache.org/

https://openjdk.org/projects/code-tools/jmh/

https://github.com/ray-project/ray

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

performancePythonGolangserializationZero CopyCross-language
Alibaba Cloud Developer
Written by

Alibaba Cloud Developer

Alibaba's official tech channel, featuring all of its technology innovations.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.