1
0
Fork 0

options cleanup

This commit is contained in:
jsteemann 2018-07-17 12:33:10 +02:00
parent 426d2feef7
commit 1588c358b9
12 changed files with 65 additions and 56 deletions

View File

@ -302,10 +302,24 @@ The default value for this option is *false*.
### Server threads ### Server threads
`--server.threads number` `--server.minimal-threads number`
`--server.maximal-threads number`
Specifies the *number* of threads that are spawned to handle requests. 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 ### Toggling server statistics
`--server.statistics value` `--server.statistics value`

View File

@ -55,17 +55,14 @@ be strictly bounded by configuration options.
The number of server threads is now configured by the following startup 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 - `--server.minimal-threads`: determines the minimum number of request processing
threads the server will start and always keep around 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 The actual number of request processing threads is adjusted dynamically at runtime
and will float between `--server.minimal-threads` and `--server.threads`. and will float between `--server.minimal-threads` and `--server.maximal-threads`.
To avoid overloading servers, the value of `--server.threads` should not exceed the
server's number of hardware threads in ArangoDB 3.4.
HTTP REST API HTTP REST API
@ -248,24 +245,17 @@ less V8 contexts than 3.3.
Startup option changes 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 - `--server.minimal-threads`: determines the minimum number of request processing
threads the server will start 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 The actual number of request processing threads is adjusted dynamically at runtime
and will float between `--server.minimal-threads` and `--server.threads`. Thus the and will float between `--server.minimal-threads` and `--server.maximal-threads`.
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`.
- the default value for the existing startup option `--javascript.gc-interval` - 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 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, 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. 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 Permissions
----------- -----------

View File

@ -1,5 +0,0 @@
@brief number of threads
`--server.threads number`
Specifies the desired *number* of threads that are spawned to handle requests.

View File

@ -84,7 +84,7 @@ void AuthenticationFeature::collectOptions(
options->addOldOption("no-server", "server.rest-server"); options->addOldOption("no-server", "server.rest-server");
options->addOption("--server.authentication", options->addOption("--server.authentication",
"enable or disable authentication for ALL client requests", "enable authentication for ALL client requests",
new BooleanParameter(&_active)); new BooleanParameter(&_active));
options->addOption( options->addOption(
@ -94,7 +94,7 @@ void AuthenticationFeature::collectOptions(
options->addOption( options->addOption(
"--server.local-authentication", "--server.local-authentication",
"enable or disable authentication using the local user database", "enable authentication using the local user database",
new BooleanParameter(&_localAuthentication)); new BooleanParameter(&_localAuthentication));
options->addOption( options->addOption(

View File

@ -147,7 +147,7 @@ void GeneralServerFeature::collectOptions(
options->addSection("frontend", "Frontend options"); options->addSection("frontend", "Frontend options");
options->addOption("--frontend.proxy-request-check", options->addOption("--frontend.proxy-request-check",
"enable or disable proxy request checking", "enable proxy request checking",
new BooleanParameter(&_proxyCheck)); new BooleanParameter(&_proxyCheck));
options->addOption("--frontend.trusted-proxy", options->addOption("--frontend.trusted-proxy",

View File

@ -67,9 +67,9 @@ void ServerFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
options->addHiddenOption("--server.rest-server", "start a rest-server", options->addHiddenOption("--server.rest-server", "start a rest-server",
new BooleanParameter(&_restServer)); new BooleanParameter(&_restServer));
options->addOption("--server.session-timeout", options->addObsoleteOption("--server.session-timeout",
"timeout of web interface server sessions (in seconds)", "timeout of web interface server sessions (in seconds)",
new DoubleParameter(&VocbaseContext::ServerSessionTtl)); true);
options->addSection("javascript", "Configure the Javascript engine"); options->addSection("javascript", "Configure the Javascript engine");

View File

@ -30,9 +30,6 @@ using namespace arangodb::rest;
namespace arangodb { namespace arangodb {
double VocbaseContext::ServerSessionTtl =
60.0 * 60.0 * 24 * 60; // 2 month session timeout
VocbaseContext::VocbaseContext( VocbaseContext::VocbaseContext(
GeneralRequest& req, GeneralRequest& req,
TRI_vocbase_t& vocbase, TRI_vocbase_t& vocbase,

View File

@ -39,8 +39,6 @@ namespace arangodb {
/// @brief just also stores the context /// @brief just also stores the context
class VocbaseContext : public arangodb::ExecContext { class VocbaseContext : public arangodb::ExecContext {
public: public:
static double ServerSessionTtl;
TEST_VIRTUAL ~VocbaseContext(); TEST_VIRTUAL ~VocbaseContext();
static VocbaseContext* create(GeneralRequest& req, TRI_vocbase_t& vocbase); static VocbaseContext* create(GeneralRequest& req, TRI_vocbase_t& vocbase);

View File

@ -63,39 +63,38 @@ SchedulerFeature::~SchedulerFeature() {}
void SchedulerFeature::collectOptions( void SchedulerFeature::collectOptions(
std::shared_ptr<options::ProgramOptions> options) { std::shared_ptr<options::ProgramOptions> 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)); 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( options->addHiddenOption(
"--server.queue-size", "--server.scheduler-queue-size",
"number of simultaneously queued requests inside the scheduler", "number of simultaneously queued requests inside the scheduler",
new UInt64Parameter(&_queueSize)); new UInt64Parameter(&_queueSize));
options->addHiddenOption("--server.prio1-size", "size of the priority 1 fifo", options->addHiddenOption("--server.prio1-size", "size of the priority 1 fifo",
new UInt64Parameter(&_fifo1Size)); 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 // obsolete options
options->addObsoleteOption("--server.maximal-threads", options->addObsoleteOption("--server.threads", "number of threads", true);
"maximal number of threads", true);
// renamed options // renamed options
options->addOldOption("scheduler.threads", "server.threads"); options->addOldOption("scheduler.threads", "server.maximal-threads");
options->addOldOption("server.maximal-queue-size", "server.queue-size");
} }
void SchedulerFeature::validateOptions( void SchedulerFeature::validateOptions(
std::shared_ptr<options::ProgramOptions>) { std::shared_ptr<options::ProgramOptions>) {
if (_nrMaximalThreads == 0) { if (_nrMaximalThreads == 0) {
_nrMaximalThreads = TRI_numberProcessors(); _nrMaximalThreads = defaultNumberOfThreads();
} }
if (_queueSize == 0) { if (_queueSize == 0) {
@ -117,10 +116,10 @@ void SchedulerFeature::start() {
LOG_TOPIC(DEBUG, arangodb::Logger::THREADS) LOG_TOPIC(DEBUG, arangodb::Logger::THREADS)
<< "Detected number of processors: " << N; << "Detected number of processors: " << N;
if (_nrMaximalThreads > 2 * N) { if (_nrMaximalThreads > 8 * N) {
LOG_TOPIC(WARN, arangodb::Logger::THREADS) LOG_TOPIC(WARN, arangodb::Logger::THREADS)
<< "--server.threads (" << _nrMaximalThreads << "--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"; << "), this might overload the server";
} }
@ -210,6 +209,17 @@ void SchedulerFeature::stop() {
} }
void SchedulerFeature::unprepare() { SCHEDULER = nullptr; } 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 #ifdef _WIN32
bool CtrlHandler(DWORD eventType) { bool CtrlHandler(DWORD eventType) {

View File

@ -56,7 +56,7 @@ class SchedulerFeature final : public application_features::ApplicationFeature {
uint64_t _nrMinimalThreads = 2; uint64_t _nrMinimalThreads = 2;
uint64_t _nrMaximalThreads = 0; uint64_t _nrMaximalThreads = 0;
uint64_t _queueSize = 128; uint64_t _queueSize = 128;
uint64_t _fifo1Size = 16 * 4096; uint64_t _fifo1Size = 1024 * 1024;
uint64_t _fifo2Size = 4096; uint64_t _fifo2Size = 4096;
public: public:
@ -65,6 +65,8 @@ class SchedulerFeature final : public application_features::ApplicationFeature {
void buildHangupHandler(); void buildHangupHandler();
private: private:
/// @brief return the default number of threads to use (upper bound)
size_t defaultNumberOfThreads() const;
void buildScheduler(); void buildScheduler();
private: private:

View File

@ -45,7 +45,7 @@ void FoxxQueuesFeature::collectOptions(std::shared_ptr<ProgramOptions> options)
options->addOption( options->addOption(
"--foxx.queues", "--foxx.queues",
"enable or disable Foxx queues", "enable Foxx queues",
new BooleanParameter(&_enabled)); new BooleanParameter(&_enabled));
options->addOption( options->addOption(

View File

@ -165,7 +165,7 @@ void V8DealerFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
options->addHiddenOption( options->addHiddenOption(
"--javascript.enabled", "--javascript.enabled",
"enable or disable the V8 JS engine entirely", "enable the V8 JavaScript engine",
new BooleanParameter(&_enableJS)); new BooleanParameter(&_enableJS));
} }