changeset 7090:7dd351a03668 streaming

reorganizing macros
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Aug 2026 10:21:54 +0000
parents 5de0f5ded9f0
children 5192f6a4cbb8
files OrthancServer/Resources/AdvancedConfiguration.json OrthancServer/Resources/Configuration.json OrthancServer/Sources/OrthancConfiguration.cpp OrthancServer/Sources/OrthancConfiguration.h OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h
diffstat 7 files changed, 71 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Resources/AdvancedConfiguration.json	Thu Aug 13 08:57:31 2026 +0000
+++ b/OrthancServer/Resources/AdvancedConfiguration.json	Thu Aug 13 10:21:54 2026 +0000
@@ -344,17 +344,17 @@
   // (new in Orthanc 1.12.6)
   "MaximumConcurrentDcmtkTranscoders" : 0,
 
-  // 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).
-  // You should monitor the "orthanc_dicom_parser_available_threads"
-  // metrics to determine the optimal value for your setup. (new in
-  // Orthanc 1.13.0)
+  // Number of threads that are used to parse DICOM files (e.g., to
+  // access the value of DICOM tags that are not indexed in the
+  // Orthanc database). You should monitor the
+  // "orthanc_dicom_parser_available_threads" metrics to determine the
+  // optimal value for your setup. (new in Orthanc 1.13.0)
   "DicomParserThreadsCount" : 2,
 
   // Peak amount of RAM (in MB) that can be allocated by the threads
-  // that parse the DICOM files. Note that this limit can be
-  // overpassed when a single file exceeds this size. You should
-  // monitor the "orthanc_dicom_parser_memory_usage_mb" and
+  // that parse the DICOM files. Note that this limit can be exceeded
+  // when a single DICOM instance is larger than this option. You
+  // should monitor the "orthanc_dicom_parser_memory_usage_mb" and
   // "orthanc_dicom_parser_memory_max_usage_mb" metrics to determine
   // the optimal value for your setup. (new in Orthanc 1.13.0)
   "DicomParserMemoryCapacity" : 256,
@@ -372,10 +372,10 @@
 
   // Peak amount of RAM (in MB) that can be allocated by the threads
   // that transcode DICOM instances. Note that this limit can be
-  // overpassed when a single instance exceeds this size. You should
-  // monitor the "orthanc_transcoder_memory_usage_mb" and
-  // "orthanc_transcoder_memory_max_usage_mb" metrics to determine the
-  // optimal value for your setup. (new in Orthanc 1.13.0)
+  // exceeded when a single transcoded instance is larger than this
+  // option. You should monitor the "orthanc_transcoder_memory_usage_mb"
+  // and "orthanc_transcoder_memory_max_usage_mb" metrics to determine
+  // the optimal value for your setup. (new in Orthanc 1.13.0)
   "TranscoderMemoryCapacity" : 256,
 
   // Maximum size of the cache of transcoded DICOM files (in MB). This
@@ -385,11 +385,11 @@
   "TranscoderCacheSize" : 256,
 
   // Total number of threads that are used to provide DICOM files
-  // sequentially (currently used in Archive jobs, C-Store and C-Get).
+  // sequentially (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 "StorageLoaderThreadsCount".  You
+  // storage loader thread. Therefore, by default, the value of this
+  // configuration is identical to "StorageLoaderThreadsCount". You
   // should monitor the "orthanc_seq_reader_available_threads" metrics
   // to determine the optimal value for your setup and usage. (new in
   // Orthanc 1.13.0)
@@ -407,10 +407,10 @@
   // "SequentialDicomReaderWindowSize" : 4,
 
   // Peak amount of RAM (in MB) that can be allocated by each
-  // sequential DICOM reader. The sequential DICOM reader stops pauses
+  // sequential DICOM reader. The sequential DICOM reader 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.13.0)
+  // that this limit can be exceeded when a single file is larger than
+  // this option. (new in Orthanc 1.13.0)
   "SequentialDicomReaderWindowCapacity" : 64
 }
