[jboss-user] [JBossCache] - PojoCache vs serialized bean in TreeCache

bob_ninja do-not-reply at jboss.com
Tue Mar 13 10:46:29 EDT 2007


I am looking at both TreeCache and PojoCache for beans. My primary focus at the moment is performance of updates. The bean contains the usual mix of string and integer properties. Nothing fancy.

I am following the PojoCache examples to store my bean in a PojoCache. The alternative would be to serialize it and store byte[] in a TreeCache. In terms of modifications, about the worst case scenario (for TC) would be update to a boolean property which is encoded in an integer. Thus what happens when a single integer property is modified.

PojoCache using AOP updates the single attribute in the bean's node. The transaction will update bean's node.
The alternative is to serialize modified bean and put (update) it in tree cache. The transaction will update entire bean's serialized state.
The default logic is that single attribute update is cheaper/faster than entire serialized state.

However, my bean is simple (no child objects). It is about 170 bytes serialized. Serialization processing itself is fast, about 37 ns/bean on an average PC. Seems that the actual data content sent for replication purposes is minor between the 2 cases. So really performance is almost the same.

I do have another bean which is parent of this one. I would serialize them separately and update them individually. I could use special locking attributes to ensure atomic updates to parent and children.

The reason I am asking this is because I am not sure that the added complexity of PojoCache and aspects are worth the minor benefit. When I started using Hibernate it instrumented my beans automatically without extra compiling steps and classes (or at least very few classes). Also PojoCache seems to be still young and API is changing, so difficult to use. TreeCache is fairly simple.

Anyway let me know what ou think. thanks



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027569#4027569

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027569



More information about the jboss-user mailing list