|Developing with Pivotal GemFire / Data Serialization|
Pivotal GemFire's DataSerializable interface gives you quick serialization of your objects.
GemFire's DataSerializable interface gives you faster and more compact data serialization than the standard Java serialization or GemFire PDX serialization. However, while GemFire DataSerializable interface is generally more performant than GemFire's PdxSerializable, it requires full deserialization on the server and then reserialization to send the data back to the client.
You can further speed serialization by registering the instantiator for your DataSerializable class through Instantiator, eliminating the need for reflection to find the right serializer. You can provide your own serialization through the API.
The recommended way to register your custom DataSerializer Instantiator is by specifying it in the serialization-registration element of cache.xml.
In addition to speeding standard object serialization, you can use the DataSerializable interface to serialize any custom objects you store in the cache.
For more information, see the online Java documentation for DataSerializable and DataSerializer.
<serialization-registration> <instantiator id="30"> <class-name>com.package.MyClass</class-name> </instantiator> </serialization-registration>
You can also use DataSerializer to serialize domain objects. It serializes data in the same way as DataSerializable but allows you to serialize classes without modifying the domain class code.
See the DataSerializer JavaDocs for more information.