Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

Conversation

@gnusi
Copy link
Contributor

@gnusi gnusi commented Dec 1, 2020

arangodb/arangodb#13008

  • Formatting
  • Port changes to 3.7
  • Add to 3.8 release notes
@gnusi gnusi changed the title adjust arangosearch options description Add description of new arangosearch server options Dec 1, 2020
@gnusi gnusi marked this pull request as ready for review December 3, 2020 16:36
@gnusi gnusi requested a review from Simran-B December 3, 2020 16:36
> still continue to return a repeatable-read state.

- **consolidationIntervalMsec** (_optional_; type: `integer`; default: `60000`;
- **consolidationIntervalMsec** (_optional_; type: `integer`; default: `1000`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Simran-B
Copy link
Collaborator

Code excerpts with annotations in case that we want to describe what autodetect does later:

THREADS_PARAM("--arangosearch.threads"); THREADS_LIMIT_PARAM("--arangosearch.threads-limit"); COMMIT_THREADS_PARAM("--arangosearch.commit-threads"); COMMIT_THREADS_IDLE_PARAM("--arangosearch.commit-threads-idle"); CONSOLIDATION_THREADS_PARAM("--arangosearch.consolidation-threads"); CONSOLIDATION_THREADS_IDLE_PARAM("--arangosearch.consolidation-threads-idle"); options->addOption(THREADS_PARAM, // --arangosearch.threads "the exact number of threads to use for asynchronous " "tasks (0 == autodetect)", new options::UInt32Parameter(&_threads)) .setDeprecatedIn(30800); options->addOption(THREADS_LIMIT_PARAM, // --arangosearch.threads-limit "upper limit to the autodetected number of threads to use " "for asynchronous tasks (0 == use default)", new options::UInt32Parameter(&_threadsLimit)) .setDeprecatedIn(30800); options->addOption(CONSOLIDATION_THREADS_PARAM, // --arangosearch.consolidation-threads "upper limit to the allowed number of consolidation threads " "(0 == autodetect)", new options::UInt32Parameter(&_consolidationThreads)) .setIntroducedIn(30760); options->addOption(CONSOLIDATION_THREADS_IDLE_PARAM, // --arangosearch.consolidation-threads-idle "upper limit to the allowed number of idle threads to use " "for consolidation tasks (0 == autodetect)", new options::UInt32Parameter(&_consolidationThreadsIdle)) .setIntroducedIn(30760); options->addOption(COMMIT_THREADS_PARAM, // --arangosearch.commit-threads "upper limit to the allowed number of commit threads " "(0 == autodetect)", new options::UInt32Parameter(&_commitThreads)) .setIntroducedIn(30760); options->addOption(COMMIT_THREADS_IDLE_PARAM, // --arangosearch.commit-threads-idle "upper limit to the allowed number of idle threads to use " "for commit tasks (0 == autodetect)", new options::UInt32Parameter(&_commitThreadsIdle)) .setIntroducedIn(30760); // at least 1 // at most 8 or a lower limit as defined by user, or lower count as defined by user ? // threads == 0 -> numCores / div (4 or 6) // threadsLimit == 0 -> MAX_THREADS (8) uint32_t computeThreadsCount(uint32_t threads, uint32_t threadsLimit, uint32_t div) noexcept { TRI_ASSERT(div); constexpr uint32_t MAX_THREADS = 8; // arbitrary limit on the upper bound of threads in pool constexpr uint32_t MIN_THREADS = 1; // at least one thread is required return std::max(MIN_THREADS, std::min(threadsLimit ? threadsLimit : MAX_THREADS, threads ? threads : uint32_t(arangodb::NumberOfCores::getValue()) / div)); } uint32_t computeIdleThreadsCount(uint32_t idleThreads, uint32_t threads) noexcept { if (0 == idleThreads) { return std::max(threads/2, 1U); } else { return std::min(idleThreads, threads); } } void IResearchFeature::validateOptions(std::shared_ptr<arangodb::options::ProgramOptions> options) { auto const& args = options->processingResult(); bool const threadsSet = args.touched(THREADS_PARAM); // --arangosearch.threads bool const threadsLimitSet = args.touched(THREADS_LIMIT_PARAM); // --arangosearch.threads-limit bool const commitThreadsSet = args.touched(COMMIT_THREADS_PARAM); // --arangosearch.commit-threads bool const commitThreadsIdleSet = args.touched(COMMIT_THREADS_IDLE_PARAM); // --arangosearch.commit-threads-idle bool const consolidationThreadsSet = args.touched(CONSOLIDATION_THREADS_PARAM); // --arangosearch.consolidation-threads bool const consolidationThreadsIdleSet = args.touched(CONSOLIDATION_THREADS_IDLE_PARAM); // --arangosearch.consolidation-threads-idle uint32_t threadsLimit = static_cast<uint32_t>(4*arangodb::NumberOfCores::getValue()); // If neither --arangosearch.commit-threads nor --arangosearch.consolidation-threads is set, // then --arangosearch.threads and --arangosearch.threads-limit are ignored. // If the new options aren't set, then the legacy options are translated internally to the new options. if ((threadsLimitSet || threadsSet) && !commitThreadsSet && !consolidationThreadsSet) { // backwards compatibility threadsLimit = std::min(threadsLimit, _threadsLimit); // between user-supplied --arangosearch.threads-limit and 4*numCores uint32_t const threads = computeThreadsCount(_threads, threadsLimit, 4); // --arangosearch.threads, above, divide by 4 _commitThreads = std::max(threads/2, 1U); // set internal value for --arangosearch.commit-threads to above divided by 2, but at least 1 _consolidationThreads = _commitThreads; // same also for --arangosearch.consolidation-threads } else { _commitThreads = computeThreadsCount(_commitThreads, threadsLimit, 6); // --arangosearch.commit-threads, 4*numCores, divide by 6 _consolidationThreads = computeThreadsCount(_consolidationThreads, threadsLimit, 6); // --arangosearch.consolidation-threads, 4*numCores, divide by 6 } _commitThreadsIdle = commitThreadsIdleSet ? computeIdleThreadsCount(_commitThreadsIdle, _commitThreads) : _commitThreads; _consolidationThreadsIdle = consolidationThreadsIdleSet ? computeIdleThreadsCount(_consolidationThreadsIdle, _consolidationThreads) : _consolidationThreads; _running.store(false); }
consolidationIntervalMsec was apparently changed to 1000 there too (v3.7.5?)
@Simran-B Simran-B merged commit 4348b18 into main Dec 11, 2020
@Simran-B Simran-B deleted the feature/arangosearch-maintenance-rework branch December 11, 2020 15:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

5 participants