PRODUCTS AND SERVICES INDUSTRIES SUPPORT PARTNERS COMMUNITIES ABOUT
  Coherence 3.5 User Guide
  Cache Semantics
Added by Rob Misek, last edited by Joseph Ruzzi on Jun 09, 2009  (view change)

Labels

 
(None)

Use Coherence caches to cache value objects. These objects may represent data from any source, either internal (suchas session data, transient data, and so on) or external (such as a database, mainframe, and so on).

Objects placed in the cache must be serializable. Because serialization is often the most expensive part of clustered data management, Coherence provides the following options for serializing/deserializing data:

  • com.tangosol.io.pof.PofSerializer - The Portable Object Format (also referred to as POF) is a language agnostic binary format. POF was designed to be incredibly efficient in both space and time and has become the recommended serialization option in Coherence. See The Portable Object Format
  • java.io.Serializable - The simplest, but slowest option.
  • java.io.Externalizable - This requires developers to implement serialization manually, but can provide significant performance benefits. Compared to java.io.Serializable, this can cut serialized data size by a factor of two or more (especially helpful with Distributed caches, as they generally cache data in serialized form). Most importantly, CPU usage is dramatically reduced.
  • com.tangosol.io.ExternalizableLite - This is very similar to java.io.Externalizable, but offers better performance and less memory usage by using a more efficient I/O stream implementation.
  • com.tangosol.run.xml.XmlBean - A default implementation of ExternalizableLite (see the section on XmlBean for more details).
Remember, when serializing an object, Java serialization automatically crawls every visible object (via object references, including collections like Map and List). As a result, cached objects should not refer to their parent objects directly (holding onto an identifying value like an integer is okay).

Objects that implement their own serialization routines are not affected.