I need to scale spring batch job by remote partitioning with kafka.
我需要通过使用Kafka远程分区来扩展春季批处理作业。
I want to run manager step on one VM and worker steps on different VMs. For that I have some questions -
我要在一台VM上运行管理器步骤,在不同的VM上运行Worker步骤。为此,我有几个问题-
If my manager VM instance goes down in between before the completion of all worker steps. So it possible for another VM to become manager and complete the manager step?
I have noticed that when I have 3 worker step VMs running with kafka based remote partitioning then first or one of the worker is picked more partitions compare to other worker VMs. Can it possible to equally distribute the equal no of partitions between all these workers ?
更多回答
优秀答案推荐
If my manager VM instance goes down in between before the completion of all worker steps. So it possible for another VM to become manager and complete the manager step?
No, there is no manager (re)election in Spring Batch. If the manager VM fails, you need to restart the job instance.
不,春季批次没有经理(连任)选举。如果管理器VM出现故障,则需要重新启动作业实例。
I have noticed that when I have 3 worker step VMs running with kafka based remote partitioning then first or one of the worker is picked more partitions compare to other worker VMs. Can it possible to equally distribute the equal no of partitions between all these workers ?
This depends on how you distribute work and how you configure workers. If you put step execution requests in the same queue, then all workers will pick up requests from the same queue. Therefore, if one worker is faster than others, it will do more work. If you want to equally distribute work among workers, then you need to setup a queue for each worker and distribute step execution requests in round-robin fashion to equally assign partitions.
这取决于您如何分配工作以及如何配置worker。如果您将步骤执行请求放在同一个队列中,那么所有工作进程都将从同一个队列中拾取请求。因此,如果一个工人比其他工人更快,它将做更多的工作。如果您希望在worker之间平均分配工作,那么您需要为每个worker设置一个队列,并以循环方式分配步骤执行请求,以平均分配分区。
更多回答
thanks @Mahmound Ben Hassine. So in that case if steps are still working or not failed Spring batch mark that job is failed ? Or how to identify that only manager is failed.
谢谢@Mahmound Ben Hassine。那么,在这种情况下,如果步骤仍在工作或没有失败,Spring Batch会将作业标记为失败吗?或者如何识别唯一失败的经理。
When workers finish their work, they update their status in the db and shutdown. When you restart the job instance, the manager will reconcile the status of the partitioned step and resume execution.
当工人完成他们的工作时,他们在数据库中更新他们的状态并关闭。当您重新启动作业实例时,管理器将协调分区步骤的状态并恢复执行。
Ok thanks @Mahmound Ben Hassine Then may be I will try find some solution to auto restart job on another node if manager goes down on one node.
好的,谢谢@Mahmound Ben Hassine,那么如果管理器在一个节点上出现故障,我可能会尝试找到一些解决方案来自动重新启动另一个节点上的作业。
我是一名优秀的程序员,十分优秀!