--- a/OrthancServer/Resources/Configuration.json	Thu Aug 13 08:57:31 2026 +0000
+++ b/OrthancServer/Resources/Configuration.json	Thu Aug 13 10:21:54 2026 +0000
@@ -62,8 +62,8 @@
 
   // Peak amount of RAM (in MB) that can be allocated by the threads
   // loading from the storage area. Note that this limit can be
-  // overpassed when a single file exceeds this size. You should
-  // monitor the "orthanc_storage_memory_usage_mb" and
+  // exceeded when a single file is larger than this option. You
+  // should monitor the "orthanc_storage_memory_usage_mb" and
   // "orthanc_storage_memory_max_usage_mb" metrics to determine the
   // optimal value for your setup. (new in Orthanc 1.13.0)
   "StorageMemoryCapacity" : 512,
--- a/OrthancServer/Sources/OrthancConfiguration.cpp	Thu Aug 13 08:57:31 2026 +0000
+++ b/OrthancServer/Sources/OrthancConfiguration.cpp	Thu Aug 13 10:21:54 2026 +0000
@@ -1501,19 +1501,4 @@
       return loaderThreads;
     }
   }
-
-  unsigned int OrthancConfiguration::GetConcurrentJobs() const
-  {
-    return GetUnsignedIntegerParameter(ORTHANC_CONFIG_CONCURRENT_JOBS);
-  }
-
-  unsigned int OrthancConfiguration::GetHttpThreadsCount() const
-  {
-    return GetUnsignedIntegerParameter(ORTHANC_CONFIG_HTTP_THREADS_COUNT);
-  }
-
-  unsigned int OrthancConfiguration::GetDicomThreadsCount() const
-  {
-    return GetUnsignedIntegerParameter(ORTHANC_CONFIG_DICOM_THREADS_COUNT);
-  }
 }
--- a/OrthancServer/Sources/OrthancConfiguration.h	Thu Aug 13 08:57:31 2026 +0000
+++ b/OrthancServer/Sources/OrthancConfiguration.h	Thu Aug 13 10:21:54 2026 +0000
@@ -62,20 +62,6 @@
 #define ORTHANC_CONFIG_ZIP_LOADER_THREADS "ZipLoaderThreads"   // for backward compatibility only
 
 
