Serialization/deserialization might become very expensive when working with cached large java objects that are created and used on many different nodes.
At the moment, the setting storeAsBinary() allows you to "die" either one:
- serialize/deserialize when the cache is accessed
- serialize/deserialize when L1 is filled or invalidated, object fetched from other node, object is replicated on put
It might be a good solution to add a third mode:
- At a put() operation, the Java object is put into the cache
- When the serialized representation is required first, it is created from the Java object (or during the put() operation)
- The serialized representation is reused every time when needed.
Means: cache the serialized representation of keys and values.