diff --git a/Documentation/Books/Manual/Administration/Configuration/GeneralArangod.md b/Documentation/Books/Manual/Administration/Configuration/GeneralArangod.md index 50631a2c77..b35a5fe702 100644 --- a/Documentation/Books/Manual/Administration/Configuration/GeneralArangod.md +++ b/Documentation/Books/Manual/Administration/Configuration/GeneralArangod.md @@ -302,10 +302,24 @@ The default value for this option is *false*. ### Server threads -`--server.threads number` +`--server.minimal-threads number` + +`--server.maximal-threads number` Specifies the *number* of threads that are spawned to handle requests. +The actual number of request processing threads is adjusted dynamically at runtime +and will float between `--server.minimal-threads` and `--server.maximal-threads`. + +`--server.minimal-threads` determines the minimum number of request processing +threads the server will start and that will always be kept around. The default +value is *2*. + +`--server.maximal-threads` determines the maximum number of request processing +threads the server is allowed to start for request handling. If that number of +threads is already running, arangod will not start further threads for request +handling. The default value is + ### Toggling server statistics `--server.statistics value` diff --git a/Documentation/Books/Manual/ReleaseNotes/UpgradingChanges34.md b/Documentation/Books/Manual/ReleaseNotes/UpgradingChanges34.md index 8c57d66325..ffb5fbcd5c 100644 --- a/Documentation/Books/Manual/ReleaseNotes/UpgradingChanges34.md +++ b/Documentation/Books/Manual/ReleaseNotes/UpgradingChanges34.md @@ -55,17 +55,14 @@ be strictly bounded by configuration options. The number of server threads is now configured by the following startup options: -- `--server.threads`: determines the maximum number of request processing threads - the server will start for request handling. If that number of threads is already - running, arangod will not start further threads for request handling - `--server.minimal-threads`: determines the minimum number of request processing threads the server will start and always keep around +- `--server.maximal-threads`: determines the maximum number of request processing + threads the server will start for request handling. If that number of threads is + already running, arangod will not start further threads for request handling The actual number of request processing threads is adjusted dynamically at runtime -and will float between `--server.minimal-threads` and `--server.threads`. - -To avoid overloading servers, the value of `--server.threads` should not exceed the -server's number of hardware threads in ArangoDB 3.4. +and will float between `--server.minimal-threads` and `--server.maximal-threads`. HTTP REST API @@ -248,24 +245,17 @@ less V8 contexts than 3.3. Startup option changes ---------------------- -The arangod, the following startup options have changed: +For arangod, the following startup options have changed: -- the hidden option `--server.maximal-threads` is now obsolete. +- the number of server threads is now configured by the following startup options: - Setting the option will have no effect. - The number of server threads is now configured by the following startup options: - - - `--server.threads`: determines the maximum number of request processing threads - the server will start - `--server.minimal-threads`: determines the minimum number of request processing threads the server will start + - `--server.maximal-threads`: determines the maximum number of request processing + threads the server will start The actual number of request processing threads is adjusted dynamically at runtime - and will float between `--server.minimal-threads` and `--server.threads`. Thus the - value configured for `--server.threads` should not greatly exceed the server's number - of hardware threads. - -- the option `--server.maximal-queue-size` has been renamed to `--server.queue-size`. + and will float between `--server.minimal-threads` and `--server.maximal-threads`. - the default value for the existing startup option `--javascript.gc-interval` has been increased from every 1000 to every 2000 requests, and the default value @@ -286,6 +276,9 @@ The arangod, the following startup options have changed: As direct upgrades from ArangoDB 3.0 to 3.4 or from 3.1 to 3.4 are not supported, this option has been removed in 3.4. +- the startup option `--server.session-timeout` has been obsoleted. Setting this + option will not have any effect. + Permissions ----------- diff --git a/Documentation/DocuBlocks/serverThreads.md b/Documentation/DocuBlocks/serverThreads.md deleted file mode 100644 index 36fa651c46..0000000000 --- a/Documentation/DocuBlocks/serverThreads.md +++ /dev/null @@ -1,5 +0,0 @@ -@brief number of threads -`--server.threads number` - -Specifies the desired *number* of threads that are spawned to handle requests. - diff --git a/arangod/GeneralServer/AuthenticationFeature.cpp b/arangod/GeneralServer/AuthenticationFeature.cpp index 68c23ddf1c..eae816d4b1 100644 --- a/arangod/GeneralServer/AuthenticationFeature.cpp +++ b/arangod/GeneralServer/AuthenticationFeature.cpp @@ -84,7 +84,7 @@ void AuthenticationFeature::collectOptions( options->addOldOption("no-server", "server.rest-server"); options->addOption("--server.authentication", - "enable or disable authentication for ALL client requests", + "enable authentication for ALL client requests", new BooleanParameter(&_active)); options->addOption( @@ -94,7 +94,7 @@ void AuthenticationFeature::collectOptions( options->addOption( "--server.local-authentication", - "enable or disable authentication using the local user database", + "enable authentication using the local user database", new BooleanParameter(&_localAuthentication)); options->addOption( diff --git a/arangod/GeneralServer/GeneralServerFeature.cpp b/arangod/GeneralServer/GeneralServerFeature.cpp index e6b2fb6a2f..550fe2c545 100644 --- a/arangod/GeneralServer/GeneralServerFeature.cpp +++ b/arangod/GeneralServer/GeneralServerFeature.cpp @@ -147,7 +147,7 @@ void GeneralServerFeature::collectOptions( options->addSection("frontend", "Frontend options"); options->addOption("--frontend.proxy-request-check", - "enable or disable proxy request checking", + "enable proxy request checking", new BooleanParameter(&_proxyCheck)); options->addOption("--frontend.trusted-proxy", diff --git a/arangod/RestServer/ServerFeature.cpp b/arangod/RestServer/ServerFeature.cpp index 8735e139b2..f96d786fba 100644 --- a/arangod/RestServer/ServerFeature.cpp +++ b/arangod/RestServer/ServerFeature.cpp @@ -67,9 +67,9 @@ void ServerFeature::collectOptions(std::shared_ptr options) { options->addHiddenOption("--server.rest-server", "start a rest-server", new BooleanParameter(&_restServer)); - options->addOption("--server.session-timeout", - "timeout of web interface server sessions (in seconds)", - new DoubleParameter(&VocbaseContext::ServerSessionTtl)); + options->addObsoleteOption("--server.session-timeout", + "timeout of web interface server sessions (in seconds)", + true); options->addSection("javascript", "Configure the Javascript engine"); diff --git a/arangod/RestServer/VocbaseContext.cpp b/arangod/RestServer/VocbaseContext.cpp index 4aca977bca..b3df37be78 100644 --- a/arangod/RestServer/VocbaseContext.cpp +++ b/arangod/RestServer/VocbaseContext.cpp @@ -30,9 +30,6 @@ using namespace arangodb::rest; namespace arangodb { -double VocbaseContext::ServerSessionTtl = - 60.0 * 60.0 * 24 * 60; // 2 month session timeout - VocbaseContext::VocbaseContext( GeneralRequest& req, TRI_vocbase_t& vocbase, diff --git a/arangod/RestServer/VocbaseContext.h b/arangod/RestServer/VocbaseContext.h index 12ca91bd5c..2edfd59dae 100644 --- a/arangod/RestServer/VocbaseContext.h +++ b/arangod/RestServer/VocbaseContext.h @@ -39,8 +39,6 @@ namespace arangodb { /// @brief just also stores the context class VocbaseContext : public arangodb::ExecContext { public: - static double ServerSessionTtl; - TEST_VIRTUAL ~VocbaseContext(); static VocbaseContext* create(GeneralRequest& req, TRI_vocbase_t& vocbase); diff --git a/arangod/Scheduler/SchedulerFeature.cpp b/arangod/Scheduler/SchedulerFeature.cpp index c4e5f7d280..e5a1ad6c00 100644 --- a/arangod/Scheduler/SchedulerFeature.cpp +++ b/arangod/Scheduler/SchedulerFeature.cpp @@ -63,39 +63,38 @@ SchedulerFeature::~SchedulerFeature() {} void SchedulerFeature::collectOptions( std::shared_ptr options) { - options->addSection("scheduler", "Configure the I/O scheduler"); + options->addSection("server", "Server features"); - options->addOption("--server.threads", "number of threads", + // max / min number of threads + options->addOption("--server.maximal-threads", std::string("maximum number of request handling threads to run (0 = use system-specific default of ") + std::to_string(defaultNumberOfThreads()) + ")", new UInt64Parameter(&_nrMaximalThreads)); + + options->addHiddenOption("--server.minimal-threads", + "minimum number of request handling threads to run", + new UInt64Parameter(&_nrMinimalThreads)); + + options->addOption("--server.maximal-queue-size", "size of the priority 2 fifo", + new UInt64Parameter(&_fifo2Size)); options->addHiddenOption( - "--server.queue-size", + "--server.scheduler-queue-size", "number of simultaneously queued requests inside the scheduler", new UInt64Parameter(&_queueSize)); options->addHiddenOption("--server.prio1-size", "size of the priority 1 fifo", new UInt64Parameter(&_fifo1Size)); - options->addHiddenOption("--server.prio2-size", "size of the priority 2 fifo", - new UInt64Parameter(&_fifo2Size)); - - options->addHiddenOption("--server.minimal-threads", - "minimal number of threads", - new UInt64Parameter(&_nrMinimalThreads)); - // obsolete options - options->addObsoleteOption("--server.maximal-threads", - "maximal number of threads", true); + options->addObsoleteOption("--server.threads", "number of threads", true); // renamed options - options->addOldOption("scheduler.threads", "server.threads"); - options->addOldOption("server.maximal-queue-size", "server.queue-size"); + options->addOldOption("scheduler.threads", "server.maximal-threads"); } void SchedulerFeature::validateOptions( std::shared_ptr) { if (_nrMaximalThreads == 0) { - _nrMaximalThreads = TRI_numberProcessors(); + _nrMaximalThreads = defaultNumberOfThreads(); } if (_queueSize == 0) { @@ -117,10 +116,10 @@ void SchedulerFeature::start() { LOG_TOPIC(DEBUG, arangodb::Logger::THREADS) << "Detected number of processors: " << N; - if (_nrMaximalThreads > 2 * N) { + if (_nrMaximalThreads > 8 * N) { LOG_TOPIC(WARN, arangodb::Logger::THREADS) << "--server.threads (" << _nrMaximalThreads - << ") is more than twice the number of cores (" << N + << ") is more than eight times the number of cores (" << N << "), this might overload the server"; } @@ -210,6 +209,17 @@ void SchedulerFeature::stop() { } void SchedulerFeature::unprepare() { SCHEDULER = nullptr; } + +/// @brief return the default number of threads to use (upper bound) +size_t SchedulerFeature::defaultNumberOfThreads() const { + // use two times the number of hardware threads as the default + size_t result = TRI_numberProcessors() * 2; + // but only if higher than 64. otherwise use a default minimum value of 64 + if (result < 64) { + result = 64; + } + return result; +} #ifdef _WIN32 bool CtrlHandler(DWORD eventType) { diff --git a/arangod/Scheduler/SchedulerFeature.h b/arangod/Scheduler/SchedulerFeature.h index 7c698a4c78..9687ad376c 100644 --- a/arangod/Scheduler/SchedulerFeature.h +++ b/arangod/Scheduler/SchedulerFeature.h @@ -56,7 +56,7 @@ class SchedulerFeature final : public application_features::ApplicationFeature { uint64_t _nrMinimalThreads = 2; uint64_t _nrMaximalThreads = 0; uint64_t _queueSize = 128; - uint64_t _fifo1Size = 16 * 4096; + uint64_t _fifo1Size = 1024 * 1024; uint64_t _fifo2Size = 4096; public: @@ -65,6 +65,8 @@ class SchedulerFeature final : public application_features::ApplicationFeature { void buildHangupHandler(); private: + /// @brief return the default number of threads to use (upper bound) + size_t defaultNumberOfThreads() const; void buildScheduler(); private: diff --git a/arangod/V8Server/FoxxQueuesFeature.cpp b/arangod/V8Server/FoxxQueuesFeature.cpp index 885b36743f..897b51d1c9 100644 --- a/arangod/V8Server/FoxxQueuesFeature.cpp +++ b/arangod/V8Server/FoxxQueuesFeature.cpp @@ -45,7 +45,7 @@ void FoxxQueuesFeature::collectOptions(std::shared_ptr options) options->addOption( "--foxx.queues", - "enable or disable Foxx queues", + "enable Foxx queues", new BooleanParameter(&_enabled)); options->addOption( diff --git a/arangod/V8Server/V8DealerFeature.cpp b/arangod/V8Server/V8DealerFeature.cpp index a6434f6897..d7e94788b8 100644 --- a/arangod/V8Server/V8DealerFeature.cpp +++ b/arangod/V8Server/V8DealerFeature.cpp @@ -165,7 +165,7 @@ void V8DealerFeature::collectOptions(std::shared_ptr options) { options->addHiddenOption( "--javascript.enabled", - "enable or disable the V8 JS engine entirely", + "enable the V8 JavaScript engine", new BooleanParameter(&_enableJS)); }