java heap problem in spring batch OutOfMemoryException )
Hi,
I am new to spring batch , iam facing problem with heap memory
requirement: i have flat file (500 MB (1 million lines)) , i need to write this file data into gemfire catch, and i set java max heap size 1GB .
Even i am geting OutOfMemoryException while i am procesing
1) how max heap size it requires to process 1 GB flat file( it may increase)
2) is it require flush or clean once wrien into cache ,if it how?
3)is it any problem with m code below.
kindly let know ans.
code:
======
<gfe:cache id="cacheWithXml" />
<batch:job id="toCacheFile">
<batch:step id="step1_1">
<batch:tasklet transaction-manager="jobRepository-transactionManager">
<batch:chunk reader="itemReader1" writer="DBToCache"
commit-interval="1"/>
</batch:tasklet>
</batch:step>
</batch:job>
<bean id="DBToCache" class="com.FeedToCache">
<property name="cache" ref="cacheWithXml" />
</bean>
cache.xml
=======
<cache>
<disk-store name="ds" auto-compact="true" max-oplog-size="1024" queue-size="10000" time-interval="10">
<disk-dirs>
<disk-dir >c:/filecache</disk-dir>
</disk-dirs>
</disk-store>
<region name="cacheRegion">
<region-attributes data-policy="persistent-replicate" scope="local"
refid="REPLICATE_PERSISTENT" statistics-enabled="true" disk-store-name="ds" disk-synchronous="false" >
</region-attributes>
</region>
</cache>
write metthod for cachig data(FeedToCache.java)
======================
public void write(List<? extends FeedData> items) throws Exception {
for (FeedData item : items) {
if (item!= null)
if(item.getAccountNumber()!=null)
cacheRegion.put(item.getAccountNumber()+Math.rando m(),item);
}
}
Thanks
Anil.