mirror of https://gitee.com/bigwinds/arangodb
added startup option --query.memory-limit
This commit is contained in:
parent
d8eeae13e0
commit
044499e454
|
@ -127,6 +127,9 @@ std::shared_ptr<VPackBuilder> Profile::toVelocyPack() {
|
|||
return result;
|
||||
}
|
||||
|
||||
/// @brief global memory limit for AQL queries
|
||||
uint64_t Query::MemoryLimitValue = 0;
|
||||
|
||||
/// @brief global threshold value for slow queries
|
||||
double Query::SlowQueryThresholdValue = 10.0;
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ class Query {
|
|||
|
||||
/// @brief memory limit for query
|
||||
size_t memoryLimit() const {
|
||||
double value = getNumericOption("memoryLimit", 0.0);
|
||||
double value = getNumericOption("memoryLimit", MemoryLimitValue);
|
||||
if (value > 0.0) {
|
||||
return static_cast<size_t>(value);
|
||||
}
|
||||
|
@ -298,6 +298,14 @@ class Query {
|
|||
/// @brief transform the list of warnings to VelocyPack.
|
||||
/// NOTE: returns nullptr if there are no warnings.
|
||||
std::shared_ptr<arangodb::velocypack::Builder> warningsToVelocyPack() const;
|
||||
|
||||
/// @brief fetch the query memory limit
|
||||
static uint64_t MemoryLimit() { return MemoryLimitValue; }
|
||||
|
||||
/// @brief set the query memory limit
|
||||
static void MemoryLimit(uint64_t value) {
|
||||
MemoryLimitValue = value;
|
||||
}
|
||||
|
||||
/// @brief fetch the global query tracking value
|
||||
static bool DisableQueryTracking() { return DoDisableQueryTracking; }
|
||||
|
@ -447,6 +455,9 @@ class Query {
|
|||
|
||||
/// @brief whether or not the query is a data modification query
|
||||
bool _isModificationQuery;
|
||||
|
||||
/// @brief global memory limit for AQL queries
|
||||
static uint64_t MemoryLimitValue;
|
||||
|
||||
/// @brief global threshold value for slow queries
|
||||
static double SlowQueryThresholdValue;
|
||||
|
|
|
@ -38,6 +38,7 @@ aql::QueryRegistry* QueryRegistryFeature::QUERY_REGISTRY = nullptr;
|
|||
QueryRegistryFeature::QueryRegistryFeature(ApplicationServer* server)
|
||||
: ApplicationFeature(server, "QueryRegistry"),
|
||||
_queryTracking(true),
|
||||
_queryMemoryLimit(0),
|
||||
_slowThreshold(10.0),
|
||||
_queryCacheMode("off"),
|
||||
_queryCacheEntries(128) {
|
||||
|
@ -57,6 +58,9 @@ void QueryRegistryFeature::collectOptions(
|
|||
options->addOldOption("database.query-cache-max-results", "query.cache-entries");
|
||||
options->addOldOption("database.disable-query-tracking", "query.tracking");
|
||||
|
||||
options->addOption("--query.memory-limit", "memory threshold for AQL queries (in bytes)",
|
||||
new UInt64Parameter(&_queryMemoryLimit));
|
||||
|
||||
options->addOption("--query.tracking", "whether to track slow AQL queries",
|
||||
new BooleanParameter(&_queryTracking));
|
||||
|
||||
|
@ -77,6 +81,9 @@ void QueryRegistryFeature::validateOptions(
|
|||
}
|
||||
|
||||
void QueryRegistryFeature::prepare() {
|
||||
// set query memory limit
|
||||
arangodb::aql::Query::MemoryLimit(_queryMemoryLimit);
|
||||
|
||||
// set global query tracking flag
|
||||
arangodb::aql::Query::DisableQueryTracking(!_queryTracking);
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class QueryRegistryFeature final : public application_features::ApplicationFeatu
|
|||
|
||||
private:
|
||||
bool _queryTracking;
|
||||
uint64_t _queryMemoryLimit;
|
||||
double _slowThreshold;
|
||||
std::string _queryCacheMode;
|
||||
uint64_t _queryCacheEntries;
|
||||
|
|
Loading…
Reference in New Issue