-#define ORTHANC_CONFIG_STORAGE_LOADER_THREADS_COUNT "StorageLoaderThreadsCount"
-#define ORTHANC_CONFIG_STORAGE_MEMORY_CAPACITY "StorageMemoryCapacity"
-#define ORTHANC_CONFIG_MAXIMUM_STORAGE_CACHE_SIZE "MaximumStorageCacheSize"
-#define ORTHANC_CONFIG_DICOM_PARSER_SOURCE_THREADS_COUNT "DicomParserThreadsCount"
-#define ORTHANC_CONFIG_DICOM_PARSER_MEMORY_CAPACITY "DicomParserMemoryCapacity"
-#define ORTHANC_CONFIG_DICOM_PARSER_CACHE_SIZE "DicomParserCacheSize"
-#define ORTHANC_CONFIG_TRANSCODER_THREADS_COUNT "TranscoderThreadsCount"
-#define ORTHANC_CONFIG_TRANSCODER_MEMORY_CAPACITY "TranscoderMemoryCapacity"
-#define ORTHANC_CONFIG_TRANSCODER_CACHE_SIZE "TranscoderCacheSize"
-#define ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_THREADS_COUNT "SequentialDicomReaderThreadsCount"
-#define ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_WINDOW_SIZE "SequentialDicomReaderWindowSize"
-#define ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_WINDOW_CAPACITY "SequentialDicomReaderWindowCapacity"
-
-
 
 namespace Orthanc
 {
@@ -285,11 +271,20 @@
 
     unsigned int GetLoaderThreads() const;
 
-    unsigned int GetConcurrentJobs() const;
+    unsigned int GetConcurrentJobs() const
+    {
+      return GetUnsignedIntegerParameter(ORTHANC_CONFIG_CONCURRENT_JOBS);
+    }
 
-    unsigned int GetHttpThreadsCount() const;
+    unsigned int GetHttpThreadsCount() const
+    {
+      return GetUnsignedIntegerParameter(ORTHANC_CONFIG_HTTP_THREADS_COUNT);
+    }
 
-    unsigned int GetDicomThreadsCount() const;
+    unsigned int GetDicomThreadsCount() const
+    {
+      return GetUnsignedIntegerParameter(ORTHANC_CONFIG_DICOM_THREADS_COUNT);
+    }
 
     void Format(std::string& result) const;
     
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Thu Aug 13 08:57:31 2026 +0000
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Thu Aug 13 10:21:54 2026 +0000
@@ -166,7 +166,6 @@
     ServerContext& context = OrthancRestApi::GetContext(call);
 
     Json::Value result = Json::objectValue;
-    Json::Value performance = Json::objectValue;
 
     result[API_VERSION] = ORTHANC_API_VERSION;
     result[VERSION] = ORTHANC_VERSION;
@@ -188,35 +187,9 @@
       result[ORTHANC_CONFIG_MAXIMUM_PATIENT_COUNT] = lock.GetConfiguration().GetMaximumPatientCount(); // New in Orthanc 1.12.4
       result[ORTHANC_CONFIG_MAXIMUM_STORAGE_MODE] = lock.GetConfiguration().GetMaximumStorageMode(); // New in Orthanc 1.11.3
       result[ORTHANC_CONFIG_DICOM_DEFAULT_RETRIEVE_METHOD] = lock.GetConfiguration().GetDicomDefaultRetrieveMethod();
-
-      performance[ORTHANC_CONFIG_HTTP_THREADS_COUNT] = lock.GetConfiguration().GetHttpThreadsCount();
-      performance[ORTHANC_CONFIG_DICOM_THREADS_COUNT] = lock.GetConfiguration().GetDicomThreadsCount();
-      performance[ORTHANC_CONFIG_CONCURRENT_JOBS] = lock.GetConfiguration().GetConcurrentJobs();
     }
 
-    {
-      // New in Orthanc 1.13.0
-
-      uint64_t storageMemoryCapacity, transcoderMemoryCapacity, dicomParserMemoryCapacity;
-      size_t storageMemoryCache, transcoderMemoryCache, dicomParserMemoryCache;
-      unsigned int storageReaderThreadsCount, transcoderReaderThreadsCount, dicomParserThreadsCount;
-
-      context.GetDataSourcesConfigurations(storageMemoryCapacity, storageMemoryCache, storageReaderThreadsCount,
-                                          transcoderMemoryCapacity, transcoderMemoryCache, transcoderReaderThreadsCount,
-                                          dicomParserMemoryCapacity, dicomParserMemoryCache, dicomParserThreadsCount);
-
-      performance[ORTHANC_CONFIG_DICOM_PARSER_CACHE_SIZE] = BytesToMegabytes(dicomParserMemoryCache);
-      performance[ORTHANC_CONFIG_DICOM_PARSER_MEMORY_CAPACITY] = BytesToMegabytes(dicomParserMemoryCapacity);
-      performance[ORTHANC_CONFIG_DICOM_PARSER_SOURCE_THREADS_COUNT] = dicomParserThreadsCount;
-      performance[ORTHANC_CONFIG_MAXIMUM_STORAGE_CACHE_SIZE] = BytesToMegabytes(storageMemoryCache);
-      performance[ORTHANC_CONFIG_STORAGE_LOADER_THREADS_COUNT] = storageReaderThreadsCount;
-      performance[ORTHANC_CONFIG_STORAGE_MEMORY_CAPACITY] = BytesToMegabytes(storageMemoryCapacity);
-      performance[ORTHANC_CONFIG_TRANSCODER_CACHE_SIZE] = BytesToMegabytes(transcoderMemoryCache);
-      performance[ORTHANC_CONFIG_TRANSCODER_MEMORY_CAPACITY] = BytesToMegabytes(transcoderMemoryCapacity);
-      performance[ORTHANC_CONFIG_TRANSCODER_THREADS_COUNT] = transcoderReaderThreadsCount;
-    }
-
-    result[PERFORMANCE] = performance;
+    context.ExportPerformanceParameters(result[PERFORMANCE]);
 
     DicomTransferSyntax ingestTransferSyntax;
     if (context.LookupIngestTranscoding(ingestTransferSyntax))
