Thrift Encoding
Thrift encoding is the binary serialization scheme of Apache Thrift, supporting multiple protocols such as Binary, Compact, and JSON for cross-language RPC.
Purpose
It provides efficient, compact RPC data serialization across heterogeneous language environments.
Mechanism
The Binary protocol writes field type + ID + value in order; the Compact protocol compresses integers and field IDs with Varint and ZigZag. The schema (IDL) is compiled into code for each language.
Use cases
- Internal Facebook RPC
- Cross-language service communication
- Data persistence