Hi all,
When importing a large number of studies (~7000), my OpenREM server starts running into resource issues after some time. From what I can tell, Huey appears to be configured to use process-based workers rather than thread-based workers. This results in a steadily growing number of sleeping worker processes, each consuming a small but non-zero amount of memory. Over time, this exhausts available RAM and the operating system begins killing processes.
Would it be possible (and supported) to configure Huey to use thread-based workers instead to avoid this behaviour? Are there any known downsides or reasons why process workers are preferred in OpenREM?
Best regards,
Tim
--
You received this message because you are subscribed to the Google Groups "OpenREM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openrem+u...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/openrem/9111287d-fddf-452a-83b8-929c3c8383c6n%40googlegroups.com.
I believe I have identified the cause of the increasing number of openrem_rdsr.py processes on my system.
Although the openrem_rdsr.py script delegates the actual processing to Huey, the openrem_rdsr.py process itself remains active until it explicitly exits. Queue management is currently handled outside of Huey (in background.py) and relies on an increasing delay mechanism ("_sleep_for_linear_increasing_time()"). As a result, each invocation remains alive in a sleeping state for progressively longer periods.
When multiple RDSRs arrive within a short timeframe, new instances of the script are started while earlier ones are still waiting. This leads to a rapid accumulation of processes.
Reducing the sleep interval does not resolve the issue — it only affects how frequently the waiting processes wake up. The underlying problem is that the entry script continues running instead of exiting after enqueueing the task.
It may be preferable to let Huey manage concurrency control entirely and modify openrem_rdsr.py so that it exits immediately after enqueueing the task to Huey/Redis.
Switching from processes to threads would not address this behaviour, as openrem_rdsr.py is already spawned as a separate process by Orthanc for each incoming RDSR.
Best regards, Tim