[ 
https://issues.apache.org/jira/browse/FINERACT-2507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18061391#comment-18061391
 ] 

Piotr Wargulak commented on FINERACT-2507:
------------------------------------------

I've pinpoint the delay to the: 
`org.springframework.batch.integration.partition.MessageChannelPartitionHandler#pollReplies`
 

 
{code:java}
Poller<Set<StepExecution>> poller = new DirectPoller<>(pollInterval);
Future<Set<StepExecution>> resultsFuture = poller.poll(callback);

if (timeout >= 0) {
  return resultsFuture.get(timeout, TimeUnit.MILLISECONDS);
}
else {
  return resultsFuture.get();
} {code}
 

 

The DirectPoller checks each `pollInterval` milliseconds whether a  `Loan COB 
partition - Step` has finished.

The `pollInterval` is ultimately controlled by `
fineract.partitioned-job.partitioned-job-properties[0].poll-interval` property, 
with default value 10000ms.
This can be changed via `LOAN_COB_POLL_INTERVAL` env variable.
 
Changing the LOAN_COB_POLL_INTERVAL to lower value, for example 500ms, directly 
lowers the `Loan COB partition - Step` execution time.
Resulting in log:
{code:java}
fineract-custom  | 2026-02-26 15:16:55.370 
[loanCOBCatchUpThreadPoolTaskExecutor-1] INFO  o.s.batch.core.step.AbstractStep 
- Step: [Loan COB partition - Step] executed in 510ms {code}
h2. But

After some time, after the change to LOAN_COB_POLL_INTERVAL, and after my 
deployment got more data (not much, it was still a local development), the COB 
speed up even more. It did not survive restart.

I suspect it is caused by the `DirectPoller` doing `poll -> wait -> poll -> 
...`, which makes it possible that a partition will finish before 1st Poller 
check.

> COB Catch-Up Execution time on empty DB takes 10s per day
> ---------------------------------------------------------
>
>                 Key: FINERACT-2507
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2507
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Job Scheduler, Loan
>            Reporter: Piotr Wargulak
>            Priority: Minor
>
> The Loan COB Job execution takes more then 10s per day, using default 
> fineract setup and "empty" database with a single Loan.
> Log:
> {code:java}
> ...
> fineract-custom  | 2026-02-26 14:49:34.385 
> [loanCOBCatchUpThreadPoolTaskExecutor-1] INFO  
> o.s.batch.core.step.AbstractStep - Step: [Loan COB partition - Step] executed 
> in 15s33ms  
> ...{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to