changeset 6946:1c3879dd6b89 streaming

added configurations for threads, memory capacity and cache
author Alain Mazy <am@orthanc.team>
date Fri, 12 Jun 2026 11:34:03 +0200
parents beaa09afa130
children 1026c249158f
files NEWS OrthancFramework/Sources/Constants.h OrthancFramework/Sources/DataSource/DataSourceMemoryBudget.cpp OrthancFramework/Sources/DataSource/DataSourceReader.cpp OrthancFramework/Sources/DataSource/DataSourceReader.h OrthancFramework/Sources/MultiThreading/IExecutorService.h OrthancFramework/Sources/MultiThreading/ThreadPool.cpp OrthancFramework/Sources/MultiThreading/ThreadPool.h OrthancServer/Sources/OrthancConfiguration.h OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h
diffstat 12 files changed, 190 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Jun 11 10:04:31 2026 +0200
+++ b/NEWS	Fri Jun 12 11:34:03 2026 +0200
@@ -9,6 +9,15 @@
   This change brings updated configurations (TODO: review):
   - "StorageLoaderThreads"
   - "StorageMemoryCapacity"
+  - "DicomParserThreads"
+  - "DicomParserMemoryCapacity"
+  - "DicomParserCacheSize"
+  - "TranscoderThreads"
+  - "TranscoderMemoryCapacity"
+  - "TranscoderCacheSize"
+  - "SequentialDicomReaderThreads"
+  - "SequentialDicomReaderWindowSize"
+  - "SequentialDicomReaderWindowCapacity"
   And new metrics:
   - TODO list
 * New values for "OverwriteInstances" configuration. In previous versions, this configuration
--- a/OrthancFramework/Sources/Constants.h	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancFramework/Sources/Constants.h	Fri Jun 12 11:34:03 2026 +0200
@@ -33,6 +33,16 @@
   static const uint64_t MEGABYTE = 1024ull * 1024ull;
   static const uint64_t GIGABYTE = 1024ull * 1024ull * 1024ull;
 
+  inline float BytesToFloatMegabytes(uint64_t size)
+  {
+    return static_cast<float>(size) / static_cast<float>(MEGABYTE);
+  }
+
+  inline unsigned int BytesToMegabytes(uint64_t size)
+  {
+    return size / MEGABYTE;
+  }
+
   static const uint64_t MAX_IMAGE_FRAME_SIZE = (sizeof(void*) == 4
                                                 ? 1 * Orthanc::GIGABYTE   // 1 GB on 32 bits system
                                                 : 4 * Orthanc::GIGABYTE); // 4 GB on 64 bits system
--- a/OrthancFramework/Sources/DataSource/DataSourceMemoryBudget.cpp	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DataSourceMemoryBudget.cpp	Fri Jun 12 11:34:03 2026 +0200
@@ -69,10 +69,10 @@
     {
       maxMemoryUsageSinceStart_ = std::max(currentMemorySize, maxMemoryUsageSinceStart_);
 
-      metrics_->SetFloatValue(capacityMaxSizeMegabytesName_, static_cast<float>(maximumMemorySize) / static_cast<float>(MEGABYTE)); // will be updated when we set the capacity
-      metrics_->SetFloatValue(capacityCurrentSizeMegabytesName_, static_cast<float>(currentMemorySize) / static_cast<float>(MEGABYTE));
+      metrics_->SetFloatValue(capacityMaxSizeMegabytesName_, BytesToFloatMegabytes(maximumMemorySize)); // will be updated when we set the capacity
+      metrics_->SetFloatValue(capacityCurrentSizeMegabytesName_, BytesToFloatMegabytes(currentMemorySize));
       metrics_->SetIntegerValue(capacityCountName_, currentReservationCount);
-      metrics_->SetFloatValue(capacityMaxUsageSinceStartMegabytesName_, static_cast<float>(maxMemoryUsageSinceStart_) / static_cast<float>(MEGABYTE));
+      metrics_->SetFloatValue(capacityMaxUsageSinceStartMegabytesName_, BytesToFloatMegabytes(maxMemoryUsageSinceStart_));
     }
 
 
