Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between spring batch remote chunking and remote partitioning

What is the difference between spring batch remote chunking and remote partitioning?

I can not understand the difference between remote chunking and remote partitioning in spring batch. Could anybody please explain?

like image 858
javalearner Avatar asked Dec 02 '13 07:12

javalearner


People also ask

What is remote chunking in Spring Batch?

Description. In Remote Chunking the Step processing is split across multiple processes, in our case communicating with each other using AWS SQS. This pattern is useful when the Master is not a bottleneck. With Remote Chunking the data is read by the master and sent to the slaves using SQS for processing.

What is Spring Batch partitioning?

Spring Batch with partitioning provides us the facility to divide the execution of a Step: Partitioning Overview. The above picture shows an implementation of a Job with a partitioned Step. There's a Step called “Master”, whose execution is divided into some “Slave” steps.

What is Tasklet and chunk in Spring Batch?

One approach is tasklet-based, where a Tasklet supports a simple interface with a single execute() method. The other approach, **chunk-oriented processing**, refers to reading the data sequentially and creating "chunks" that will be written out within a transaction boundary.

What is Throttlelimit in Spring Batch?

A TaskExecutor with a throttle limit which works by delegating to an existing task executor and limiting the number of tasks submitted. A throttle limit is provided to limit the number of pending requests over and above the features provided by the other task executors.


1 Answers

Remote Partitioning

Partitioning is a master/slave step configuration that allows for partitions of data to be processed in parallel. Each partition is described via some metadata. For example, if you were processing a database table, partition 1 may be ids 0-100, partition 2 being 101-200, etc. For Spring Batch, a master step uses a Partitioner to generate ExecutionContexts that contain the metadata for each partition. These ExecutionContexts are distributed to slave step for processing by a PartitionHandler (for remote partitioning, the MessageChannelPartitionHandler is typically used). The slaves execute their step and return the resulting statuses for aggregation by the master.

Things to note about remote partitioning:

  • Input and output are local to the slaves. For example, if the input is a file, the slaves need access to the file.
  • Slaves need access to the JobRepository. Slaves are fully defined Spring Batch steps and so they need JobRepository access.

Remote Chunking

Remote chunking is similar to remote partitioning in that it is a master/slave configuration. However with remote chunking, the data is read at by the master and sent over the wire to the slave for processing. Once the processing is done, the result of the ItemProcessor is returned to the master for writing.

Things to note about remote chunking:

  • All I/O is done by the master.
  • The slaves handle processing only and therefore do not need JobRepository access.
  • Remote chunking is more I/O intensive than remote partitioning since the actual data is sent over the wire instead of metadata describing it.

I did a talk on scaling Spring Batch and do a demonstration of remote partitioning that you can watch here: http://www.youtube.com/watch?v=CYTj5YT7CZU

like image 94
Michael Minella Avatar answered Oct 16 '22 10:10

Michael Minella