Closed jxblum closed 6 years ago
Technically, the challenge(s) is/are...
See the "Note:" under section "Data Serialization Options" in the Apache Geode User Guide here.
So, I may consider offering an option when configuring serialization in Spring Session Data GemFire/Geode to...
A. Use DataSerialization with Delta Propagation.
B. Or use PDX (without Deltas).
1 of the primary UC of using PDX Serialization in GemFire/Geode is to avoid costly de/serializations and having to specifically declare application domain classes on the GemFire cluster servers CLASSPATH. Additionally, PDX enables Native Clients (i.e. C++/C#) to interoperate with Java-based GemFire cache client apps.
If Delta Propagation was enabled, this would cause the PDX serialized bytes to be deserialized every single time thus breaking interoperability by requiring corresponding Java types for the application domain classes on the GemFire Servers CLASSPATH.
So, a user can choose A or B, but not both.
This was released in Spring Session Data GemFire/Geode 2.0.0.M2.
Original description from Spring Session Issue #493...
"_The initial implementation of Spring Session Data GemFire support made use of GemFire's PDX serialization framework. However, due to several limitations/problems when employing PDX to serialize HTTP Session data, particularly around adding new Session attributes (as first-class properties of the Session object itself) along with robust delta-propagation, the PDX effort failed._
_Based on the existing object model representing the (HTTP) Session state (specifically
GemFireSession
andGemFireSessionAttributes
), it now maybe possible to utilize certain aspects of PDX, which has the distinct advantage of not having to modify the servers'CLASSPATH
with application or Spring Session-specific types._However, while PDX is more convenient and flexible, it is also slower than
DataSerializable
and does not necessarily prevent de-serialization on the server. It all depends on how the user has configured PDX on each individual server in the cluster along with the type of data access operations being performed by the application._For instance, certain OQL queries and GemFire Functions can cause a PDX instance to be de-serialized even when
read-serialized
is set to true. Therefore, if the Spring Session / application types are not on the serverCLASSPATH
when a data access operation triggers a deserialization, then aClassNotFoundException
will still be thrown.__However, unlike
DataSerializable
, GemFire will prefer to keep PDX data serialized as much as possible, whereas it seems GemFire always deserializesDataSerializable
objects, as is evident from GemFire Data Serialization section in the GemFire User Guide, where it states..._The constant serialization/deserialization of data is a performance hit, and GemFire must always serialize data when replicating between peers in the cluster, replicating over WAN, transferring data between clients and servers, and when persisting and/or overflowing data to disk."