Skip to content
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

Force Merge Runner Improvements - Polling #1051

Closed
wants to merge 21 commits into from

Conversation

gingerwizard
Copy link

This adds a polling mode to the force-merge runner and in the process closes #1050

Some considerations:

  1. The change adds a mode parameter. This defaults to blocking which causes the current behaviour.
  2. If set to polling we ignore the request-timeout parameter and timeout the force_merge API call after 1s. We then poll the tasks API at an interval of poll-period (default 10s), until no force-merge tasks are listed.
  3. Currently there is no timeout on the tasks API calls. It is possible this is susceptible to cluster pressure and may itself timeout under heavy load. However, i believe this represents a valid error condition.
  4. The 1s timeout is a workaround to the force_merge API not supporting an async call and returning a task id. If multiple force_merge calls are issued in different runners in parallel, all force merges must complete to unblock. This seems low risk as consecutive calls are effectively a noop if max-num-segments has been reached.

Will add docs once parameter naming and usage is agreed.

@gingerwizard gingerwizard added the enhancement Improves the status quo label Aug 21, 2020
@gingerwizard gingerwizard added this to the 2.0.2 milestone Aug 21, 2020
@gingerwizard gingerwizard requested a review from dliappis August 21, 2020 16:04
@gingerwizard gingerwizard self-assigned this Aug 21, 2020
Dale McDiarmid added 3 commits August 21, 2020 17:48
elastic#1049)

* Hints for handling errors and identifying queries and responses

* Fix formatting errors

* Fix links and formatting

* Grammatical fixes
@gingerwizard
Copy link
Author

@dliappis This is ready for an initial review now all CI tests pass.

Copy link
Contributor

@dliappis dliappis left a comment

Choose a reason for hiding this comment

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

Thank you for this super useful addition!

I left a number of style comments (unfortunately we skip many errors that pylint would normally report, see #838)

I haven't tested this yet, will do this asap.

@@ -618,11 +617,28 @@ async def __call__(self, es, params):
# the raw transport API (where the keyword argument is called `timeout`) in some cases we will always need
# a special handling for the force-merge API.
request_timeout = params.get("request-timeout")
mode = params.get("mode")
merge_params = { "request_timeout": request_timeout}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: https://www.flake8rules.com/rules/E201.html: merge_params = {"request_timeout": request_timeout} (IDE should want you about this, unfortunately #838 isn't done yet to help us in CI).

Copy link
Contributor

Choose a reason for hiding this comment

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

Also line 608 needs an additional whitespace, see https://www.flake8rules.com/rules/E302.html

"mode": {
"type": "string",
"enum": ["blocking", "polling"],
"description": "[Only for type 'force-merge']: Determines whether forced merged is blocking, causing a potential client timeout, or if it polls until no further force merge tasks."
Copy link
Contributor

Choose a reason for hiding this comment

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

s/force merged/force merge

@@ -609,7 +609,6 @@ def _init_internal_params(self):
def percent_completed(self):
return self.current_bulk / self.total_bulks


class ForceMergeParamSource(ParamSource):
Copy link
Contributor

Choose a reason for hiding this comment

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

tests/driver/runner_test.py Show resolved Hide resolved
}
}),
as_future({
"nodes":{}
Copy link
Contributor

Choose a reason for hiding this comment

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

})
]
force_merge = runner.ForceMerge()
await force_merge(es, params={"index" : "_all", "mode": "polling", 'poll-period': 0})
Copy link
Contributor

Choose a reason for hiding this comment

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

https://www.flake8rules.com/rules/E203.html ; also let's stick to double quotes (it's a convention in the Rally codebase).

}
}),
as_future({
"nodes":{}
Copy link
Contributor

Choose a reason for hiding this comment

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

force_merge = runner.ForceMerge()
# request-timeout should be ignored as mode:polling
await force_merge(es, params={"index" : "_all", "mode": "polling", "max-num-segments": 1,
"request-timeout": 50000, 'poll-period': 0})
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment here: https://www.flake8rules.com/rules/E203.html and double quotes instead of single quotes.

@@ -1811,7 +1811,6 @@ def test_replaces_body_params(self):

self.assertNotEqual(first, second)


class ForceMergeParamSourceTests(TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

tests/track/params_test.py Show resolved Hide resolved
@gingerwizard gingerwizard requested a review from dliappis August 31, 2020 16:02
@gingerwizard
Copy link
Author

@dliappis i believe i have addressed the formatting issues. If you're happy with the approach i'll add docs.

…lastic#1055)

When race didn't have total_transform_processing_times to report, `esrally compare` fails

Relates to elastic#1022
"operation" : "scroll",
"operation-type" : "Search"
}

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI These doc fragmants seem to have come from 89ed934 (they've already been merged in #1049).

Copy link
Contributor

Choose a reason for hiding this comment

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

@gingerwizard I still see this unrelated recipe in docs (coming from the older PR).

@dliappis dliappis self-requested a review September 10, 2020 06:31
Copy link
Contributor

@dliappis dliappis left a comment

Choose a reason for hiding this comment

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

@gingerwizard I tested this yesterday in a real long benchmark where force merging down to 1 segment takes a very long time the polling mode worked marvelously. Let's proceed with docs.

Copy link
Contributor

@dliappis dliappis left a comment

Choose a reason for hiding this comment

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

Have you added docs already for the polling mode of the force merge runner? I didn't see anything in this review cycle.

"operation" : "scroll",
"operation-type" : "Search"
}

Copy link
Contributor

Choose a reason for hiding this comment

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

@gingerwizard I still see this unrelated recipe in docs (coming from the older PR).

@dliappis
Copy link
Contributor

@elasticmachine test this

@dliappis
Copy link
Contributor

@elasticmachine run tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the status quo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add polling mode to force-merge runner
3 participants