Oliver
Oliver

Reputation: 83

Dynamic chunk size based on step execution duration

I have a very computation based Spring Batch job that is executed with multiple threads. The job might be executed on different computers with different hardware.

I currently configured a chunk size of 1.000.000 but depending on the processor speed and the number of processors, the processing of one chunk might take from 30 seconds up to 1 hour.

Is there any pragmatic way, to adapt the chunk size dynamically based on the runtime of the last StepExecution?

I have something like that in mind:

Optionally scaling down:

Is some mechanism like that possible to implement?

Upvotes: 1

Views: 23

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31710

It is not possible to re-configure a step dynamically while it is running. You can definitely set the chunk-size dynamically at runtime before starting the step, but not once the step is started and is running. The chunk size will remain the same for all chunks.

Upvotes: 0

Related Questions