--- a/OrthancServer/Sources/ServerContext.cpp	Thu Aug 13 08:57:31 2026 +0000
+++ b/OrthancServer/Sources/ServerContext.cpp	Thu Aug 13 10:21:54 2026 +0000
@@ -70,6 +70,21 @@
 #endif
 
 
+// Symbolic name for configuration options
+static const char* const ORTHANC_CONFIG_STORAGE_LOADER_THREADS_COUNT = "StorageLoaderThreadsCount";
+static const char* const ORTHANC_CONFIG_STORAGE_MEMORY_CAPACITY = "StorageMemoryCapacity";
+static const char* const ORTHANC_CONFIG_MAXIMUM_STORAGE_CACHE_SIZE = "MaximumStorageCacheSize";
+static const char* const ORTHANC_CONFIG_DICOM_PARSER_SOURCE_THREADS_COUNT = "DicomParserThreadsCount";
+static const char* const ORTHANC_CONFIG_DICOM_PARSER_MEMORY_CAPACITY = "DicomParserMemoryCapacity";
+static const char* const ORTHANC_CONFIG_DICOM_PARSER_CACHE_SIZE = "DicomParserCacheSize";
+static const char* const ORTHANC_CONFIG_TRANSCODER_THREADS_COUNT = "TranscoderThreadsCount";
+static const char* const ORTHANC_CONFIG_TRANSCODER_MEMORY_CAPACITY = "TranscoderMemoryCapacity";
+static const char* const ORTHANC_CONFIG_TRANSCODER_CACHE_SIZE = "TranscoderCacheSize";
+static const char* const ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_THREADS_COUNT = "SequentialDicomReaderThreadsCount";
+static const char* const ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_WINDOW_SIZE = "SequentialDicomReaderWindowSize";
+static const char* const ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_WINDOW_CAPACITY = "SequentialDicomReaderWindowCapacity";
+
+
 // Those metrics correspond to those found in StorageAccessor in Orthanc <= 1.12.11
 static const char* const METRICS_STORAGE_AREA_CREATE_DURATION = "orthanc_storage_create_duration_ms";
 static const char* const METRICS_STORAGE_AREA_READ_BYTES = "orthanc_storage_read_bytes";
@@ -2454,36 +2469,39 @@
     return *dicomSequentialReaderFactory_;
   }
 
