]
Manik Surtani resolved JBCACHE-1512.
------------------------------------
Resolution: Rejected
Please discuss stuff like this on the user forum. JIRA is to track issues targeted at
specific releases; not to discuss user issues.
extremely high memory usage problem
-----------------------------------
Key: JBCACHE-1512
URL:
https://jira.jboss.org/jira/browse/JBCACHE-1512
Project: JBoss Cache
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Cache loaders
Affects Versions: 3.1.0.GA
Environment: windows XP, windows enterprise 2003 R2, Ubuntu 8.1, Redhat 5.3
Reporter: sridhar reddy
Assignee: Manik Surtani
Priority: Blocker
Attachments: Matcher.zip
My requirement is to associate a set of key value pairs together. all these kind of key
value pairs are grouped together.
So i am populating all the set of value pairs in hashmap.
Group of such set of maps in a node .
When i populate the entire HashMap t oncewith 1000 object and persisted in cache, the
data file size is around 100K. and its perfect.
But when i repeated the population of cache in iteratively i mean gradually, with the
same 1000 objects, the data file is grown to 30MB. how bad.
When i replaced the hashmap with the set, the data size remains same in both the ways.
but for me the i need hashmap.
one step population code is
Code:
public class TestCache {
private Cache<Long, Object> cache = null;
public TestCache(){
try {
CacheFactory<Long, Object> factory = new DefaultCacheFactory<Long,
Object>();
String cacheConfigFile = "cacheloader.xml";
cache = factory.createCache(cacheConfigFile);
cache.create();
cache.start();
} catch (ConfigurationException e) {
} catch (CacheException e) {
}
}
public void populateCache(){
Map<Long, Object> empMap= new HashMap<Long, Object>();
for(long i=1; i <= 1000; i++){
Employee emp = new Employee(i,"Test name "+i,"test region "+i);
empMap.put(i, emp);
}
Node<Long, Object> collNode =
cache.getRoot().addChild(Fqn.fromElements("test","emp","cache"));
collNode.put(0L, empMap);
cache.stop();
}
public static void main(String[] args) {
TestCache tc= new TestCache();
tc.populateCache();
}
}
the second program which kept iteratively is
Code:
public class TestCache {
private Cache<Long, Object> cache = null;
public TestCache(){
try {
CacheFactory<Long, Object> factory = new DefaultCacheFactory<Long,
Object>();
String cacheConfigFile = "cacheloader.xml";
cache = factory.createCache(cacheConfigFile);
cache.create();
cache.start();
} catch (ConfigurationException e) {
} catch (CacheException e) {
}
}
public void populateCache(){
Map<Long, Object> empMap= null;
for(long i=1; i <= 1000; i++){
Employee emp = new Employee(i,"Test name "+i,"test region "+i);
Node<Long, Object> collNode =
cache.getRoot().getChild(Fqn.fromElements("test","emp","cache"));
if(collNode == null){
collNode =
cache.getRoot().addChild(Fqn.fromElements("test","emp","cache"));
}
empMap = (Map<Long, Object>)collNode.get(0L);
if(empMap == null)
empMap= new HashMap<Long, Object>();
empMap.put(i, emp);
collNode.clearData();
collNode.remove(0L);
collNode.put(0L, empMap);
}
cache.stop();
}
public static void main(String[] args) {
TestCache tc= new TestCache();
tc.populateCache();
}
}
configuration file is
Code:
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:jboss:jbosscache-core:config:3.0">
<transaction
transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"
/>
<locking
isolationLevel="REPEATABLE_READ"
lockParentForChildInsertRemove="false"
lockAcquisitionTimeout="20000"
nodeLockingScheme="mvcc"
writeSkewCheck="false"
concurrencyLevel="500"/>
<invocationBatching enabled="true"/>
<jmxStatistics enabled="true"/>
<loaders passivation="false" shared="false">
<preload>
<node fqn="/" />
</preload>
<loader class ="org.jboss.cache.loader.jdbm.JdbmCacheLoader"
async="false" fetchPersistentState="true"
ignoreModifications="false" >
<properties>
location=/home/sridhar/cache
cache.jdbc.connection.factory=org.jboss.cache.loader.C3p0ConnectionFactory
c3p0.maxPoolSize=10
c3p0.checkoutTimeout=5000
</properties>
</loader>
</loaders>
</jbosscache>
in the second program when i replaced the HashMap with Set, there is no difference in the
size of data files created.
Why such strange behaviour. what will be the solution to this?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: