From 0f6ad7cfd45ed91ba5a20cfdca93068524d393d7 Mon Sep 17 00:00:00 2001 From: "Eduardo J. Ortega U" <5791035+ejortegau@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:30:34 +0200 Subject: [PATCH] Add documentation for query priority support by the transaction throttler (#1448) * Add documentation for query priority support by the transaction throttler. This accompanies https://github.com/vitessio/vitess/pull/12662/ Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com> * Address PR comments Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com> * Address PR comment. Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com> * Empty commit to re-run CI Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com> * Update docs to reflect polarity inversion for priority directive. Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com> * Update content/en/docs/17.0/user-guides/configuration-advanced/comment-directives.md Signed-off-by: Harshit Gangal * Update content/en/docs/17.0/reference/programs/vttablet.md Signed-off-by: Harshit Gangal * empty commit to kick CI Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> * Empty commit to re-trigger CI Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com> * empty commit to kick CI Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> * empty commit to kick CI Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --------- Signed-off-by: Eduardo J. Ortega U <5791035+ejortegau@users.noreply.github.com> Signed-off-by: Harshit Gangal Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Co-authored-by: Harshit Gangal Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- content/en/docs/17.0/reference/programs/vttablet.md | 1 + .../configuration-advanced/comment-directives.md | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/content/en/docs/17.0/reference/programs/vttablet.md b/content/en/docs/17.0/reference/programs/vttablet.md index 66bae57d8..d34196110 100644 --- a/content/en/docs/17.0/reference/programs/vttablet.md +++ b/content/en/docs/17.0/reference/programs/vttablet.md @@ -403,6 +403,7 @@ The following global options apply to `vttablet`: | --twopc_coordinator_address | string | address of the (VTGate) process(es) that will be used to notify of abandoned transactions. | | --twopc_enable | boolean | if the flag is on, 2pc is enabled. Other 2pc flags must be supplied. | | --tx-throttler-config | string | Synonym to -tx_throttler_config (default "target_replication_lag_sec: 2\nmax_replication_lag_sec: 10\ninitial_rate: 100\nmax_increase: 1\nemergency_decrease: 0.5\nmin_duration_between_increases_sec: 40\nmax_duration_between_increases_sec: 62\nmin_duration_between_decreases_sec: 20\nspread_backlog_across_sec: 20\nage_bad_rate_after_sec: 180\nbad_rate_increase: 0.1\nmax_rate_approach_threshold: 0.9\n") | +| --tx-throttler-default-priority int | int | Default query priority used by the transaction throttler if it is not specified in a query comment directive. It must be a number between 0 (highest priority) and 100 (lowest priority) (default: 100) | | --tx-throttler-healthcheck-cells | strings | Synonym to -tx_throttler_healthcheck_cells | | --tx-throttler-tablet-types | strings | A comma-separated list of tablet types. Only tablets of this type are monitored for replication lag by the transaction throttler. Supported types are replica and/or rdonly. (default replica) | | --tx_throttler_config | string | The configuration of the transaction throttler as a text formatted throttlerdata.Configuration protocol buffer message (default "target_replication_lag_sec: 2\nmax_replication_lag_sec: 10\ninitial_rate: 100\nmax_increase: 1\nemergency_decrease: 0.5\nmin_duration_between_increases_sec: 40\nmax_duration_between_increases_sec: 62\nmin_duration_between_decreases_sec: 20\nspread_backlog_across_sec: 20\nage_bad_rate_after_sec: 180\nbad_rate_increase: 0.1\nmax_rate_approach_threshold: 0.9\n") | diff --git a/content/en/docs/17.0/user-guides/configuration-advanced/comment-directives.md b/content/en/docs/17.0/user-guides/configuration-advanced/comment-directives.md index daad76c7a..faadca599 100644 --- a/content/en/docs/17.0/user-guides/configuration-advanced/comment-directives.md +++ b/content/en/docs/17.0/user-guides/configuration-advanced/comment-directives.md @@ -119,3 +119,15 @@ As shown above, the metrics being instrumented this way are `vttablet_query_coun If the query lacks the `WORKLOAD_NAME` directive, the corresponding label in the metric will have the value of an empty string. If `vttablet` is not started with `--enable-per-workload-table-metrics`, metrics are emitted without the workload label (e.g. `vttablet_query_counts{plan="Select",table="customer"}`. + +### Priority (`PRIORITY`) + +Specifies the priority associated with the execution of this query, as a number between 0 (highest priority) and 100 +(lowest priority). The priority is used by the transaction throttler (see `--tx-throttler-...` and `-enable-tx-throttler` +flags in the `vttablet` [documentation](../../reference/programs/vttablet.md))) to determine whether a particular query +should be throttled. If the transaction throttler determines that a query may need to be throttled, it will throttle it +with a probability equal to the provided query priority. This allows avoiding high business impact queries from being +throttled (by setting their priority to `0`) while letting less business critical ones continue to be throttled (by +setting their priority to more than `0`). + +Notice that this directive has no effect if the transaction throttler is not enabled.