Orthanc CPU utilisation constrained to single core

Good afternoon,

I’m experiencing an issue where Orthanc appears to only be utilising one CPU core (of four) and would like help in troubleshooting this issue.

My Orthanc implementations’ purpose is autorouting studies to and from various Orthanc, VUE PACS and Agfa PACS servers based on the destination AET that the sending system selects. I’m experiencing delays when under load. Orthanc appears to still be processing the transfers, it’s just been slower and this appears to be related to CPU utilisation. I’m seeing when under load, Orthanc appears to be utilising one of four cores available cores to capacity (80-100%).

My Orthanc Server is an AWS EC2 instance (t3a.xlarge, O/S Redhat Linux) running Orthanc v.25.4.2 from a Docker container. This means it should have 4x virtual CPU cores available to process transfers, however, the CPU utilisation of Orthanc on the Docker instance is <100% (of a maximum 400%). I’ve attached a screenshot demonstrating this at high load.

I’ve looked at the orthanc.json. There are a number of settings that ask to specify the number of cores used with zero indicating use all cores. I have tried specifying 0 and 4 but both seem to yield the same result. An example of what I mean is as below:

// Maximum number of processing jobs that are simultaneously running
// at any given time. A value of “0” indicates to use all the
// available CPU logical cores. To emulate Orthanc <= 1.3.2, set
// this value to “1”.
“ConcurrentJobs”: 4,

If anyone has faced similar problems or has suggestions to troubleshoot, I’d really appreciate it. I’ve added my config files to the topic (anonymising identifying information). I’m not sure that the logs represent the issue I’m facing but I can retrieve those if needed. I’m hoping I’ve missed something relatively simple. If further information is needed please let me know.

auto_route.py.txt (8.4 KB)

orthanc.json (54.8 KB)

Hi,

Actually, the OnChange callback is always called from the same Orthanc thread. And, everything in your script is synchronous so everything gets executed in that same thread.

You should start a few worker threads and use a message queue to provide “tasks” to the worker threads from the main OnChange thread.

Note that, from python plugin v6.0, Orthanc provides a queue mechanism. It is being improved in v7.0 with ReserveQueueValue and AcknowledgeQueueValue but v7.0 has not been released yet (we need to release Orthanc 1.12.10 first).

Hope this helps,

Alain.

1 Like