--- a/OrthancFramework/Sources/DataSource/DataSourceReader.cpp	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DataSourceReader.cpp	Fri Jun 12 11:34:03 2026 +0200
@@ -94,7 +94,7 @@
       size_t count, size;
       cache.GetStatistics(count, size);
 
-      metrics_->SetFloatValue(cacheSizeMegabytesName_, static_cast<float>(size) / static_cast<float>(MEGABYTE));
+      metrics_->SetFloatValue(cacheSizeMegabytesName_, BytesToFloatMegabytes(size));
       metrics_->SetIntegerValue(cacheCountName_, count);
     }
   }
@@ -313,6 +313,20 @@
                                                                                              metricsConfiguration_.capacityMaxUsageSinceStartMegabytesName_));
   }
 
+  uint64_t DataSourceReader::GetCapacity() const
+  {
+    uint64_t maximumMemory, currentMemory;
+    unsigned int currentReservations;
+
+    GetStatistics(maximumMemory, currentMemory, currentReservations);
+    
+    return maximumMemory;
+  }
+
+  unsigned int DataSourceReader::GetThreadsCount() const
+  {
+    return executor_->GetCountThreads();
+  }
 
   boost::shared_ptr<DataSourceAnswer> DataSourceReader::Submit(DataSourceRequest* request /* takes ownership */)
   {
@@ -349,9 +363,9 @@
 
   void DataSourceReader::GetStatistics(uint64_t& tasksMaximumMemory,
                                        uint64_t& tasksCurrentMemory,
-                                       unsigned int& tasksReservations)
+                                       unsigned int& tasksReservations) const
   {
-    {
+    { // TODO-Streaming - Question AM: why this copy ?
       boost::shared_ptr<Internals::DataSourceMemoryBudget> budgetCopy(budget_);
       budgetCopy->GetStatistics(tasksMaximumMemory, tasksCurrentMemory, tasksReservations);
     }
--- a/OrthancFramework/Sources/DataSource/DataSourceReader.h	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DataSourceReader.h	Fri Jun 12 11:34:03 2026 +0200
@@ -108,6 +108,9 @@
      **/
     void SetCapacity(uint64_t maximumMemory);
 
+    uint64_t GetCapacity() const;
+
+    unsigned int GetThreadsCount() const;
     /**
      * Request the data source to load a set of items. The values will
      * be read in parallel by a thread pool (cf. "executor_") and will
@@ -127,7 +130,7 @@
 
     void GetStatistics(uint64_t& tasksMaximumMemory,
                        uint64_t& tasksCurrentMemory,
-                       unsigned int& tasksReservations);
+                       unsigned int& tasksReservations) const;
 
     size_t GetCacheCapacity() const;
 
--- a/OrthancFramework/Sources/MultiThreading/IExecutorService.h	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancFramework/Sources/MultiThreading/IExecutorService.h	Fri Jun 12 11:34:03 2026 +0200
@@ -43,5 +43,7 @@
     virtual void Submit(IRunnable* runnable /* takes ownership */) = 0;
 
     virtual void Stop() = 0;
+
+    virtual unsigned int GetCountThreads() const = 0;
   };
 }
--- a/OrthancFramework/Sources/MultiThreading/ThreadPool.cpp	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancFramework/Sources/MultiThreading/ThreadPool.cpp	Fri Jun 12 11:34:03 2026 +0200
@@ -339,7 +339,7 @@
   }
 
 
