# HG changeset patch # User Alain Mazy # Date 1633007015 -7200 # Node ID fc2ba1ce6538d0a4eb173ef0cd57213ec6f77074 # Parent 9754d5f2f38af5dfd97980c383eb9651abfa6f9c new configuration 'DicomThreadsCount' diff -r 9754d5f2f38a -r fc2ba1ce6538 NEWS --- a/NEWS Tue Sep 14 14:51:12 2021 +0200 +++ b/NEWS Thu Sep 30 15:03:35 2021 +0200 @@ -3,6 +3,9 @@ * Fix handling of option "DeidentifyLogs", notably for tags (0010,0010) and (0010,0020) +* New configuration options: + - "DicomThreadsCount" to set the number of threads in the embedded DICOM server + Version 1.9.7 (2021-08-31) ========================== diff -r 9754d5f2f38a -r fc2ba1ce6538 OrthancFramework/Sources/DicomNetworking/DicomServer.cpp --- a/OrthancFramework/Sources/DicomNetworking/DicomServer.cpp Tue Sep 14 14:51:12 2021 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/DicomServer.cpp Thu Sep 30 15:03:35 2021 +0200 @@ -424,7 +424,10 @@ #endif continue_ = true; - pimpl_->workers_.reset(new RunnableWorkersPool(4)); // Use 4 workers - TODO as a parameter? + + CLOG(INFO, DICOM) << "The embedded DICOM server will use " << threadsCount_ << " threads"; + + pimpl_->workers_.reset(new RunnableWorkersPool(threadsCount_)); pimpl_->thread_ = boost::thread(ServerThread, this, maximumPduLength_, useDicomTls_); } @@ -588,4 +591,16 @@ { return remoteCertificateRequired_; } + + void DicomServer::SetThreadsCount(unsigned int threads) + { + if (threads == 0) + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + + Stop(); + threadsCount_ = threads; + } + } diff -r 9754d5f2f38a -r fc2ba1ce6538 OrthancFramework/Sources/DicomNetworking/DicomServer.h --- a/OrthancFramework/Sources/DicomNetworking/DicomServer.h Tue Sep 14 14:51:12 2021 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/DicomServer.h Thu Sep 30 15:03:35 2021 +0200 @@ -72,6 +72,7 @@ uint16_t port_; bool continue_; uint32_t associationTimeout_; + unsigned int threadsCount_; IRemoteModalities* modalities_; IFindRequestHandlerFactory* findRequestHandlerFactory_; IMoveRequestHandlerFactory* moveRequestHandlerFactory_; @@ -89,6 +90,7 @@ unsigned int maximumPduLength_; bool remoteCertificateRequired_; // New in 1.9.3 + static void ServerThread(DicomServer* server, unsigned int maximumPduLength, bool useDicomTls); @@ -163,5 +165,8 @@ void SetRemoteCertificateRequired(bool required); bool IsRemoteCertificateRequired() const; + + void SetThreadsCount(unsigned int threadsCount); + }; } diff -r 9754d5f2f38a -r fc2ba1ce6538 OrthancServer/Resources/Configuration.json --- a/OrthancServer/Resources/Configuration.json Tue Sep 14 14:51:12 2021 +0200 +++ b/OrthancServer/Resources/Configuration.json Thu Sep 30 15:03:35 2021 +0200 @@ -418,7 +418,12 @@ // (1.2.840.10008.1.2.1). This parameter can possibly correspond to // a compressed transfer syntax. (new in Orthanc 1.9.0) "DicomScuPreferredTransferSyntax" : "1.2.840.10008.1.2.1", - + + // Number of threads that are used by the embedded DICOM server. + // This defines the number of concurrent DICOM operations that can + // be run. (new in Orthanc 1.9.8) + "DicomThreadsCount" : 4, + // The list of the known Orthanc peers. This option is ignored if // "OrthancPeersInDatabase" is set to "true", in which case you must // use the REST API to define Orthanc peers. diff -r 9754d5f2f38a -r fc2ba1ce6538 OrthancServer/Sources/main.cpp --- a/OrthancServer/Sources/main.cpp Tue Sep 14 14:51:12 2021 +0200 +++ b/OrthancServer/Sources/main.cpp Thu Sep 30 15:03:35 2021 +0200 @@ -1210,6 +1210,7 @@ dicomServer.SetCalledApplicationEntityTitleCheck(lock.GetConfiguration().GetBooleanParameter("DicomCheckCalledAet", false)); dicomServer.SetAssociationTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomScpTimeout", 30)); dicomServer.SetPortNumber(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomPort", 4242)); + dicomServer.SetThreadsCount(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomThreadsCount", 4)); dicomServer.SetApplicationEntityTitle(lock.GetConfiguration().GetOrthancAET()); // Configuration of DICOM TLS for Orthanc SCP (since Orthanc 1.9.0)