GemFire PDX Serialization Features
GemFire PDX serialization offers several advantages.
Domain objects evolve along with your application code. You may create an address object with two address lines, then realize later that a third line is required for some situations. Or you may realize that a particular field is not used and want to get rid of it.
With PDX, you can use old and new versions of domain objects together in a distributed system if the versions differ by the addition or removal of fields. This compatibility lets you gradually introduce modified code and data into the system, without bringing the system down.
GemFire maintains a central registry of the PDX domain object metadata. Using the registry, GemFire preserves fields in each member’s cache regardless of whether the member has the field defined. When a member receives an object that has a field registered that the member is not aware of, the member does not access the field, but preserves it and passes it along with the rest of the object to other members. When a member receives an object that is missing one or more fields according to the member’s version, GemFire assigns the .NET default values for the field types to the missing fields.
When you create an
IPdxSerializable object, GemFire stores the object’s type information in a central registry. The information is passed between peers, between clients and servers, and between distributed systems.
This offers a notable advantage to the .NET client, which shares data with Java cache servers. Clients automatically pass registry information to servers when they store an
IPdxSerializable object. Clients can run queries and functions against the data in the servers without the servers needing to know anything about the stored objects. One client can store data on the server to be retrieved by another client, with the server never needing to know the object type. This means you can code your .NET clients to manage data using Java servers without having to create Java implementations of your .NET domain objects.
The access methods for
IPdxSerializable objects allow you to examine specific fields of your domain object without deserializing the entire object. This can reduce serialization and deserialization costs significantly. .NET clients can run queries and execute functions against the objects in the server caches without deserializing the entire object on the server side. The query engine automatically recognizes PDX objects and uses only the fields it needs.
Clients can execute Java functions on server data that only access parts of the domain objects by using
Likewise, peers can access just the fields needed from the serialized object, keeping the object stored in the cache in serialized form.