My this question is an extension to my another SO Question. Since that doesn't look possible, I am trying to execute chunks in parallel for parallel / partitioned slave steps.
Article says that by just specifying SimpleAsyncTaskExecutor
as task executor for a step would start executing chunks in parallel.
@Bean
public Step masterLuceneIndexerStep() throws Exception{
return stepBuilderFactory.get("masterLuceneIndexerStep")
.partitioner(slaveLuceneIndexerStep())
.partitioner("slaveLuceneIndexerStep", partitioner())
.gridSize(Constants.PARTITIONER_GRID_SIZE)
.taskExecutor(simpleAsyntaskExecutor)
.build();
}
@Bean
public Step slaveLuceneIndexerStep()throws Exception{
return stepBuilderFactory.get("slaveLuceneIndexerStep")
.<IndexerInputVO,IndexerOutputVO> chunk(Constants.INDEXER_STEP_CHUNK_SIZE)
.reader(luceneIndexReader(null))
.processor(luceneIndexProcessor())
.writer(luceneIndexWriter(null))
.listener(luceneIndexerStepListener)
.listener(lichunkListener)
.throttleLimit(Constants.THROTTLE_LIMIT)
.build();
}
If I specify, .taskExecutor(simpleAsyntaskExecutor)
for slave step then job fails. Line .taskExecutor(simpleAsyntaskExecutor)
in master step works OK but chunks work in serial and partitioned steps in parallel.
Is it possible to parallelize chunks of slaveLuceneIndexerStep()
?
Basically, each chunk is writing Lucene indices to a single directory in sequential fashion and I want to further parallelize index writing process within each directory since Lucene IndexWriter
is thread-safe.
faulttolerant
do? My job remains stuck for quite some time then fails due to different errors all the time. I am guessing that somewhere there is a thread-safety issue in my slave step's chunk components ( reader, processor & writer ). Am I correct to assume that reader, processor & writer should strictly be thread-safe to parallelize chunks? – Sabir Khan