1 Reply Latest reply on Oct 27, 2006 12:22 PM by genman

    Single Node with multiple data items vs Multiple Nodes with

    ritukedia

      Hi All,

      We are investigating the suitability of using JBossCache with Berkley DB JE for our application.

      We have come across a strange behaviour when JBossCache persists data items to BDB JE:

      When multiple instances of a class are inserted in cache as multiple data items in a single node of JBoss TreeCache, i.e. under the same FQN - the size of the BDB varies significantly as compared to when the same no of multiple instances are inserted in cache in separate nodes of TreeCache, i.e. under different FQNs

      The difference in BDB file size is in the order of 50X. The multiple node with single data item each results in much much smaller BDB file. The single node with multiple data items results in 50 times bigger BDB file.

      To rule out the problem from the BDB size, I performed the same test as above by directly inserting objects in BDB (instead of using BDB as a cache persistence layer). From BDB's perspective having a single data entry vs having multiple data entries does not make any difference to the size of the jdb file. It is the same in both cases.

      We would very much appreciate any help in understanding this behaviour of JBossCache and also to understand the recommended approach for caching.

      Thanks in advance,
      Best Regards,
      Ritu Kedia


        • 1. Re: Single Node with multiple data items vs Multiple Nodes w
          genman

          JBossCache stores all entries belonging to a FQN into a single node in BDBJE. (Personally, I don't agree with that approach as some people might prefer to store large values under a single FQN.) However, your application can be easily changed. Instead of

          cache.put(fqn, key, value);

          do

          cache.put(new Fqn(fqn, key), key2, value);