diff --git a/CHANGELOG b/CHANGELOG index 8259b778ad..65c2117624 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,11 @@ v3.4.9 (XXXX-XX-XX) ------------------- +* Add --server.statistics-history flag to allow disabling of only the historical + statistics. Also added rocksdbengine.write.amplification.x100 statistics + for measurement of compaction option impact. Enabled non-historical + statistics for agents. + * Fixed output of `_listObjects()` function of "general-graph" and "smart-graph" modules, which did not print the `_id` values of the return graphs correctly. diff --git a/arangod/Agency/AgencyFeature.cpp b/arangod/Agency/AgencyFeature.cpp index f62b136f12..f4647dea86 100644 --- a/arangod/Agency/AgencyFeature.cpp +++ b/arangod/Agency/AgencyFeature.cpp @@ -233,11 +233,10 @@ void AgencyFeature::validateOptions(std::shared_ptr options) { // the selected storage engine // - ArangoSearch: not needed by agency even if MMFiles is the selected // storage engine - // - Statistics: turn off statistics gathering for agency // - Action/Script/FoxxQueues/Frontend: Foxx and JavaScript APIs std::vector disabledFeatures( - {"MMFilesPersistentIndex", "ArangoSearch", "Statistics", "Action", + {"MMFilesPersistentIndex", "ArangoSearch", "Action", "Script", "FoxxQueues", "Frontend"}); if (!result.touched("console") || !*(options->get("console")->ptr)) { // specifiying --console requires JavaScript, so we can only turn it off diff --git a/arangod/RocksDBEngine/RocksDBEngine.cpp b/arangod/RocksDBEngine/RocksDBEngine.cpp index 434a89a95d..d2d12a836f 100644 --- a/arangod/RocksDBEngine/RocksDBEngine.cpp +++ b/arangod/RocksDBEngine/RocksDBEngine.cpp @@ -2229,6 +2229,14 @@ void RocksDBEngine::getStatistics(VPackBuilder& builder) const { for (auto const& stat : rocksdb::TickersNameMap) { builder.add(stat.second, VPackValue(_options.statistics->getTickerCount(stat.first))); } + + uint64_t walWrite, flushWrite, compactionWrite, userWrite; + walWrite = _options.statistics->getTickerCount(rocksdb::WAL_FILE_BYTES); + flushWrite = _options.statistics->getTickerCount(rocksdb::FLUSH_WRITE_BYTES); + compactionWrite = _options.statistics->getTickerCount(rocksdb::COMPACT_WRITE_BYTES); + userWrite = _options.statistics->getTickerCount(rocksdb::BYTES_WRITTEN); + builder.add("rocksdbengine.write.amplification.x100", + VPackValue( (0 != userWrite) ? ((walWrite+flushWrite+compactionWrite)*100)/userWrite : 100)); } cache::Manager* manager = CacheManagerFeature::MANAGER; diff --git a/arangod/Statistics/StatisticsFeature.cpp b/arangod/Statistics/StatisticsFeature.cpp index ef4e0710fa..e1344d3d62 100644 --- a/arangod/Statistics/StatisticsFeature.cpp +++ b/arangod/Statistics/StatisticsFeature.cpp @@ -21,6 +21,7 @@ //////////////////////////////////////////////////////////////////////////////// #include "StatisticsFeature.h" +#include "Cluster/ServerState.h" #include "Logger/Logger.h" #include "ProgramOptions/ProgramOptions.h" #include "ProgramOptions/Section.h" @@ -124,6 +125,8 @@ StatisticsFeature* StatisticsFeature::STATISTICS = nullptr; StatisticsFeature::StatisticsFeature(application_features::ApplicationServer& server) : ApplicationFeature(server, "Statistics"), _statistics(true), + _statisticsHistory(true), + _statisticsHistoryTouched(false), _descriptions(new stats::Descriptions()) { startsAfter("AQLPhase"); setOptional(true); @@ -138,13 +141,22 @@ void StatisticsFeature::collectOptions(std::shared_ptr options) "turn statistics gathering on or off", new BooleanParameter(&_statistics), arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + options->addOption("--server.statistics-history", + "turn storing statistics in database on or off", + new BooleanParameter(&_statisticsHistory), + arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + .setIntroducedIn(30409) + .setIntroducedIn(30501); } -void StatisticsFeature::validateOptions(std::shared_ptr) { +void StatisticsFeature::validateOptions(std::shared_ptr options) { if (!_statistics) { // turn ourselves off disable(); } + + _statisticsHistoryTouched = options->processingResult().touched("--server.statistics-history"); + } void StatisticsFeature::prepare() { @@ -186,7 +198,6 @@ void StatisticsFeature::start() { } _statisticsThread.reset(new StatisticsThread); - _statisticsWorker.reset(new StatisticsWorker(*vocbase)); if (!_statisticsThread->start()) { LOG_TOPIC(FATAL, arangodb::Logger::STATISTICS) @@ -194,11 +205,20 @@ void StatisticsFeature::start() { FATAL_ERROR_EXIT(); } - if (!_statisticsWorker->start()) { - LOG_TOPIC(FATAL, arangodb::Logger::STATISTICS) + // force history disable on Agents + if (arangodb::ServerState::instance()->isAgent() && !_statisticsHistoryTouched) { + _statisticsHistory = false; + } // if + + if (_statisticsHistory) { + _statisticsWorker.reset(new StatisticsWorker(*vocbase)); + + if (!_statisticsWorker->start()) { + LOG_TOPIC(FATAL, arangodb::Logger::STATISTICS) << "could not start statistics worker"; - FATAL_ERROR_EXIT(); - } + FATAL_ERROR_EXIT(); + } + } // if } void StatisticsFeature::unprepare() { diff --git a/arangod/Statistics/StatisticsFeature.h b/arangod/Statistics/StatisticsFeature.h index ac65eae560..4187494278 100644 --- a/arangod/Statistics/StatisticsFeature.h +++ b/arangod/Statistics/StatisticsFeature.h @@ -85,6 +85,8 @@ class StatisticsFeature final : public application_features::ApplicationFeature private: bool _statistics; + bool _statisticsHistory; + bool _statisticsHistoryTouched; std::unique_ptr _descriptions; std::unique_ptr _statisticsThread; @@ -93,4 +95,4 @@ class StatisticsFeature final : public application_features::ApplicationFeature } // namespace arangodb -#endif \ No newline at end of file +#endif