Performance comparison with java ExternalTaskClient vs Servicetask(Rest call)


#1

What is the advantage of external task client?

Same thing we can acheive through making REST API call from a service task.

In external taskclient, it fetches and lock the task and executes the logic in client side and completes the task.
In service task we make rest call to execute the logic and complete the task.

  1. Which is the best approach and gives better performance?

  2. Is the externalclient keeps the connection open forever?

      client.subscribe("creditScoreChecker")
            .lockDuration(1000)
           .handler((externalTask, externalTaskService) -> {}).open();
    
  3. What is the role of worker class in externaltaskclient?

  4. By default, how many external tasks are fetched & locked from topic in one call?

  5. How can we configure threadpools to increase the number of tasks fetched from topic?


#2

A set of benefits of using external task pattern is mentioned in below docs

https://docs.camunda.org/manual/latest/user-guide/process-engine/external-tasks/#the-external-task-pattern


#3

@hassang already read those docs.

My question is related to multi-threading, and how many externaltaskclients need to run?

Topic per externaltaskclient or multiple topics can be polled by one externaltaskclient?


#4

Hi @aravindhrs,

in my opinion external tasks have benefits over delegation code, if the task takes a longer time to complete. My rule of thumb is 10s or longer.

And for this cases I would use long polling in the client to decrease any delays in the process execution, use maxTasks=1 (default is 10) in the external task client and scale the performance of the client with the operation system and hardware, i.e.start more instances of the client.

I think that multithreading in the external task client makes it more complicated and the chance of errors will rise.

It is very simple to wrap the external task client with one or more workers in a spring-boot app and start many of these clients from the command line.

Hope this helps, Ingo