Hi, there,
We are evaluating TreeCache's capacity, by using it to cache temporary data, without any database connection.
We configure the JVM heapspace to 1024M, and put as many objects as possible into the cache, to see its upper limit. Each object has a unique key, so that the entire tree has is flat with one level.
Each object size is of 150k bytes, and we found we can hardly cache 1500 objects into the TreeCache. Therefore, only 225M is used out of 1024M JVM heap space.
Is there anything wrong with our coding and/or config?
private final String CONFIG_FILE_PATH = "config/replsync-service.xml"; TreeCache tree = new TreeCache(); PropertyConfigurator config = new PropertyConfigurator(); config.configure(tree, CONFIG_FILE_PATH); tree.createService(); JbossCacheListener lis = new JbossCacheListener(); tree.addTreeCacheListener(lis); tree.startService(); try { for (int i = 0; i < 2000; i++) tree.put(Integer.toString(i), data); } catch ...
<attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute> <!-- Specific eviction policy configurations. This is LRU --> <attribute name="EvictionPolicyConfig"> <config> <attribute name="wakeUpIntervalSeconds">5</attribute> <!-- Cache wide default --> <region name="/_default_"> <attribute name="maxNodes">5000</attribute> <!--time to live 1 hour--> <attribute name="timeToLiveSeconds">86400</attribute> </region>
Use CacheMode=LOCAL. You use replicated mode for now.
What result do you expect ? An OutOfMemory exception ?
Or how do you test the upper limit ?
Did you use a memory profiler to see where the data is allocated ?