“Faster” Serialization

as i´m gonna be involved in building a System that has some significantly complex aggregated Data Objects to serialize frequently, i came across http://jboss.org/serialization/.
this one actually promises some kind of performance gain over plain java serialization …

Recently we discovered that most of the problems in JavaSerialization are related to static synchronized caching, what causes CPU spikes and also diminishes scaling capabilities.
With JBossSerialization we have done internal benchmarks and we have realized at least 2 times faster serialization with this library.

Mum has taught us well to never believe the man offering candy, so let´s have a closer look:

 Java |  copy |? 
class BigComplexObject implements Serializable
{
    String foo;
    transient String bar;
    int x = 1;
    Map m = new HashMap();
    List l = new ArrayList();
    List l2 = new ArrayList();
    List l3 = new ArrayList();
}

prepared like:
 Java |  copy |? 
    b = new BigComplexObject();
    b.foo = "foo";
    b.bar = "bar";
    b.x = 17;
    for (int i = 0; i < 10000; i++)
    {
        StringIdentifier si = new StringIdentifier(UUID.randomUUID().toString());
        b.m.put("key" + i, si);
        b.l.add(si);
        b.l2.add(si);
        b.l3.add(si);
    }
 
// note: StringIdentifier is just a Wrapper holding a String.

being serialized through JBossObjectOutputStream or ObjectOutputStream respectively to a preconfigured byte-array, looks like in fact the JBoss variant is about 50% slower than the current jdk. i tried hard to change the object (adding/removing multiple references etc) but it did not change anything. Ok, my setup could be wrong, but as this is quite near to my actual usecase, this is it.
for the record, this lib is from 2006. it might have been good back then. if you have any suggestion, where/how jboss ser might still rock against the regular one: i´m listening…

setup: jdk1.6, win32, jboss ser 1.1.beta

mum was right, no candy today…

8 comments to “Faster” Serialization

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>