-  unsigned int ThreadPool::GetCountThreads()
+  unsigned int ThreadPool::GetCountThreads() const
   {
     boost::mutex::scoped_lock lock(mutex_);
     return countThreads_;
--- a/OrthancFramework/Sources/MultiThreading/ThreadPool.h	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancFramework/Sources/MultiThreading/ThreadPool.h	Fri Jun 12 11:34:03 2026 +0200
@@ -49,7 +49,7 @@
 
     SharedMessageQueue                    queue_;
     std::unique_ptr<boost::thread_group>  workers_;
-    boost::mutex                          mutex_;
+    mutable boost::mutex                  mutex_;
     std::string                           loggingThreadName_;
     unsigned int                          countThreads_;
     State                                 state_;
@@ -70,7 +70,7 @@
 
     void SetCountThreads(unsigned int count);
 
-    unsigned int GetCountThreads();
+    virtual unsigned int GetCountThreads() const ORTHANC_OVERRIDE;
 
     void SetDequeueTimeout(unsigned int milliseconds);
 
--- a/OrthancServer/Sources/OrthancConfiguration.h	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancServer/Sources/OrthancConfiguration.h	Fri Jun 12 11:34:03 2026 +0200
@@ -41,7 +41,6 @@
 #define ORTHANC_CONFIG_DICOM_AET "DicomAet"
 #define ORTHANC_CONFIG_DICOM_PORT "DicomPort"
 #define ORTHANC_CONFIG_HTTP_PORT "HttpPort"
-#define ORTHANC_CONFIG_MAXIMUM_STORAGE_CACHE_SIZE "MaximumStorageCacheSize"
 #define ORTHANC_CONFIG_MAXIMUM_STORAGE_SIZE "MaximumStorageSize"
 #define ORTHANC_CONFIG_MAXIMUM_STORAGE_MODE "MaximumStorageMode"
 #define ORTHANC_CONFIG_MAXIMUM_PATIENT_COUNT "MaximumPatientCount"
@@ -55,6 +54,19 @@
 #define ORTHANC_CONFIG_PATIENT_LEVEL_ENABLED "PatientLevelEnabled"
 #define ORTHANC_CONFIG_READ_ONLY "ReadOnly"
 
+#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_DICOM_PARSER_SOURCE_THREADS "DicomParserThreads"
+#define ORTHANC_CONFIG_DICOM_PARSER_MEMORY_CAPACITY "DicomParserMemoryCapacity"
+#define ORTHANC_CONFIG_DICOM_PARSER_CACHE_SIZE "DicomParserCacheSize"
+#define ORTHANC_CONFIG_TRANSCODER_THREADS "TranscoderThreads"
+#define ORTHANC_CONFIG_TRANSCODER_MEMORY_CAPACITY "TranscoderMemoryCapacity"
+#define ORTHANC_CONFIG_TRANSCODER_CACHE_SIZE "TranscoderCacheSize"
+#define ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_THREADS "SequentialDicomReaderThreads"
+#define ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_WINDOW_SIZE "SequentialDicomReaderWindowSize"
+#define ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_WINDOW_CAPACITY "SequentialDicomReaderWindowCapacity"
+
 
 namespace Orthanc
 {
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Fri Jun 12 11:34:03 2026 +0200
@@ -169,7 +169,6 @@
       result[ORTHANC_CONFIG_DICOM_PORT] = lock.GetConfiguration().GetDicomPort();
       result[ORTHANC_CONFIG_HTTP_PORT] = lock.GetConfiguration().GetHttpPort();
       result[ORTHANC_CONFIG_CHECK_REVISIONS] = lock.GetConfiguration().HasCheckRevisions();  // New in Orthanc 1.9.2
-      result[ORTHANC_CONFIG_MAXIMUM_STORAGE_CACHE_SIZE] = lock.GetConfiguration().GetMaximumStorageCacheSize(); // New in Orthanc 1.12.12
       result[ORTHANC_CONFIG_STORE_MD5_FOR_ATTACHMENTS] = lock.GetConfiguration().HasStoreMD5ForAttachments(); // New in Orthanc 1.12.12
       result[ORTHANC_CONFIG_STORAGE_COMPRESSION] = lock.GetConfiguration().HasStorageCompression(); // New in Orthanc 1.11.0
       result[ORTHANC_CONFIG_INGEST_TRANSCODING] = lock.GetConfiguration().GetIngestTranscoding(); // New in Orthanc 1.11.0
@@ -180,6 +179,26 @@
       result[ORTHANC_CONFIG_DICOM_DEFAULT_RETRIEVE_METHOD] = lock.GetConfiguration().GetDicomDefaultRetrieveMethod();
     }
 
+    {
+      uint64_t storageMemoryCapacityMb, transcoderMemoryCapacityMb, dicomParserMemoryCapacityMb;
+      size_t storageMemoryCacheMb, transcoderMemoryCacheMb, dicomParserMemoryCacheMb;
+      unsigned int storageReaderThreadsCount, transcoderReaderThreadsCount, dicomParserThreadsCount;
+
+      context.GetDataSourcesConfigurations(storageMemoryCapacityMb, storageMemoryCacheMb, storageReaderThreadsCount,
+                                          transcoderMemoryCapacityMb, transcoderMemoryCacheMb, transcoderReaderThreadsCount,
+                                          dicomParserMemoryCapacityMb, dicomParserMemoryCacheMb, dicomParserThreadsCount);
+
+      result[ORTHANC_CONFIG_STORAGE_MEMORY_CAPACITY] = BytesToMegabytes(storageMemoryCapacityMb);
+      result[ORTHANC_CONFIG_MAXIMUM_STORAGE_CACHE_SIZE] = BytesToMegabytes(storageMemoryCacheMb);
+      result[ORTHANC_CONFIG_STORAGE_LOADER_THREADS] = storageReaderThreadsCount;
+      result[ORTHANC_CONFIG_TRANSCODER_MEMORY_CAPACITY] = BytesToMegabytes(transcoderMemoryCapacityMb);
+      result[ORTHANC_CONFIG_TRANSCODER_CACHE_SIZE] = BytesToMegabytes(transcoderMemoryCacheMb);
+      result[ORTHANC_CONFIG_TRANSCODER_THREADS] = transcoderReaderThreadsCount;
+      result[ORTHANC_CONFIG_DICOM_PARSER_MEMORY_CAPACITY] = BytesToMegabytes(dicomParserMemoryCapacityMb);
+      result[ORTHANC_CONFIG_DICOM_PARSER_CACHE_SIZE] = BytesToMegabytes(dicomParserMemoryCacheMb);
+      result[ORTHANC_CONFIG_DICOM_PARSER_SOURCE_THREADS] = dicomParserThreadsCount;
+    }
+
     result[ORTHANC_CONFIG_OVERWRITE_INSTANCES] = context.IsOverwriteInstances(); // New in Orthanc 1.11.0
     result[OVERWRITE_INSTANCES_MODE] = EnumerationToString(context.GetOverwriteInstances()); // New in Orthanc 1.12.12
     result[ORTHANC_CONFIG_PATIENT_LEVEL_ENABLED] = context.IsPatientLevelEnabled(); // New in Orthanc 1.12.11
--- a/OrthancServer/Sources/ServerContext.cpp	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Fri Jun 12 11:34:03 2026 +0200
@@ -87,15 +87,15 @@
 static const char* const METRICS_STORAGE_AREA_MEMORY_COUNT = "orthanc_storage_memory_count";
 static const char* const METRICS_STORAGE_THREAD_POOL_AVAILABLE_THREADS = "orthanc_storage_available_threads";
 
-static const char* const METRICS_DICOM_SOURCE_CACHE_COUNT = "orthanc_dicom_source_cache_count";
-static const char* const METRICS_DICOM_SOURCE_CACHE_HIT_COUNT = "orthanc_dicom_source_cache_hit_count";
-static const char* const METRICS_DICOM_SOURCE_CACHE_MISS_COUNT = "orthanc_dicom_source_cache_miss_count";
-static const char* const METRICS_DICOM_SOURCE_CACHE_SIZE_MB = "orthanc_dicom_source_cache_size_mb";
-static const char* const METRICS_DICOM_SOURCE_MEMORY_CAPACITY_MB = "orthanc_dicom_source_memory_capacity_mb";
-static const char* const METRICS_DICOM_SOURCE_MEMORY_USAGE_MB = "orthanc_dicom_source_memory_usage_mb";
-static const char* const METRICS_DICOM_SOURCE_MEMORY_MAX_USAGE_MB = "orthanc_dicom_source_memory_max_usage_mb";
-static const char* const METRICS_DICOM_SOURCE_MEMORY_COUNT = "orthanc_dicom_source_memory_count";
-static const char* const METRICS_DICOM_SOURCE_THREAD_POOL_AVAILABLE_THREADS = "orthanc_dicom_source_available_threads";
+static const char* const METRICS_DICOM_PARSER_CACHE_COUNT = "orthanc_dicom_parser_cache_count";
+static const char* const METRICS_DICOM_PARSER_CACHE_HIT_COUNT = "orthanc_dicom_parser_cache_hit_count";
+static const char* const METRICS_DICOM_PARSER_CACHE_MISS_COUNT = "orthanc_dicom_parser_cache_miss_count";
+static const char* const METRICS_DICOM_PARSER_CACHE_SIZE_MB = "orthanc_dicom_parser_cache_size_mb";
+static const char* const METRICS_DICOM_PARSER_MEMORY_CAPACITY_MB = "orthanc_dicom_parser_memory_capacity_mb";
+static const char* const METRICS_DICOM_PARSER_MEMORY_USAGE_MB = "orthanc_dicom_parser_memory_usage_mb";
+static const char* const METRICS_DICOM_PARSER_MEMORY_MAX_USAGE_MB = "orthanc_dicom_parser_memory_max_usage_mb";
+static const char* const METRICS_DICOM_PARSER_MEMORY_COUNT = "orthanc_dicom_parser_memory_count";
+static const char* const METRICS_DICOM_PARSER_THREAD_POOL_AVAILABLE_THREADS = "orthanc_dicom_parser_available_threads";
 
 static const char* const METRICS_TRANSCODER_CACHE_COUNT = "orthanc_transcoder_cache_count";
 static const char* const METRICS_TRANSCODER_CACHE_HIT_COUNT = "orthanc_transcoder_cache_hit_count";
@@ -109,8 +109,7 @@
 
 static const char* const METRICS_SEQ_READER_THREAD_POOL_AVAILABLE_THREADS = "orthanc_seq_reader_available_threads";
 
-static const char* const CONFIG_STORAGE_LOADER_THREADS = "StorageLoaderThreads";
-static const char* const CONFIG_STORAGE_MEMORY_CAPACITY = "StorageMemoryCapacity";
+
 
 
 /**
@@ -495,6 +494,23 @@
   }
 
 
+  static void GetMemoryConfiguration(unsigned int& resultMb, 
+                                     OrthancConfiguration::ReaderLock& lock,
+                                     const char* configurationName,
+                                     unsigned int defaultValueMb)
+  {
+    if (!lock.GetConfiguration().LookupUnsignedIntegerParameter(resultMb, configurationName))
+    {
+      resultMb = defaultValueMb;
+      LOG(WARNING) << "====> '" << configurationName << "' is not defined in your configuration, setting it to " << resultMb << ".  Depending on the available memory on the system, you might want to adapt this value.";
+    }
+    else
+    {
+      LOG(WARNING) << "'" << configurationName << "' is set to " << resultMb;
+    }
+  }
+
+
   ServerContext::ServerContext(IDatabaseWrapper& database,
                                IPluginStorageArea& area,
                                ServerTranscoder* transcoder /* takes ownership */,
@@ -678,44 +694,54 @@
       LOG(INFO) << "Your platform does not support malloc_trim(), not starting the memory trimming thread";
 #endif
 
-      unsigned int storageLoaderThreads;
-      size_t storageCacheSizeMb;
-      unsigned int storageMemoryCapacityMb;
-
+      unsigned int storageLoaderThreads, transcoderThreads, dicomParserThreads;
+      unsigned int storageCacheSizeMb, transcoderCacheSizeMb, dicomParserCacheSizeMb;
+      unsigned int storageMemoryCapacityMb, transcoderMemoryCapacityMb, dicomParserMemoryCapacityMb;
+      unsigned int sequentialReaderThreads, sequentialReaderWindowSize, sequentialReaderWindowCapacityMb;
+      
       {
         OrthancConfiguration::ReaderLock lock;
         unsigned int loaderThreads = lock.GetConfiguration().GetLoaderThreads();
         unsigned int concurrentJobs = lock.GetConfiguration().GetConcurrentJobs();
         storageCacheSizeMb = lock.GetConfiguration().GetMaximumStorageCacheSize();
 
-        if (!lock.GetConfiguration().LookupUnsignedIntegerParameter(storageLoaderThreads, CONFIG_STORAGE_LOADER_THREADS))
+        if (!lock.GetConfiguration().LookupUnsignedIntegerParameter(storageLoaderThreads, ORTHANC_CONFIG_STORAGE_LOADER_THREADS))
         {
           storageLoaderThreads = loaderThreads * concurrentJobs;
           if (storageLoaderThreads < 4)
           {
             storageLoaderThreads = 4;
-            LOG(WARNING) << "'" << CONFIG_STORAGE_LOADER_THREADS << "' is not defined in your configuration, setting it to " << storageLoaderThreads;
+            LOG(WARNING) << "'" << ORTHANC_CONFIG_STORAGE_LOADER_THREADS << "' is not defined in your configuration, setting it to " << storageLoaderThreads;
           }
           else
           {
             storageLoaderThreads = std::min(50u, storageLoaderThreads);
-            LOG(WARNING) << "'" << CONFIG_STORAGE_LOADER_THREADS << "' is not defined in your configuration, setting it to " << storageLoaderThreads << ", based on 'ConcurrentJobs' and the old 'LoaderThreads' configurations.";
+            LOG(WARNING) << "'" << ORTHANC_CONFIG_STORAGE_LOADER_THREADS << "' is not defined in your configuration, setting it to " << storageLoaderThreads << ", based on 'ConcurrentJobs' and the old 'LoaderThreads' configurations.";
           }
         }
         else
         {
-          LOG(WARNING) << "'" << CONFIG_STORAGE_LOADER_THREADS << "' is set to " << storageLoaderThreads;
+          LOG(WARNING) << "'" << ORTHANC_CONFIG_STORAGE_LOADER_THREADS << "' is set to " << storageLoaderThreads;
         }
 
-        if (!lock.GetConfiguration().LookupUnsignedIntegerParameter(storageMemoryCapacityMb, CONFIG_STORAGE_MEMORY_CAPACITY))
-        {
-          storageMemoryCapacityMb = 256;
-          LOG(WARNING) << "'" << CONFIG_STORAGE_MEMORY_CAPACITY << "' is not defined in your configuration, setting it to " << storageMemoryCapacityMb << ".  Depending on the available memory on the system, you might want to adapt this value.";
-        }
-        else
-        {
-          LOG(WARNING) << "'" << CONFIG_STORAGE_MEMORY_CAPACITY << "' is set to " << storageMemoryCapacityMb;
-        }
+        transcoderThreads = lock.GetConfiguration().GetUnsignedIntegerParameter(ORTHANC_CONFIG_TRANSCODER_THREADS, 4);
+        LOG(WARNING) << "'" << ORTHANC_CONFIG_TRANSCODER_THREADS << "' is set to " << transcoderThreads;
+
+        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;
+
+        GetMemoryConfiguration(storageMemoryCapacityMb, lock, ORTHANC_CONFIG_STORAGE_MEMORY_CAPACITY, 512);
+        GetMemoryConfiguration(dicomParserMemoryCapacityMb, lock, ORTHANC_CONFIG_DICOM_PARSER_MEMORY_CAPACITY, 256);
+        GetMemoryConfiguration(dicomParserCacheSizeMb, lock, ORTHANC_CONFIG_DICOM_PARSER_CACHE_SIZE, 256);
+        GetMemoryConfiguration(transcoderMemoryCapacityMb, lock, ORTHANC_CONFIG_TRANSCODER_MEMORY_CAPACITY, 256);
+        GetMemoryConfiguration(transcoderCacheSizeMb, lock, ORTHANC_CONFIG_TRANSCODER_CACHE_SIZE, 256);
+        GetMemoryConfiguration(sequentialReaderWindowCapacityMb, lock, ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_WINDOW_CAPACITY, 64);
+
+        sequentialReaderWindowSize = lock.GetConfiguration().GetUnsignedIntegerParameter(ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_WINDOW_SIZE, 4);
+        LOG(WARNING) << "'" << ORTHANC_CONFIG_SEQUENTIAL_DICOM_READER_WINDOW_SIZE << "' is set to " << sequentialReaderWindowSize;
       }
 
       // For streaming
@@ -744,40 +770,37 @@
                                                  METRICS_STORAGE_AREA_MEMORY_MAX_USAGE_MB));
 
         storageAreaReader_->SetCapacity(storageMemoryCapacityMb * MEGABYTE);
