Java Spring Batch远程分块和远程分区的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20323229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between spring batch remote chunking and remote partitioning
提问by javalearner
What is the difference between spring batch remote chunking and remote partitioning?
Spring Batch远程分块和远程分区有什么区别?
I can not understand the difference between remote chunking and remote partitioning in spring batch. Could anybody please explain?
我无法理解 spring 批处理中远程分块和远程分区之间的区别。有人可以解释一下吗?
采纳答案by Michael Minella
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 Partitionerto 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 MessageChannelPartitionHandleris typically used). The slaves execute their step and return the resulting statuses for aggregation by the master.
分区是一种主/从步骤配置,允许并行处理数据分区。每个分区都通过一些元数据进行描述。例如,如果您正在处理一个数据库表,分区 1 可能是 ids 0-100,分区 2 是 101-200,等等。对于 Spring Batch,主步骤使用分区器生成包含每个分区的元数据的 ExecutionContexts。这些 ExecutionContexts 被分发到 slave step 由PartitionHandler处理(对于远程分区,通常使用MessageChannelPartitionHandler)。从站执行他们的步骤并返回结果状态以供主站聚合。
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.
- 输入和输出对于从站来说是本地的。例如,如果输入是文件,则从设备需要访问该文件。
- 从站需要访问 JobRepository。从站是完全定义的 Spring Batch 步骤,因此它们需要 JobRepository 访问权限。
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.
远程分块类似于远程分区,因为它是一种主/从配置。然而,对于远程分块,数据由主站读取并通过线路发送到从站进行处理。处理完成后,将 ItemProcessor 的结果返回给 master 进行写入。
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/O 都由主站完成。
- slaves 只处理处理,因此不需要 JobRepository 访问。
- 远程分块比远程分区更需要 I/O,因为实际数据是通过网络发送的,而不是描述它的元数据。
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
我做了一个关于扩展 Spring Batch 的演讲,并做了一个远程分区的演示,你可以在这里观看:http: //www.youtube.com/watch?v=CYTj5YT7CZU