In Spring Batch, when configuring a step you can set the chunk size.
This is a very critical and often overlooked settings.
When developing locally, it’s difficult to catch performance problems because typically
local data sets are very small. However once deployed the performance problems can be crippling.
The chunk size determines how many records are processed before a commit is triggered.
So if your chunk size is set to 10 and you have 1 million records to process, the application will
trigger 100,000 commits. This will be very slow.