I am writing spring batch which reads from flat file, do little processing and write the summary to the output file. My processor and writer are relatively quicker compared to reader. I am using FlatFileItemReader and tried with wide range of commit intervals starting from 50-1000. My batch job has to process 10 millions records on a faster rate. Kindly let me know the ways to improve the speed rate of FlatFileItemReader. pasting below my config file and my Mapper class read the fieldset and set the values to POJO bean. Thanks a lot in advance.
BatchFileConfig.xml
<!-- Flat File Item Reader and its dependency configuration starts here -->
<bean id="flatFileReader" class="org.springframework.batch.item.file.FlatFileItemReader">
<property name="resource" value="classpath:flatfiles/input_10KFile.txt" />
<property name="encoding" value="UTF-8" />
<property name="linesToSkip" value="1" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<bean
class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="names"
value="var1,var2,var3,var4,var5,var6" />
<property name="delimiter" value="	" />
<property name="strict" value="false" />
</bean>
</property>
<property name="fieldSetMapper" ref="companyMapper">
</property>
</bean>
</property>
</bean>
CompanyMapper.java
public Company mapFieldSet(FieldSet fieldSet) throws BindException {
logger.warn("Start time is "+System.currentTimeMillis());
if (fieldSet != null) {
Company company = new Company();
company.setvar1(fieldSet.readString("var1"));
company.setvar2(fieldSet.readInt("var2"));
company.setvar3(fieldSet.readString("var3"));
company.setvar4(fieldSet.readInt("var4"));
company.setvar5(fieldSet.readInt("var5"));
company.setvar6(fieldSet.readInt("var6"));
return company;
}
return null;
}
companyMapper? Can you post a little more on your job configuration? - M. DeinumSystem.currentTimeMillis()is relative slow, wouldn't add that in high-performance code. The same goes for logging, depending on where you log, this could be slow (basically writing toSystem.outis really slow.). The logging also (always) does aString.concat. Would try to remove those first and see what happens. - M. Deinum