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

Tablet throttler: support for custom query & threshold #7541

Merged

Conversation

shlomi-noach
Copy link
Contributor

@shlomi-noach shlomi-noach commented Feb 23, 2021

Description

This PR introduces vttablet command line flags, which allow the user to customize the tablet throttler behavior:

  • -throttle_metrics_query (string)
  • -throttle_metrics_threshold (float)
  • -throttle_check_as_check_self (bool)

The default behavior is for the throttler to check replication lag (where the lag threshold can be customized via the already existing -throttle_threshold).

However, the user may want to run a custom query. They are allowed to run:

  • Any SELECT query that returns a single row, single value, float/numeric data type
  • A SHOW GLOBAL (STATUS|VARIABLES) LIKE '<variable-name>'

An example use case would be:

vttablet
  -throttle_metrics_query "show global status like 'threads_running'"
  -throttle_metrics_threshold 150
  -throttle_check_as_check_self

The flag throttle_check_as_check_self is desired because the default throttler behavior, for writes, is to consider the overall health of the shard: the default check is for replication lag, and the throttler runs the lag evaluation query on all replicas on the shard. However, if the user wants to measure e.g. Threads_running on the primary only, then the flag throttle_check_as_check_self treats any write-check as "check-self" request, which only reads metrics on the specific tablet.

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving
  • VReplication
  • Cluster Management
  • Build/CI
  • VTAdmin

…ottle_metrics_threshold

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach
Copy link
Contributor Author

Testing TBD via endtoend tests.

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach shlomi-noach marked this pull request as draft February 23, 2021 13:25
@shlomi-noach
Copy link
Contributor Author

(still draft; will take out of draft mode when tests are satisfied)

…o interpret a SHOW GLOBAL query.

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach
Copy link
Contributor Author

Added support for -throttle_check_as_check_self, updating initial comment.

…s_self_check

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach shlomi-noach marked this pull request as ready for review February 24, 2021 09:18
@shlomi-noach
Copy link
Contributor Author

Ready for review.

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach
Copy link
Contributor Author

Kind ping, cc @aquarapid

@shlomi-noach
Copy link
Contributor Author

ping for review

Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

Nice work! LGTM

@deepthi
Copy link
Member

deepthi commented Mar 18, 2021

I'm going to merge this now. If there are other comments, they can be handled in a separate PR.
cc @aquarapid

@aquarapid
Copy link
Contributor

Validated as described; thanks! The only additional feature request I would have is to add the metric threshold to the debugEnvHandler, so that it can be adjusted without a vttablet restart, if needed.

@shlomi-noach
Copy link
Contributor Author

The only additional feature request I would have is to add the metric threshold to the debugEnvHandler

Creating a separate issue for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants