changeset 7000:053ce2231c18 streaming

clarified new configurations
author Alain Mazy <am@orthanc.team>
date Mon, 06 Jul 2026 15:06:54 +0200
parents d286eec23500
children e9cebd8402c5
files OrthancServer/Resources/Configuration.json OrthancServer/Sources/OrthancConfiguration.h OrthancServer/Sources/ServerContext.cpp
diffstat 3 files changed, 32 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Resources/Configuration.json	Mon Jul 06 15:06:09 2026 +0200
+++ b/OrthancServer/Resources/Configuration.json	Mon Jul 06 15:06:54 2026 +0200
@@ -1157,6 +1157,11 @@
 
 
 
+  // -> TODO-Streaming: move this into AdvancedConfiguration.json
+
+  // add a page in the book: performance: fine tuning: limiting memory + increasing the number of threads blah blah blah
+
+
   // Number of threads that are used to parse DICOM files (when you need
   // to access the value of DICOM tags that are not store in DB).
   // (new in Orthanc 1.12.11+)
@@ -1201,26 +1206,33 @@
   "TranscoderCacheSize" : 128,
 
   // Number of threads that are used to provide DICOM files sequentially
-  // (currently used in Archive jobs, C-Store and C-Get).  This limits
-  // the number of concurrent such jobs.
-  // TODO-Streaming: clarify the meaning with Seb.  If the above definition
-  // is correct; shouldn't we simply set it to the same value as "ConcurrentJobs" if not defined ?
-  // (new in Orthanc 1.12.11+)
+  // (currently used in Archive jobs, C-Store and C-Get).
+  // Each time such a job needs to get a DICOM file content, it requests it from
+  // a sequential DICOM reader that will itself use a s torage loader thread.
+  // Therefore, by default, the value of this configuration is identical to
+  // "StorageLoaderThreads".
+  // (new in Orthanc 1.13.0)
   // You should monitor the "orthanc_seq_reader_available_threads" 
   // metrics to determine the optimal value for your setup and usage.
-  "SequentialDicomReaderThreads": 2,
+  // "SequentialDicomReaderThreads": 4,
 
-  // TODO-Streaming: clarify the meaning with Seb.
   // Number of files each sequential DICOM reader is allowed to buffer
   // in advance before it is consumed by the related job.
+  // This is kind of equivalent to the older "LoaderThreads" configuration
+  // but, furthermore, you must make sure that there are enough "StorageLoaderThreads"
+  // and "SequentialDicomReaderThreads" for each job -> 
+  // "StorageLoaderThreads" should be larger than "ConcurrentJobs" * "SequentialDicomReaderWindowCapacity"
+  // Together with "SequentialDicomReaderWindowCapacity", this also defines the amount of memory that is
+  // used by each job that required a SequentialDicomReader.
   "SequentialDicomReaderWindowSize": 4,
   
-  // TODO-Streaming: clarify the meaning with Seb.
   // Amount of RAM (in MB) that are allocated to each sequential DICOM
-  // Reader.
+  // Reader.  The sequential DICOM reader stops pauses buffering as soon
+  // as one of the "SequentialDicomReaderWindowSize" or 
+  // "SequentialDicomReaderWindowCapacity" limit is reached.
   // Note that this limit can be overpassed when a single file 
   // exceeds this size.
-  // (new in Orthanc 1.12.11+).
+  // (new in Orthanc 1.13.0).
   "SequentialDicomReaderWindowCapacity": 64
 
 }
--- a/OrthancServer/Sources/OrthancConfiguration.h	Mon Jul 06 15:06:09 2026 +0200
+++ b/OrthancServer/Sources/OrthancConfiguration.h	Mon Jul 06 15:06:54 2026 +0200
@@ -57,10 +57,9 @@
 #define ORTHANC_CONFIG_HTTP_THREADS_COUNT "HttpThreadsCount"
 #define ORTHANC_CONFIG_DICOM_THREADS_COUNT "DicomThreadsCount"
 
-// TODO-Streaming: finalize the names with Seb
 #define ORTHANC_CONFIG_STORAGE_LOADER_THREADS "StorageLoaderThreads"
 #define ORTHANC_CONFIG_STORAGE_MEMORY_CAPACITY "StorageMemoryCapacity"
-#define ORTHANC_CONFIG_MAXIMUM_STORAGE_CACHE_SIZE "MaximumStorageCacheSize"  // TODO-Streaming: we keep the old naming for historical reasons ?
+#define ORTHANC_CONFIG_MAXIMUM_STORAGE_CACHE_SIZE "MaximumStorageCacheSize"
 #define ORTHANC_CONFIG_DICOM_PARSER_SOURCE_THREADS "DicomParserThreads"
 #define ORTHANC_CONFIG_DICOM_PARSER_MEMORY_CAPACITY "DicomParserMemoryCapacity"
 #define ORTHANC_CONFIG_DICOM_PARSER_CACHE_SIZE "DicomParserCacheSize"
--- a/OrthancServer/Sources/ServerContext.cpp	Mon Jul 06 15:06:09 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Mon Jul 06 15:06:54 2026 +0200
@@ -727,8 +727,15 @@
         dicomParserThreads = lock.GetConfiguration().GetUnsignedIntegerParameter(ORTHANC_CONFIG_DICOM_PARSER_SOURCE_THREADS, 2);
         LOG(WARNING) << "'" << ORTHANC_CONFIG_DICOM_PARSER_SOURCE_THREADS << "' is set to " << dicomParserThreads;
 
-        sequentialReaderThreads = lock.GetConfiguration().GetUnsignedIntegerParameter(ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_THREADS, 2);
-        LOG(WARNING) << "'" << ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_THREADS << "' is set to " << sequentialReaderThreads;
+        if (!lock.GetConfiguration().LookupUnsignedIntegerParameter(sequentialReaderThreads, ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_THREADS))
+        {
+          LOG(WARNING) << "'" << ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_THREADS << "' is not defined in your configuration, setting it to the same value as '" << ORTHANC_CONFIG_STORAGE_LOADER_THREADS << "': " << storageLoaderThreads;
+          sequentialReaderThreads = storageLoaderThreads;
+        }
+        else
+        {
+          LOG(WARNING) << "'" << ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_THREADS << "' is set to " << sequentialReaderThreads;
+        }
 
         // ----> IF you update values here, you must also update them in Configuration.json <-----
         GetMemoryConfiguration(storageMemoryCapacityMb, lock, ORTHANC_CONFIG_STORAGE_MEMORY_CAPACITY, 512);