1

I am using deployer partition handler for remote partitioning in spring batch. I want to get the status of each worker node at regular intervals and display it to the user. ( Like heartbeats ). Is there any approach to achieve this ?

dave
  • 19
  • 5

1 Answers1

2

This depends on what your workers are doing (simple tasklet or chunk-oriented one) and how they are reporting their progress. Typically, workers share the same job repository as the manager step that launched them, so you should be able to track their StepExecution updates (readCount, writeCount, etc) on that repository using the JobExplorer API.

If you deploy your job on Spring Cloud DataFlow, you can use the Step execution progress endpoint to track the progress of workers.

Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50
  • Thanks ! Also, is it possible to get the cpu and memory usage of each worker ? – dave Aug 25 '21 at 07:42
  • 1
    Yes. You could use JMX to report such metrics or leverage micrometer's monitoring and metrics features which are used behind the scene by Spring Batch and Spring Boot. Please refer to https://docs.spring.io/spring-batch/docs/4.3.x/reference/html/monitoring-and-metrics.html#monitoring-and-metrics and https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html – Mahmoud Ben Hassine Aug 25 '21 at 08:19