-
-        storageAreaReader_->CreateCache(storageCacheSizeMb * GIGABYTE);
+        storageAreaReader_->CreateCache(storageCacheSizeMb * MEGABYTE);
       }
 
       {
         boost::shared_ptr<ThreadPool> pool(new ThreadPool);
-        pool->SetCountThreads(2);  // TODO-Streaming - Parameter
+        pool->SetCountThreads(dicomParserThreads);
         pool->SetLoggingThreadName("DICOM-SRC");
         pool->SetDequeueTimeout(100);
-        pool->SetMetricsConfiguration(*metricsRegistry_, METRICS_DICOM_SOURCE_THREAD_POOL_AVAILABLE_THREADS);
+        pool->SetMetricsConfiguration(*metricsRegistry_, METRICS_DICOM_PARSER_THREAD_POOL_AVAILABLE_THREADS);
         pool->Start();
 
         dicomReader_.reset(new DataSourceReader(pool, new DicomDataSource(storageAreaReader_)));
         dicomReader_->SetMetricsConfiguration(
           DataSourceReader::MetricsConfiguration(metricsRegistry_,
-                                                 METRICS_DICOM_SOURCE_CACHE_SIZE_MB,
-                                                 METRICS_DICOM_SOURCE_CACHE_COUNT,
-                                                 METRICS_DICOM_SOURCE_CACHE_HIT_COUNT,
-                                                 METRICS_DICOM_SOURCE_CACHE_MISS_COUNT,
-                                                 METRICS_DICOM_SOURCE_MEMORY_CAPACITY_MB,
-                                                 METRICS_DICOM_SOURCE_MEMORY_USAGE_MB,
-                                                 METRICS_DICOM_SOURCE_MEMORY_COUNT,
-                                                 METRICS_DICOM_SOURCE_MEMORY_MAX_USAGE_MB));
+                                                 METRICS_DICOM_PARSER_CACHE_SIZE_MB,
+                                                 METRICS_DICOM_PARSER_CACHE_COUNT,
+                                                 METRICS_DICOM_PARSER_CACHE_HIT_COUNT,
+                                                 METRICS_DICOM_PARSER_CACHE_MISS_COUNT,
+                                                 METRICS_DICOM_PARSER_MEMORY_CAPACITY_MB,
+                                                 METRICS_DICOM_PARSER_MEMORY_USAGE_MB,
+                                                 METRICS_DICOM_PARSER_MEMORY_COUNT,
+                                                 METRICS_DICOM_PARSER_MEMORY_MAX_USAGE_MB));
 
