mirror of https://gitee.com/bigwinds/arangodb
control number of v8 contexts independently from number of server threads
added command-line option `--javascript.v8-contexts` to control the number of V8 contexts created in arangod. Previously, the number of V8 contexts was equal to the number of server threads (as specified by option `--server.threads`). However, it may be sensible to create different amounts of threads and V8 contexts. If the option is not specified, the number of V8 contexts created will be equal to the number of server threads. Thus no change in configuration is required to keep the old behavior.
This commit is contained in:
parent
9862c85464
commit
1ae150d90a
10
CHANGELOG
10
CHANGELOG
|
@ -1,6 +1,16 @@
|
|||
v2.3.0 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* added command-line option `--javascript.v8-contexts` to control the number of
|
||||
V8 contexts created in arangod.
|
||||
|
||||
Previously, the number of V8 contexts was equal to the number of server threads
|
||||
(as specified by option `--server.threads`). However, it may be sensible to
|
||||
create different amounts of threads and V8 contexts. If the option is not
|
||||
specified, the number of V8 contexts created will be equal to the number of
|
||||
server threads. Thus no change in configuration is required to keep the old
|
||||
behavior.
|
||||
|
||||
* removed bitarray indexes
|
||||
|
||||
* removed internal "_admin/modules/flush" in order to fix requireApp
|
||||
|
|
|
@ -281,6 +281,7 @@ ArangoServer::ArangoServer (int argc, char** argv)
|
|||
_disableAuthenticationUnixSockets(false),
|
||||
_dispatcherThreads(8),
|
||||
_dispatcherQueueSize(8192),
|
||||
_v8Contexts(8),
|
||||
_databasePath(),
|
||||
_defaultMaximalSize(TRI_JOURNAL_DEFAULT_MAXIMAL_SIZE),
|
||||
_defaultWaitForSync(false),
|
||||
|
@ -560,6 +561,7 @@ void ArangoServer::buildApplicationServer () {
|
|||
|
||||
additional["THREAD Options:help-admin"]
|
||||
("server.threads", &_dispatcherThreads, "number of threads for basic operations")
|
||||
("javascript.v8-contexts", &_v8Contexts, "number of V8 contexts that are created for executing JavaScript actions")
|
||||
;
|
||||
|
||||
additional["Server Options:help-extended"]
|
||||
|
@ -795,25 +797,35 @@ int ArangoServer::startupServer () {
|
|||
|
||||
TRI_ASSERT(vocbase != nullptr);
|
||||
|
||||
|
||||
// initialise V8
|
||||
size_t concurrency = _dispatcherThreads;
|
||||
if (! _applicationServer->programOptions().has("javascript.v8-contexts")) {
|
||||
// the option was added recently so it's not always set
|
||||
// the behavior in older ArangoDB was to create one V8 context per dispatcher thread
|
||||
_v8Contexts = _dispatcherThreads;
|
||||
}
|
||||
|
||||
if (_v8Contexts < 1) {
|
||||
_v8Contexts = 1;
|
||||
}
|
||||
|
||||
if (mode == OperationMode::MODE_CONSOLE) {
|
||||
// one V8 instance is taken by the console
|
||||
if (startServer) {
|
||||
++concurrency;
|
||||
++_v8Contexts;
|
||||
}
|
||||
}
|
||||
else if (mode == OperationMode::MODE_UNITTESTS || mode == OperationMode::MODE_SCRIPT) {
|
||||
if (concurrency == 1) {
|
||||
// at least two to allow the test-runner and the scheduler to use a V8
|
||||
concurrency = 2;
|
||||
if (_v8Contexts == 1) {
|
||||
// at least two to allow both the test-runner and the scheduler to use a V8 instance
|
||||
_v8Contexts = 2;
|
||||
}
|
||||
}
|
||||
|
||||
_applicationV8->setVocbase(vocbase);
|
||||
_applicationV8->setConcurrency(concurrency);
|
||||
_applicationV8->setConcurrency(_v8Contexts);
|
||||
_applicationV8->defineDouble("DISPATCHER_THREADS", _dispatcherThreads);
|
||||
_applicationV8->defineDouble("V8_CONTEXTS", _v8Contexts);
|
||||
|
||||
// .............................................................................
|
||||
// prepare everything
|
||||
|
|
|
@ -317,12 +317,12 @@ namespace triagens {
|
|||
bool _disableAuthenticationUnixSockets;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief number of dispatcher threads for non-database worker
|
||||
/// @brief number of dispatcher threads
|
||||
/// @startDocuBlock serverThreads
|
||||
/// `--server.threads number`
|
||||
///
|
||||
/// Specifies the *number* of threads that are spawned to handle action
|
||||
/// requests using Rest, JavaScript, or Ruby.
|
||||
/// Specifies the *number* of threads that are spawned to handle HTTP REST
|
||||
/// requests.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -330,7 +330,7 @@ namespace triagens {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief maximum size of the dispatcher queue for asynchronous requests
|
||||
/// @startDocuBlock serverAuthenticationDisable
|
||||
/// @startDocuBlock schedulerMaximalQueueSize
|
||||
/// `--scheduler.maximal-queue-size size`
|
||||
///
|
||||
/// Specifies the maximum *size* of the dispatcher queue for asynchronous
|
||||
|
@ -343,6 +343,21 @@ namespace triagens {
|
|||
|
||||
int _dispatcherQueueSize;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief number of V8 contexts for executing JavaScript actions
|
||||
/// @startDocuBlock v8Contexts
|
||||
/// `--server.v8-contexts number`
|
||||
///
|
||||
/// Specifies the *number* of V8 contexts that are created for executing
|
||||
/// JavaScript code. More contexts allow execute more JavaScript actions in
|
||||
/// parallel, provided that there are also enough threads available. Please
|
||||
/// note that each V8 context will use a substantial amount of memory and
|
||||
/// requires periodic CPU processing time for garbage collection.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int _v8Contexts;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief path to the database
|
||||
/// @startDocuBlock DatabaseDirectory
|
||||
|
|
Loading…
Reference in New Issue