Complete External Task REST API calls causing high CPU usage

Hello,

My team has a Node based app with some Camunda workers. One of these workers does what it is supposed to do, and as its last step it makes a series of sequential calls to the Complete External Task route.

Specifically, it is making 11 calls, one at a time, to complete 11 tasks. It does this quite quickly, but we noticed that CPU usage spikes during these calls, often up to 80-86% in my dev environment.

I’ve verified these calls are what is causing the spike by setting a breakpoint, letting the app pause before the calls, and then letting the calls execute. See the image below:

I was able to decrease CPU usage by over half by simply adding a 300ms pause between each request, but that feels like a Band-Aid that shouldn’t be necessary.

Here is how our worker is set up (we are using camunda-worker-node):

  const processSplitsWorker = new Workers(configMgr.config.camundaUri, {
    maxTasks: 1,
    pollingInterval: 100000,
    use: [
      CamundaWorkerLogger,
      CamundaWorkerMetrics
    ]
  });

And where we subscribe:

  if (camundaWorkers.includes("processSplits")) {
    processSplitsWorker.subscribe('cmeProcess:processSplits', {lockDuration: 60000}, 
 processCMESplits);
  }

And then we are making calls to /task/:taskId/complete. Everything works, but the CPU usage is high. Is there any way we can increase the performance of these calls? There seem to be a myriad of Camunda settings that can aid in performance, but I’m not sure where to start.

From your description it’s still not clear to me where those spikes happen. Do they happen on the client (Node) side or in the camunda engine (with the REST API)?

Hi @JohnKearney2020,

(additional to @fml2’s comment): Or is the CPU used by the database (you talk about the dev environment)?

Does it hurt you at all?

You can inspect the completion times in the ACT_HI_ACTINST and check if they match your expectations.

Hope this helps, Ingo