Data Serialization Options
The native client C++ API gives you two serialization options: the
GemFire::Serializable interface and GemFire PDX serialization.
Geode Portable Data eXchange (PDX) serialization is the recommended option. PDX serialization provides portability for PDX serializable objects so that clients can share data with Java servers and other non-C++ clients. PDX is a cross-language data format that can reduce the cost of distributing and serializing your objects. PDX stores data in named fields that you can access individually in order to avoid the cost of deserializing the entire data object. PDX also allows you to mix versions of objects where you have added or removed fields.
When using PDX serialization, you can use either
PdxSerializer (for all your domain objects) or
PdxSerializable (for a specific domain object).
PdxSerializer is used when a user has registered a domain class for serialization in the cache using the
PdxSerializable is used when the domain class that a user wants to serialize/deserialize is inherited from the
PdxSerializable interface, and the user has registered the domain class using the
The non-PDX serialization option is to use the
GemFire::Serializable interface. The
GemFire::Serializable interface can be a good option performance-wise if the size of your objects is small. The
GemFire::Serializable is used whenever a user domain class is not inherited by
PdxSerializable but the user has registered his or her class with the
registerType API. See Serializing Data with the Serializable Interface for more information.
Handles multiple versions of domain objects*
Provides single field access on servers of serialized data, without full deserialization. Supported also for OQL queries.
Automatically ported to other languages by Geode - no need to program Java-side implementation
Works with GemFire delta propagation
Table 1. Serialization Options—Comparison of Features
* You can mix domain object versions where the differences between versions are the addition and removal of object fields.
** See Using PDX Serialization with Delta Propagation for requirements.
For detailed information on the interfaces, see the API documentation.