-  void ServerContext::GetDataSourcesConfigurations(uint64_t& storageMemoryCapacity,
-                                                   size_t& storageMemoryCache,
-                                                   unsigned int& storageReaderThreadsCount,
-                                                   uint64_t& transcoderMemoryCapacity,
-                                                   size_t& transcoderMemoryCache,
-                                                   unsigned int& transcoderReaderThreadsCount,
-                                                   uint64_t& dicomParserMemoryCapacity,
-                                                   size_t& dicomParserMemoryCache,
-                                                   unsigned int& dicomParserThreadsCount)
+  void ServerContext::ExportPerformanceParameters(Json::Value& target)
   {
-    storageMemoryCapacity = storageAreaReader_->GetCapacity();
-    storageMemoryCache = storageAreaReader_->GetCacheCapacity();
-    transcoderMemoryCapacity = transcoderReader_->GetCapacity();
-    transcoderMemoryCache = transcoderReader_->GetCacheCapacity();
-    dicomParserMemoryCapacity = dicomReader_->GetCapacity();
-    dicomParserMemoryCache = dicomReader_->GetCacheCapacity();
+    target = Json::objectValue;
+
+    target[ORTHANC_CONFIG_MAXIMUM_STORAGE_CACHE_SIZE] = BytesToMegabytes(storageAreaReader_->GetCacheCapacity());
+    target[ORTHANC_CONFIG_STORAGE_MEMORY_CAPACITY] = BytesToMegabytes(storageAreaReader_->GetCapacity());
+
+    target[ORTHANC_CONFIG_DICOM_PARSER_CACHE_SIZE] = BytesToMegabytes(dicomReader_->GetCacheCapacity());
+    target[ORTHANC_CONFIG_DICOM_PARSER_MEMORY_CAPACITY] = BytesToMegabytes(dicomReader_->GetCapacity());
+
+    target[ORTHANC_CONFIG_TRANSCODER_CACHE_SIZE] = BytesToMegabytes(transcoderReader_->GetCacheCapacity());
+    target[ORTHANC_CONFIG_TRANSCODER_MEMORY_CAPACITY] = BytesToMegabytes(transcoderReader_->GetCapacity());
 
     {
       boost::shared_ptr<IExecutorService> service = storageAreaReader_->GetExecutorService();
-      storageReaderThreadsCount = dynamic_cast<ThreadPool&>(*service).GetThreadsCount();
+      target[ORTHANC_CONFIG_STORAGE_LOADER_THREADS_COUNT] = dynamic_cast<ThreadPool&>(*service).GetThreadsCount();
+    }
+
+    {
+      boost::shared_ptr<IExecutorService> service = dicomReader_->GetExecutorService();
+      target[ORTHANC_CONFIG_DICOM_PARSER_SOURCE_THREADS_COUNT] = dynamic_cast<ThreadPool&>(*service).GetThreadsCount();
     }
 
     {
       boost::shared_ptr<IExecutorService> service = transcoderReader_->GetExecutorService();
-      transcoderReaderThreadsCount = dynamic_cast<ThreadPool&>(*service).GetThreadsCount();
+      target[ORTHANC_CONFIG_TRANSCODER_THREADS_COUNT] = dynamic_cast<ThreadPool&>(*service).GetThreadsCount();
     }
 
     {
-      boost::shared_ptr<IExecutorService> service = dicomReader_->GetExecutorService();
-      dicomParserThreadsCount = dynamic_cast<ThreadPool&>(*service).GetThreadsCount();
+      OrthancConfiguration::ReaderLock lock;
+      target[ORTHANC_CONFIG_HTTP_THREADS_COUNT] = lock.GetConfiguration().GetHttpThreadsCount();
+      target[ORTHANC_CONFIG_DICOM_THREADS_COUNT] = lock.GetConfiguration().GetDicomThreadsCount();
+      target[ORTHANC_CONFIG_CONCURRENT_JOBS] = lock.GetConfiguration().GetConcurrentJobs();
     }
   }
 }
--- a/OrthancServer/Sources/ServerContext.h	Thu Aug 13 08:57:31 2026 +0000
+++ b/OrthancServer/Sources/ServerContext.h	Thu Aug 13 10:21:54 2026 +0000
@@ -611,14 +611,6 @@
 
     DicomSequentialReader::Factory& GetDicomSequentialReaderFactory();
 
-    void GetDataSourcesConfigurations(uint64_t& storageMemoryCapacity,
-                                      size_t& storageMemoryCache,
-                                      unsigned int& storageReaderThreadsCount,
-                                      uint64_t& transcoderMemoryCapacity,
-                                      size_t& transcoderMemoryCache,
-                                      unsigned int& transcoderReaderThreadsCount,
-                                      uint64_t& dicomParserMemoryCapacity,
-                                      size_t& dicomParserMemoryCache,
-                                      unsigned int& dicomParserThreadsCount);
+    void ExportPerformanceParameters(Json::Value& target);
   };
 }