Principle:Ray project Ray Cross Language Serialization
| Knowledge Sources | |
|---|---|
| Domains | Serialization, Cross_Language_Interop |
| Last Updated | 2026-02-13 17:00 GMT |
Overview
A binary serialization protocol that encodes Java objects into a language-neutral format readable by Python and C++ workers.
Description
Cross-Language Serialization converts Java objects into MessagePack binary format for cross-language transport. Supported cross-language types (Boolean, Byte, Short, Integer, Long, BigInteger, Float, Double, String, byte[], arrays, null) are encoded as standard MessagePack values. Unsupported types fall back to FST serialization (Java-specific, tagged with extension type 101), which can only be read by Java workers.
The encoder produces a flag indicating whether the payload is cross-language compatible, enabling the runtime to validate cross-language task arguments.
Usage
Serialization is handled automatically by the Ray runtime during cross-language task submission. You do not need to call the serializer directly — just pass supported types as task arguments.
Theoretical Basis
MessagePack implements a schema-less binary serialization format. It is more compact than JSON and supports a type system that maps naturally to primitives in most programming languages, making it ideal for cross-language data exchange.