Data Serialization Options

Built-in .NET types are serialized automatically into the cache and can be retrieved by Java servers and other GemFire clients. For domain objects that are not simple types, you have three GemFire serialization options.

The options give good performance and flexibility for data storage, transfers, and language types. The GemFire options can also improve performance in serializing and deserializing built-in types.

The simplest option is to use perform automatic serialization by registering the GemFire .NET PDX reflection-based autoserializer in your application. When you have this registered, GemFire uses it for all domain objects that are not custom serialized.

You can also custom serialize your objects by implementing one of the GemFire .NET interfaces, Apache.Geode.Client.IPdxSerializable or Apache.Geode.Client.IGeodeSerializable.

You also have the option of using default .NET serialization, but you cannot use it unless you also use helper classes. The helper classes you must use are CacheableObject and CacheableObjectXml.

GemFire .NET PDX serialization has more bytes in overhead than GemFire .NET Data serialization, but using PDX serialization helps you avoid the performance costs of deserialization when performing queries. Applications can use PdxInstances in functions to avoid the deserialization of entire objects.

Table 1. Serialization Options—Comparison of Features
Capability IGeodeSerializable IPdxSerializable and PDX reflection-based autoserializer

Handles multiple versions of domain objects*

X

Provides single field access on servers of serialized data, without full deserialization. Supported also for OQL queries.

X

Automatically ported to other languages by GemFire - no need to program Java-side implementation

X

Works with GemFire delta propagation

X X (See explanation below.)

*You can mix domain object versions where the differences between versions are the addition and removal of object fields.

By default, you can use GemFire delta propagation with PDX serialization. However, delta propagation will not work if you have set the GemFire property read-serialized to “true”. In terms of deserialization, to apply a change delta propagation requires a domain class instance and the fromDelta method. If you have set read-serialized to true, you will receive an IPdxInstance instead of a domain class instance and IPdxInstance does not have the fromDelta method required for delta propagation. You will also require the Java domain class on the server similar to the you would need the .NET PDX Delta domain class.