-        //dicomReader_->SetCapacity(1);  // To test on highest pressure
-        dicomReader_->SetCapacity(256 * MEGABYTE); // TODO-Streaming - Parameter
-
-        dicomReader_->CreateCache(256 * MEGABYTE); // TODO-Streaming - Parameter
+        dicomReader_->SetCapacity(dicomParserMemoryCapacityMb * MEGABYTE);
+        dicomReader_->CreateCache(dicomParserCacheSizeMb * MEGABYTE);
       }
 
       if (transcoder_.get() != NULL)
       {
         boost::shared_ptr<ThreadPool> pool(new ThreadPool);
-        pool->SetCountThreads(2);  // TODO-Streaming - Parameter
+        pool->SetCountThreads(transcoderThreads);
         pool->SetLoggingThreadName("TRANSCODER");
         pool->SetDequeueTimeout(100);
         pool->SetMetricsConfiguration(*metricsRegistry_, METRICS_TRANSCODER_THREAD_POOL_AVAILABLE_THREADS);
@@ -795,22 +818,20 @@
                                                  METRICS_TRANSCODER_MEMORY_COUNT,
                                                  METRICS_TRANSCODER_MEMORY_MAX_USAGE_MB));
 
-        //transcoderReader_->SetCapacity(1);  // To test on highest pressure
-        transcoderReader_->SetCapacity(256 * MEGABYTE); // TODO-Streaming - Parameter
-
-        transcoderReader_->CreateCache(256 * MEGABYTE); // TODO-Streaming - Parameter
+        transcoderReader_->SetCapacity(transcoderMemoryCapacityMb * MEGABYTE);
+        transcoderReader_->CreateCache(transcoderCacheSizeMb * MEGABYTE);
       }
 
       {
-        unsigned int loaderThreads;
+        // unsigned int loaderThreads;
 
-        {
-          OrthancConfiguration::ReaderLock lock;
-          loaderThreads = lock.GetConfiguration().GetLoaderThreads();
-        }
+        // {
+        //   OrthancConfiguration::ReaderLock lock;
+        //   loaderThreads = lock.GetConfiguration().GetLoaderThreads();
+        // }
 
         std::unique_ptr<ThreadPool> pool(new ThreadPool);
-        pool->SetCountThreads(loaderThreads);  // TODO-Streaming - Check - clarify the difference between SequentialLoader and DataSourceReader
+        pool->SetCountThreads(sequentialReaderThreads);  // TODO-Streaming - Check - clarify the difference between SequentialLoader and DataSourceReader
         pool->SetLoggingThreadName("SEQ-READER");
         pool->SetDequeueTimeout(100);
         pool->SetMetricsConfiguration(*metricsRegistry_, METRICS_SEQ_READER_THREAD_POOL_AVAILABLE_THREADS);
@@ -819,8 +840,8 @@
         boost::shared_ptr<IExecutorService> executor(pool.release());
         dicomSequentialReaderFactory_.reset(new DicomSequentialReader::Factory(
                                               executor, storageAreaReader_, dicomReader_, transcoderReader_,
-                                              4 /* TODO-Streaming: Parameter */,
-                                              0  /* TODO-Streaming: Parameter */));
+                                              sequentialReaderWindowSize,
+                                              sequentialReaderWindowCapacityMb * MEGABYTE));
       }
     }
     catch (OrthancException&)
