# HG changeset patch # User Alain Mazy # Date 1687959014 -7200 # Node ID 99c404a35d6a2930bdb3ed5c5de2537056c60609 # Parent 39b7ccaa6dfc98db9eac9f2a00de8f5a8641632c added 'MetadataWorkerThreadsCount' configuration diff -r 39b7ccaa6dfc -r 99c404a35d6a NEWS --- a/NEWS Wed Jun 28 15:10:15 2023 +0200 +++ b/NEWS Wed Jun 28 15:30:14 2023 +0200 @@ -1,9 +1,12 @@ Pending changes in the mainline =============================== -* Speeded up instance metadata retrieval using OrthancPluginLoadDicomInstance() from SDK 1.12.1 +* speed improvements: + - Speeded up instance metadata retrieval using OrthancPluginLoadDicomInstance() from SDK 1.12.1 + - Using multiple threads to compute the studies/../series/../metadata route when in "Full" mode. + New configuration: "MetadataWorkerThreadsCount" defaults to 4 + - Small speed-up the studies/../series/../metadata route when in "MainDicomTags" mode. * Support "X-Forwarded-Host" and "X-Forwarded-Proto" headers to compute BulkDataURI. -* Small speed-up the studies/../series/../metadata route when in "MainDicomTags" mode. * Fix issue #216 (Requests fail due to bad parsing of the accept HTTP header (semi-colons)) diff -r 39b7ccaa6dfc -r 99c404a35d6a Plugin/Configuration.cpp --- a/Plugin/Configuration.cpp Wed Jun 28 15:10:15 2023 +0200 +++ b/Plugin/Configuration.cpp Wed Jun 28 15:30:14 2023 +0200 @@ -671,6 +671,11 @@ } } + unsigned int GetMetadataWorkerThreadsCount() + { + return GetUnsignedIntegerValue("MetadataWorkerThreadsCount", 4); + } + MetadataMode GetMetadataMode(Orthanc::ResourceType level) { diff -r 39b7ccaa6dfc -r 99c404a35d6a Plugin/Configuration.h --- a/Plugin/Configuration.h Wed Jun 28 15:10:15 2023 +0200 +++ b/Plugin/Configuration.h Wed Jun 28 15:30:14 2023 +0200 @@ -137,5 +137,7 @@ void LoadDicomWebServers(); void SaveDicomWebServers(); + + unsigned int GetMetadataWorkerThreadsCount(); } } diff -r 39b7ccaa6dfc -r 99c404a35d6a Plugin/WadoRs.cpp --- a/Plugin/WadoRs.cpp Wed Jun 28 15:10:15 2023 +0200 +++ b/Plugin/WadoRs.cpp Wed Jun 28 15:30:14 2023 +0200 @@ -1292,7 +1292,7 @@ std::list instancesIds; std::string seriesDicomUid; - size_t threadCount = 4; + unsigned int workersCount = OrthancPlugins::Configuration::GetMetadataWorkerThreadsCount(); bool oneLargeQuery = false; // we keep this code here for future use once we'll have optimized Orthanc API /series/.../instances?full to minimize the SQL queries // right now, it is faster to call /instances/..?full in each worker but, later, it should be more efficient with a large SQL query in Orthanc @@ -1305,7 +1305,7 @@ GetChildrenIdentifiers(instancesIds, seriesDicomUid, Orthanc::ResourceType_Series, seriesOrthancId); } - if (threadCount > 1) + if (workersCount > 1) { // span a few workers to get the tags from the core and serialize them Orthanc::SharedMessageQueue instancesQueue; @@ -1313,7 +1313,7 @@ boost::mutex writerMutex; std::vector > instancesWorkersData; - for (size_t t = 0; t < threadCount; t++) + for (unsigned int t = 0; t < workersCount; t++) { InstanceWorkerData* threadData = new InstanceWorkerData(boost::lexical_cast(t), &instancesQueue, wadoBase); instancesWorkersData.push_back(boost::shared_ptr(threadData));