8000 Cluster overwhelm countermeasures by neunhoef · Pull Request #13108 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Cluster overwhelm countermeasures #13108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 106 commits into from
Dec 11, 2020
Merged

Conversation

neunhoef
Copy link
Member
@neunhoef neunhoef commented Nov 27, 2020

This PR combines several measures. It tries to implement a whole lot
of countermeasures for bad behaviour of the cluster during high load
situations. The document to discuss these countermeasures is here:

https://github.com/arangodb/documents/blob/master/DesignDocuments/02_PLANNING/FightClusterOverwhelm.md

This started as a document to collect evidence and problems, but
also ideas for counter measures. Now, it serves as a design
document for the changes actually done. A lot of discussions and
testing will still be required.

Enterprise PR: https://github.com/arangodb/enterprise/pull/600

Scope & Purpose

(Please describe the changes in this PR for reviewers - mandatory)

  • [*] 💩 Bugfix (requires CHANGELOG entry)
  • [*] 🍕 New feature (requires CHANGELOG entry, feature documentation and release notes)
  • [*] 🔥 Performance improvement
  • 🔨 Refactoring/simplification
  • 📖 CHANGELOG entry made

Backports:

  • No backports required
  • [*] Backports required for: (Please specify versions and link PRs)
    We need to discuss how much of this is needed in 3.7 and 3.6, since the behaviour of clusters under load is pretty bad in all versions.

Related Information

(Please reference tickets / specification / other PRs etc)

Testing & Verification

(Please pick either of the following options)

  • This change is a trivial rework / code cleanup without any test coverage.
  • [*] The behavior in this PR was manually tested
  • This change is already covered by existing tests, such as (please describe tests).
  • This PR adds tests that were used to verify all changes:
    • Added new C++ Unit tests
    • Added new integration tests (e.g. in shell_server / shell_server_aql)
    • Added new resilience tests (only if the feature is impacted by failovers)
  • There are tests in an external testing repository:
  • I ensured this code runs with ASan / TSan or other static verification tools

http://172.16.10.101:8080/view/PR/job/arangodb-matrix-pr/13136/

@neunhoef neunhoef added this to the devel milestone Nov 27, 2020
@neunhoef neunhoef self-assigned this Nov 27, 2020
@neunhoef
Copy link
Member Author

@neunhoef
Copy link
Member Author

Note that this currently does compile on Windows with some stupid initializer list error. Will fix next week.

@neunhoef
Copy link
Member Author
neunhoef commented Dec 8, 2020

Copy link
Member
@mchacki mchacki left a comment

Choose a reason for hiding this comment

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

I have left some inline comments, which I would like to be considered.
For the "production" code comments, none of them justifies to block this PR, so I am fine with the comments not being addressed.

But I am missing CHANGELOG entries here, which would like to sort out before accepting.

if ((::queueWarningTick++ & 0xFFu) == 0) {
auto const& now = std::chrono::steady_clock::now();
if (::conditionQueueFullSince == time_point{}) {
logQueueWarningEveryNowAndThen(::queueWarningTick, _maxFifoSize, approxQueueLength);
logQueueWarningEveryNowAndThen(::queueWarningTick, _maxFifoSizes[3], approxQueueLength);
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to add this warning now to prio 2 queue as well?
Having 4 lanes now there is a chance for lane 2 and 3 to starve, while lane 0 and 1 are busy. (0 should be fine, but 1 certainly has the right to do heavy load (e.g. replication => funny RocksDB stalls.)

// We limit the number of ongoing low priority jobs to prevent a cluster
// from getting overwhelmed
std::size_t const ongoing = _ongoingLowPriorityGauge.load();
if (ongoing >= _ongoingLowPriorityLimit) {
Copy link
Member

Choose a reason for hiding this comment

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

For now this is good.
For the future:
As soon as we have higher parallelization in AQL, this is not enough anymore. (I am think about multiple diamonds in AQL where the upper diamond can work parallel to the lower diamond. as soon as we have this the amount of fan-out requests in AQL is not bounded by the number of DBServers, but by number diamonds * DBServers..

Copy link
Member
@mchacki mchacki left a comment

Choose a reason for hiding this comment

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

ok, cross out everything I said before.
This PR adds a total of 0 Tests on this very critical piece of code.
How is the plan to test this?

@dhly-etc
Copy link
Contributor
dhly-etc commented Dec 8, 2020

Copy link
Member
@mchacki mchacki left a comment

Choose a reason for hiding this comment

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

This modifications addressed my comments very good 👍

The topic of missing tests is still open though still no Approve from my side.
Production Code is Approved.

@@ -490,12 +490,12 @@ bool CommTask::handleRequestSync(std::shared_ptr<RestHandler> handler) {
// and there is currently only a single client handled by the IoContext
auto cb = [self = shared_from_this(), handler = std::move(handler), prio]() mutable {
if (prio == RequestPriority::LOW) {
SchedulerFeature::SCHEDULER->ongoingLowPriorityTasks() += 1;
SchedulerFeature::SCHEDULER->trackBeginOngoingLowPriorityTask();
Copy link
Member

Choose a reason for hiding this comment

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

\o/

Gauge<uint64_t>& SupervisedScheduler::ongoingLowPriorityTasks() {
return _ongoingLowPriorityGauge;
void SupervisedScheduler::trackBeginOngoingLowPriorityTask() {
if (_server.isStopping()) {
Copy link
Member

Choose a reason for hiding this comment

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

yay this is save, I like it

@dhly-etc
Copy link
Contributor
dhly-etc commented Dec 8, 2020

@dhly-etc
Copy link
Contributor
dhly-etc commented Dec 8, 2020

@jsteemann
Copy link
Contributor

@jsteemann
Copy link
Contributor

@jsteemann
Copy link
Contributor

@jsteemann jsteemann merged commit b9a5b52 into devel Dec 11, 2020
@jsteemann jsteemann deleted the feature/prevent-cluster-overwhelm2 branch December 11, 2020 13:28
@goedderz goedderz mentioned this pull request Aug 25, 2021
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0