当前位置: 首页 > 知识库问答 >
问题:

无法在远程分区中执行并行执行

澹台正业
2023-03-14
    Configurations:-
        TaskExecutor:-
           corePoolSize = 3
           maxPoolSize  = 20
           queueCapacity = 100
       gridSize = 3
       chunkSize = 10

我已经定义了partitioner类,它返回与网格大小相同的executionContext。执行上下文={part3=start=0,part1=start=0,part2=start=0}

ReaderClass:-

  public void beforeStep(StepExecution stepExecution) {
    log.info(stepExecution);
  }

  public Scope read(){
     --- some operations---
      return new Scope();
  }

  ProcessClass:-

   public Data process(Scope scope){
      -- some operations --
     return new Data(scope);
   } 

   WriterClass :-

    public void write(List<? extends Data> dataItemsSize){

      -- some operations --
     }

日志:-

            [INFO ] 2019-06-13 09:18:13.389 [Container-28] Reader - beforeStep() reader: stepExecution=StepExecution: id=52175, version=1, name=MatchStep:PART2, status=STARTED, exitStatus=EXECUTING, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=0, exitDescription=
        [INFO ] 2019-06-13 09:18:13.452 [Container-49] Reader - beforeStep() reader: stepExecution=StepExecution: id=52173, version=1, name=MatchStep:PART3, status=STARTED, exitStatus=EXECUTING, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=0, exitDescription=
        [INFO ] 2019-06-13 09:18:13.455 [Container-28] Reader - read() - END: scope=Scope{partitionerId=PART2, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2855, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.455 [Container-28] Reader - read() - END: scope=Scope{partitionerId=PART2, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2841, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.456 [Container-28] Reader - read() - END: scope=Scope{partitionerId=PART2, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2851, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.456 [Container-28] Reader - read() - END: scope=Scope{partitionerId=PART2, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2863, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.476 [Container-30] Reader - beforeStep() reader: stepExecution=StepExecution: id=52171, version=1, name=MatchStep:PART1, status=STARTED, exitStatus=EXECUTING, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=0, exitDescription=
        [INFO ] 2019-06-13 09:18:13.477 [Container-49] Reader - read() - END: scope=Scope{partitionerId=PART3, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2845, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.477 [Container-49] Reader - read() - END: scope=Scope{partitionerId=PART3, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2847, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.477 [Container-49] Reader - read() - END: scope=Scope{partitionerId=PART3, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2861, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.477 [Container-49] Reader - read() - END: scope=null
        [INFO ] 2019-06-13 09:18:13.483 [Container-49] Process - process(): scope=Scope{partitionerId=PART3, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2845, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.483 [Container-28] Process - process(): scope=Scope{partitionerId=PART2, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2855, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.506 [Container-30] Reader - read() - END: scope=Scope{partitionerId=PART1, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2857, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.506 [Container-30] Reader - read() - END: scope=Scope{partitionerId=PART1, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2843, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.506 [Container-30] Reader - read() - END: scope=Scope{partitionerId=PART1, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2849, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.506 [Container-30] Reader - read() - END: scope=Scope{partitionerId=PART1, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2853, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.506 [Container-30] Reader - read() - END: scope=Scope{partitionerId=PART1, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2859, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.506 [Container-30] Reader - read() - END: scope=Scope{partitionerId=PART1, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2865, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.506 [Container-30] Reader - read() - END: scope=null
        [INFO ] 2019-06-13 09:18:13.507 [Container-30] Process - process(): scope=Scope{partitionerId=PART1, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2857, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.509 [Container-28] Process - process(): scope=Scope{partitionerId=PART2, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2841, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.509 [Container-49] Process - process(): scope=Scope{partitionerId=PART3, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2847, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.513 [Container-28] Process - process(): scope=Scope{partitionerId=PART2, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2851, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.513 [Container-49] Process - process(): scope=Scope{partitionerId=PART3, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2861, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.516 [Container-28] Process - process(): scope=Scope{partitionerId=PART2, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2863, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.593 [Container-30] Process - process(): scope=Scope{partitionerId=PART1, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2843, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.598 [Container-30] Process - process(): scope=Scope{partitionerId=PART1, openDate=Thu Jun 13 09:18:13 CDT 2019, execScopeId=2849, execId=1321, iTC=CX}
        [INFO ] 2019-06-13 09:18:13.608 [Container-28] Writer - write(): dataItemsSize=4
        [INFO ] 2019-06-13 09:18:13.608 [Container-49] Writer - write(): dataItemsSize=3

共有1个答案

孙海
2023-03-14

看起来您使用的是TaskExecutorPartitionHandler,根据日志,分区由不同的线程(Container-28Container-30Container-49)并行执行。

需求:-使用spring批处理定义远程分区

如果要配置远程分区,需要使用MessageChannelPartitionHandler。你可以在这里找到如何使用它的例子。

 类似资料:
  • 我试图避免使用阻塞线程模型,而使用反应式模型来实现高吞吐量。我的用例是这样的:有大量的传入消息。对于每条消息,我需要在不阻塞该线程的情况下执行一些I/O操作。在这里,我在一个单独的线程中处理每条消息。如果应用程序被终止,我需要完成正在进行的任务并优雅地关闭。我用的是线。在下面睡眠以模拟密集的I/O操作。代码示例如下: 当我运行这个时,通量似乎忽略了执行者。shutdown()和错误以及中断的异常。

  • 1.3 新版功能. 默认情况下,Fabric 会默认 顺序 执行所有任务(详细信息参见 Execution strategy ),这篇文档将介绍 Fabric 如何在多个主机上 并行 执行任务,包括 Fabric 参数设置、任务独立的装饰器,以及命令行全局控制。 它是如何运转的 由于 Fabric 1.x 并不是完全线程安全(以及为了更加通用,任务函数之间并不会产生交互),该功能的实现是基于 Py

  • 问题内容: 如何在远程Linux机器上执行命令/脚本?说我想从框a的框b开始服务tomcat。 问题答案: 我想这是最好的安全方式,例如: 必须根据您的特定需求(例如,仅绑定到ipv4)部署OPTIONS的地方,并且您的远程命令可能正在启动您的tomcat守护程序。 注意 : 如果不想在每次运行ssh时都提示您,也请查看ssh- agent,以及系统允许的情况。关键是…了解ssh密钥交换过程。请仔

  • 我有一个大约 100GB 的数据源,我正在尝试使用日期列对其进行分区。 为了避免分区内出现小块,我添加了一个重新分区(5 ),使每个分区内最多有5个文件: 我的问题是,在我分配的30个执行器中,只有5个在实际运行。最后我得到了我想要的东西(每个分区内有5个文件),但由于只有5个执行器在运行,所以执行时间非常长。 你有什么建议可以让我做得更快吗?

  • 问题内容: 我们有一个基于石英的调度程序应用程序,该应用程序每分钟运行约1000个作业,每分钟的秒数均匀分布,即每秒约16-17个作业。理想情况下,这16-17个作业应同时触发,但是该作业的execute方法的第一个语句(仅记录执行时间)非常晚。例如,假设我们从05:00到05:04每分钟安排1000个作业。因此,理想情况下,计划在05:03:50进行的作业应该在05:03:50记录了execut

  • 我们目前正在将jBPM(7.37.final)规则部署到一个Kie执行服务器,并使用执行服务器自动公开的REST API调用规则。 但是由于一些体系结构的限制,我们不能使用REST API调用规则。该选项是执行一个基于jar(kie服务器客户机或其他)的集成,并从客户机(java应用程序)远程调用执行服务器上的规则。 Virges Vinay