Spring batch Spring批处理MultiResourcePartitioner性能构建批处理步骤执行表

Spring batch Spring批处理MultiResourcePartitioner性能构建批处理步骤执行表,spring-batch,Spring Batch,我们有可能处理多达20000个文件的作业。我们正在使用MultiResourcePartitioner进行设置。作业确实在运行,但我们注意到了一个瓶颈 SpringBatch正在为找到的每个文件在BATCH\u STEP\u EXECUTION表中创建条目,并且在为每个文件创建表条目之前不会处理任何文件。装这张桌子似乎要花很长时间 在本地测试中,试图只处理1000个文件,将行添加到“批处理步骤执行”需要38-40分钟。加载表后,文件的处理速度相当快(通常不到1分钟) 我希望这不是典型的行为,我只

我们有可能处理多达20000个文件的作业。我们正在使用
MultiResourcePartitioner
进行设置。作业确实在运行,但我们注意到了一个瓶颈

SpringBatch正在为找到的每个文件在
BATCH\u STEP\u EXECUTION
表中创建条目,并且在为每个文件创建表条目之前不会处理任何文件。装这张桌子似乎要花很长时间

在本地测试中,试图只处理1000个文件,将行添加到“批处理步骤执行”需要38-40分钟。加载表后,文件的处理速度相当快(通常不到1分钟)

我希望这不是典型的行为,我只是错过了一些东西

以下是数据库的设置方式(我们实际上是“OracleDataSource”的子类(我们使用“ojdbc6.jar”文件访问该类),db_文件是一个属性文件,用于访问url、密码等):


10
25
50
1800
900
20
20
以下是JobRepository定义的其余部分:

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
</bean> 


<bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean" >
    <property name="databaseType" value="oracle" />
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager" />
    <property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/>
</bean> 

<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean">
    <property name="dataSource" ref="dataSource" />
</bean> 

<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> 
    <property name="jobRepository" ref="jobRepository" /> 
</bean>

<bean id="jobParametersIncrementer" class="org.springframework.batch.core.launch.support.RunIdIncrementer" />   


有人有什么想法吗?

将此作为替代方法

为了更好地从文件加载表,请使用LOADDATA


这将以更好的方式提高性能。对我来说,处理一个有一百万条记录的文件只需30秒,仅供参考,SpringSource已将其识别为一个bug:

作为一种解决方法,我们只需减少在给定运行时要处理的文件数量,然后增加作业在给定日期内运行的次数


我们使用2000作为文件限制,因为它提供了可接受的性能。

SpringBatch在开始处理文件后,处理文件的工作做得很好。使用Oracle Loader意味着不验证字段等。
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
</bean> 


<bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean" >
    <property name="databaseType" value="oracle" />
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager" />
    <property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/>
</bean> 

<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean">
    <property name="dataSource" ref="dataSource" />
</bean> 

<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> 
    <property name="jobRepository" ref="jobRepository" /> 
</bean>

<bean id="jobParametersIncrementer" class="org.springframework.batch.core.launch.support.RunIdIncrementer" />