Sequential batch after migrating from 5 to 6 #5301
Replies: 2 comments 1 reply
-
|
Configuring a taskExecutor on a stepBuilder only makes the item processor multi-threaded in spring batch 6. If you also want the writing part to be multi-threaded, you must use local chunking that was introduced to this effect. Be aware that the skipping part doesn't work with local chunking. The whole chunk is skipped instead of the individual items. See discussion #5232 |
Beta Was this translation helpful? Give feedback.
-
|
@monnetchr the concurrency model has changed in v6, and indeed, only the processing phase is concurrent now as documented. If you want concurrent writes, then you should set up local chunking as mentioned by @ctrung . And I do confirm there is a bug in the implementation as of v6.0.2, but I planned to address that in 6.0.3. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When upgrading from Spring Batch 5 to 6 (Boot 3.5 to 4) I was surprise that our multithreaded chunk steps became sequential.
I've written simplified examples: https://github.com/monnetchr/springbatch56
The batch step looks like this:
Basically only reader and writer, and the chunk size is configurable.
With Spring Batch 5 the data is processed in parallel on several threads:
After migrating to Spring Batch 6, everything happens on the
mainthread:Comparing the documentations it is indeed clear that things have changed:
But what is not clear is how are we supposed to migrate our job step, so that writing happens in parallel in different threads each with its own transaction?
Beta Was this translation helpful? Give feedback.
All reactions