vFabric GemFire Data Serialization (DataSerializable and DataSerializer)

vFabric GemFire's DataSerializable interface gives you quick serialization of your objects.

Data Serialization with the DataSerializable Interface

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 or in the cache.xml through the serialization-registration element. Use the serialization-registration to register DataSerializer and Instantiators. For more information, see the online Java documentation for DataSerializable and DataSerializer.

This example registers the byteholder class instantiator with the data serialization framework:

Instantiator.register(new Instantiator(byteholder.class, 17) {
	public DataSerializable newInstance() {
		return new byteholder();
	}
});

In addition to speeding standard object serialization, you can use the DataSerializable interface to serialize any custom objects you store in the cache.

Serializing Your Domain Object with DataSerializer

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.