Skip to content

Tablet throttler: support for custom query & threshold#7541

Merged
deepthi merged 9 commits intovitessio:masterfrom
planetscale:throttler-custom-query-and-threshold
Mar 18, 2021
Merged

Tablet throttler: support for custom query & threshold#7541
deepthi merged 9 commits intovitessio:masterfrom
planetscale:throttler-custom-query-and-threshold

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 requested a review from sougou as a code owner February 23, 2021 13:24
@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
Collaborator

@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
Collaborator

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

@deepthi deepthi merged commit 9a31025 into vitessio:master Mar 18, 2021
@deepthi deepthi deleted the throttler-custom-query-and-threshold branch March 18, 2021 17:34
@askdba askdba added this to the v10.0 milestone Mar 23, 2021
@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