Attached is a quick test harness showing the difference in both the serialized size and serialization times for three objects, one using Java serialization, one using the Oracle Coherence ExternalizableLite serialization and one using the Oracle Coherence XmlBean framework (with XmlBean serialization optimizations turned on).
Use either com.tangosol.io.ExternalizableLite or com.tangosol.run.xml.XmlBean. |
The following sample results are from a1.8 GHz laptop:
Java Serialization -------------> 894 bytes
Tangosol ExternalizableLite ----> 309 bytes
Tangosol XmlBean Serialization -> 201 bytes
Serialized an Value 100,000 times --------> 4607ms
Serialized an ELValue 100,000 times ------> 1151 ms
Serialized an XmlBeanValue 100,000 times -> 761 ms
To use this test, download the attached serialization-test.jar to the Coherence lib directory run java -jar serialization-test.jar.
Make sure you add com.tangosol.examples.coherence.serialization.XmlBeanValue and com.tangosol.examples.coherence.serialization.ChildXmlBeanValue and set enable-xmlbean-class-cache to true in the ExternalizableHelper.xml found in the coherence.jar.
To enable the XmlBean serialization optimizations, use this procedure:
<enable-xmlbean-class-cache>true</enable-xmlbean-class-cache>
<xmlbean-list> <xmlbean-class>com.company.MyFirstXmlBeanValue</xmlbean-class> <xmlbean-class>com.company.MySecondXmlBeanValue</xmlbean-class> </xmlbean-list>