Delay between tasks in long polling mode

Hi,

I have .NET C# Camunda clients that work with external tasks.
I run BPM process that has about 20 tasks. For each task there is a worker thread that perform long polling to get work.

The problem is that there is delay between the tasks execution. After one task is finished, the next task fetchAndLock doesn’t response immediately, the response return after more that 1000 miliseconds.
When I look at the process history ("/history/activity-instance?processInstanceId=…"), I can see that task durationInMillis include the delay.

After disabling the long polling, the fetchAndLock returned immediately for all tasks.
Another thing, I work with PostresSql. When I switch to h2, there’s no problem at all.

Is there a reason why fetchAndLock response is delayed?
What is the best practice to work with AsyncResponseTimeout ?

Hi @danb-sn
Welcome to the forum!
Can you you give me more information about your setup? Are you using a clustered environment? what version of Camunda are you using and can you share the settings being used by the clients. Even better would be to share some of the code.

I’m using Camunda 7.13.
I have been reproduced the issue locally. I mean that I run standalone running from ‘start-camunda.bat’ . I tested with h2, Postgres and MSSQL.
About the the code, I cannot share but it is about 2 running .NET services that work the same.
On startup all the BPMN files are deployed and for each BPM task there is a a FetchAndLock listening thread. Each thared It is listening for single topic with long polling of 1 minutes.
The total tasks/listening FetchAndLock threads are about 130.

As I said, the issue occurs when I work with database other than h2. According to the process history, It seams that the long polling response returns with delay of 500 to 1000 milliseconds after the task is really started. The expected behavior is that the long polling response will be triggered and return immediately.

Thats true - it should return straight away. There are some things that could affect it.
If you’ve got camunda setup in a cluster it’s possible that it takes longer, i’m trying to think how the database might affect it and it shouldn’t have much of an impact. Perhaps using an older driver.

Thanks for the response. I an not using cluster and according to your recommendation just tried with latest PostreSql jar driver. I get same results.
When I disable the long polling the tasks returns immediately.
Is there any thing else that can cause this delayed response ?