@@ -2388,4 +2409,25 @@
   {
     return *dicomSequentialReaderFactory_;
   }
+
+  void ServerContext::GetDataSourcesConfigurations(uint64_t& storageMemoryCapacityMb,
+                                                   size_t& storageMemoryCacheMb,
+                                                   unsigned int& storageReaderThreadsCount,
+                                                   uint64_t& transcoderMemoryCapacityMb,
+                                                   size_t& transcoderMemoryCacheMb,
+                                                   unsigned int& transcoderReaderThreadsCount,
+                                                   uint64_t& dicomParserMemoryCapacityMb,
+                                                   size_t& dicomParserMemoryCacheMb,
+                                                   unsigned int& dicomParserThreadsCount)
+  {
+    storageMemoryCapacityMb = storageAreaReader_->GetCapacity();
+    storageMemoryCacheMb = storageAreaReader_->GetCacheCapacity();
+    storageReaderThreadsCount = storageAreaReader_->GetThreadsCount();
+    transcoderMemoryCapacityMb = transcoderReader_->GetCapacity();
+    transcoderMemoryCacheMb = transcoderReader_->GetCacheCapacity();
+    transcoderReaderThreadsCount = transcoderReader_->GetThreadsCount();
+    dicomParserMemoryCapacityMb = dicomReader_->GetCapacity();
+    dicomParserMemoryCacheMb = dicomReader_->GetCacheCapacity();
+    dicomParserThreadsCount = dicomReader_->GetThreadsCount();
+  }
 }
--- a/OrthancServer/Sources/ServerContext.h	Thu Jun 11 10:04:31 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.h	Fri Jun 12 11:34:03 2026 +0200
@@ -611,5 +611,15 @@
     const boost::shared_ptr<ServerTranscoder>& GetTranscoder() const;
 
     DicomSequentialReader::Factory& GetDicomSequentialReaderFactory();
+
+    void GetDataSourcesConfigurations(uint64_t& storageMemoryCapacityMb,
+                                      size_t& storageMemoryCacheMb,
+                                      unsigned int& storageReaderThreadsCount,
+                                      uint64_t& transcoderMemoryCapacityMb,
+                                      size_t& transcoderMemoryCacheMb,
+                                      unsigned int& transcoderReaderThreadsCount,
+                                      uint64_t& dicomParserMemoryCapacityMb,
+                                      size_t& dicomParserMemoryCacheMb,
+                                      unsigned int& dicomParserThreadsCount);
   };
 }