camunda / camunda-bpm-platform

Flexible framework for workflow and decision automation with BPMN and DMN. Integration with Quarkus, Spring, Spring Boot, CDI.
https://camunda.com/
Apache License 2.0
4.1k stars 1.55k forks source link

Add support for parallel execution of external tasks to Java external task client #2984

Open mboskamp opened 1 year ago

mboskamp commented 1 year ago

User Story (Required on creation)

Users should be able to configure the external task client (Java) to use multiple threads to execute external tasks.

Functional Requirements (Required before implementation)

Technical Requirements (Required before implementation)

Limitations of Scope

Hints

Links

Breakdown

tonny1983 commented 6 months ago

With all due respect, could you please clarify some more detail background behind the change from single thread model to multi-thread model of external task client?

In fact, there are lots of discussions about the issue, such as this, this and so on. In those past discussions, we, the users, were taught that introducing multi-thread model might not provide higher performance than single thread model and would introduce complexity. Instead of that, multiple external task clients should be used, in the case which higher performance is required. In my opinion, it reallty makes sence. Considering the different business logic of handling different topics, one external task client generally subscribes to one topic which may be defined in a multi-instance service task. In this case, it might very easily cause OptimisticLockingException when more than one thread tries to complete external tasks of a multi-instance service task.

Another fact of multi-thread model of external task client might cause a operation problem, that it is easy to monitor the performation a Java application but it is hard to do the same thing for threads in a Java application. Because of the fact, it is very hard to monitor the job executor which is just running in multi-thread model.

Virtual threads, which was introduced from JVM 19 and Spring Boot 3.2, really reduces the cost of creating and running threads, and it must be a reasonable aspect to introduce multi-thread model into the external task client. However, may I know some more business aspects, e.g. some business use cases, in which the multi-thread model is better that single thread model.

mboskamp commented 6 months ago

Hi @tonny1983, this feature request is currently not prioritized for any release (it has no version label). This means we are currently not working on it, and also, from a business perspective, we don't have evidence that this change would have a significant impact.

We will only plan the technical details of future implementation approaches when an issue is scheduled for release. Therefore, it is tough to compare approaches and weigh the pros and cons before that because we lack detailed information.

I don't know what you want to learn with your post. It sounds like you advocate for keeping the current, single-threaded approach. A possible future implementation for this feature would certainly not remove that option but add the possibility of configuring multi-threading for the external task client. But as I said, we currently don't know what such a solution would look like and don't work on it actively.

If you want to discuss use cases, the forum is a better place to do this. Cheers, Miklas