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

Runaway query control based on resource group #43691

Closed
28 tasks done
Connor1996 opened this issue May 10, 2023 · 0 comments
Closed
28 tasks done

Runaway query control based on resource group #43691

Connor1996 opened this issue May 10, 2023 · 0 comments
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@Connor1996
Copy link
Member

Connor1996 commented May 10, 2023

Motivation

Run-away queries are queries that consume more resources beyond user expectation. This could be caused by improper SQL statement, suboptimal plan.
Runaway query can impact overall performance if they are not managed properly. We need to manage run-away queries effectively. Long-running operations should be identified and aborted.
Currently, we already have the deadline mechanism pushed down to the TiKV layer that one coprocessor request would not execute in TiKV more than 60s by default. But a runaway query may not cost too much time on one single coprocessor request, thus the deadline mechanism can't help avoid run-away queries. In the meantime, deadlines can't be too small, otherwise, normal requests can be quickly aborted.

How to identify run-away queries?

Runaway queries can adversely impact overall performance if they are not managed properly. Resource manager can take action when a query exceeds more than a specified amount of elapsed time. The elasped time indicates the time of being processed, which excludes the waiting time.
Differentiating run-away queries from queries that really need to perform a full table/index scan is hard. There is no absolute rule. So we just let users define the rule to identify run-away queries. They can twist it on their own needs. The criteria are only the execution time, at least at present. Maybe add more dimension later.
TiKV would send back the scan detail in coprocessor responses. If the total elapsed time of the query exceeds the threshold, then it would be recognized as a run-away query(statement).

Task Breakdown

Misc

@Connor1996 Connor1996 added the type/enhancement The issue or PR belongs to an enhancement. label May 10, 2023
@Connor1996 Connor1996 changed the title Runaway task control Runaway query control based on resource group Jun 9, 2023
ti-chi-bot bot pushed a commit that referenced this issue Jun 16, 2023
ti-chi-bot bot pushed a commit that referenced this issue Jun 16, 2023
ti-chi-bot bot pushed a commit that referenced this issue Jun 21, 2023
ti-chi-bot bot pushed a commit that referenced this issue Jun 21, 2023
ti-chi-bot bot pushed a commit that referenced this issue Oct 19, 2023
ti-chi-bot bot pushed a commit that referenced this issue Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant