Skip to content

Row serialization limits

A serialization mode decides how application values become bytes and how those bytes become values again. Choose a mode before optimizing a large payload: it affects which languages and data shapes can participate.

Python exposes SerializationMode.ROW through ForyCodec. It uses Apache Fory’s row format and is Python-only. The current codec requires exactly one dataclass root type and reconstructs dataclass values when decoding.

For example, a Python-only batch of one record type may fit the ROW codec. A service whose request is a query and whose response is a different result type does not automatically fit its single-root restriction. Start with XLANG unless you have a measured reason and a compatible schema for ROW.

A ROW codec must be initialized with one root dataclass. It rejects an empty type list, multiple root types, and non-dataclass roots. RPC services often use different request and response dataclasses, so they need additional consideration before using this mode.

This page describes codec restrictions and does not provide a validated ROW RPC walkthrough.

Use the default XLANG mode for the greeting service and for cross-language calls. Dynamic clients also use XLANG with contract-derived types.

Consider ROW only when the Python codec’s root-type restriction fits your application. Its row representation can expose individual fields, but the high-level client returns decoded Python values; that does not establish a zero-copy application API.

This page provides no measured performance comparison. Encoding cost, schema overhead, field selection, and materializing complete dataclasses affect performance. Benchmark your workload before choosing ROW over XLANG.