I’ve recently developed a new class, a snippet of which I’ve attached in the provided image. This class aims to retrieve details of the current task from a stream. However, I’m encountering a significant delay of approximately 20 seconds in this process, which is far from ideal.
The delay primarily stems from fetching variables from an API form and obtaining the process instance key from another API. This waiting time adversely impacts our workflow efficiency.
I’m seeking advice on how to optimize this process to reduce the delay. Are there any strategies or best practices you could recommend for improving the performance of API calls within this context? Additionally, are there alternative approaches I could consider to expedite the retrieval of task details?
Your expertise and insights would be greatly appreciated in resolving this issue. Thank you for your time and assistance.
an other problème ,I encounter a waiting time issue when starting a process instance in Camunda 8. The problem presents itself as follows:
I’ve been able to circumvent the problem by adding a 4-second delay after starting the process instance before attempting to complete the user task (using tasklist REST API). However, this is merely a workaround and not a solution.
I need to add a latency of 0 seconds.
If I understand your issue correctly, the 20-second delay occurs due to various API calls and the necessary wait time for tasks to appear in the Tasks search feature.
Currently, the search endpoint only delivers tasks a few seconds after creation. This is per-design, as Camunda 8 operates as a distributed system relying less on transactions to ensure high availability in Zeebe. However, it does result in a compromise, data consistency across different components is eventually achieved.
Efforts are underway to enhance this. For more information, please refer to this response in a related topic: Camunda 8: Searching for Active Tasks.
As alternative approaches, consider the following options:
Utilize a custom exporter (see Exporters | Camunda 8 Docs), which enables building applications in a more event-driven manner.
Embrace reactive programming and utilize promises for long-running API calls.
For retrieving process instance keys, Zeebe can provide them synchronously upon starting a process instance.
When fetching variables from the task list, do you have some response time metrics? Are there a high number of variables or variables with large sizes contributing to the delay? You can maybe specify in the query only the variables names that you really need.
It will not decrease the APIs latency, but it reduces the latency of the data to be available after being processed by Zeebe. You can find some examples of exporters in camunda-community-hub Camunda Community Hub · GitHub