Spark Streaming - obtain batch-level performance stats

大城市里の小女人 提交于 2019-12-08 15:23:30
ImDarrenG

If you have no luck with 1., this will help with 2.:

ssc.addStreamingListener(new JobListener());

// ...

class JobListener implements StreamingListener {

    @Override
    public void onBatchCompleted(StreamingListenerBatchCompleted batchCompleted) {

        System.out.println("Batch completed, Total delay :" + batchCompleted.batchInfo().totalDelay().get().toString() +  " ms");

    }

   /*

   snipped other methods

   */


}

Taken from In Spark Streaming, is there a way to detect when a batch has finished?

batchCompleted.batchInfo() contains:

  • numRecords
  • batchTime, processsingStartTime, processingEndTime
  • schedulingDelay
  • outputOperationInfos

Hopefully you can get what you need from those properties.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!