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

add resource group name in request context #650

Merged
merged 7 commits into from Jan 9, 2023

Conversation

glorv
Copy link
Contributor

@glorv glorv commented Dec 28, 2022

No description provided.

Signed-off-by: glorv <glorvs@163.com>
@glorv glorv changed the title add resource group name add resource group name in request context Dec 28, 2022
Signed-off-by: glorv <glorvs@163.com>
@glorv
Copy link
Contributor Author

glorv commented Dec 28, 2022

@sticnarf @Connor1996 PTAL

@sticnarf
Copy link
Collaborator

Must we use the name "resource group"? Two unrelated concepts sharing the same name is really confusing... (Though I think it's more of the original resourceGroupTag's fault. The name "resource group" is too large for that)

@glorv
Copy link
Contributor Author

glorv commented Dec 28, 2022

The change in pingcap/kvproto#1029 used ResourceGroupName. I think it's somewhat confusing between the resource group tag and the new resource group.

@Connor1996
Copy link
Member

Connor1996 commented Dec 28, 2022

Indeed. How about changing the original name resourceGroupTag? Though I have no idea what to change to. /cc @mornyx

@mornyx
Copy link
Contributor

mornyx commented Dec 29, 2022

The change in pingcap/kvproto#1029 used ResourceGroupName. I think it's somewhat confusing between the resource group tag and the new resource group.

Could you please briefly explain what resource_group_name does?

The previous resource_group_tag was used with tikv#resource_metering module. They work together to measure the resource (CPU/Memory/...) usage of different SQLs. But we try to avoid introducing the concept of "SQL" to TiKV, so we only use a more general name.

I agree that maybe resource_group_tag needs a better name, but I need to make this decision based on both of our backgrounds.

(If only to avoid confusion, maybe resource_metering_tag is an option, which at least avoids the common resource_group_ prefix.)

@Connor1996
Copy link
Member

The resource group is a term used for resource control of different tenants or users. Each resource group defines resource quotas that it can use, like the number of CPU cores, read bandwidth and write bandwidth.

@Connor1996
Copy link
Member

Yes, I think resource_metering_tag is a more reasonable name.

@BornChanger
Copy link
Contributor

The change in pingcap/kvproto#1029 used ResourceGroupName. I think it's somewhat confusing between the resource group tag and the new resource group.

Could you please briefly explain what resource_group_name does?

The previous resource_group_tag was used with tikv#resource_metering module. They work together to measure the resource (CPU/Memory/...) usage of different SQLs. But we try to avoid introducing the concept of "SQL" to TiKV, so we only use a more general name.

I agree that maybe resource_group_tag needs a better name, but I need to make this decision based on both of our backgrounds.

(If only to avoid confusion, maybe resource_metering_tag is an option, which at least avoids the common resource_group_ prefix.)

What I want to make sure that the renaming is only seen internally. No external user interface will be affected, including metrics indicators. Is that true?

@mornyx
Copy link
Contributor

mornyx commented Jan 3, 2023

What I want to make sure that the renaming is only seen internally. No external user interface will be affected, including metrics indicators. Is that true?

We need to update TiDB/TiKV/kvproto/client-go at the same time. I think kvproto and client-go are the public interfaces of TiKV. If users build their own database system based on TiKV and depend on this field, then there is a breaking change here (although I think this is impossible, because this field is currently only used for our TopSQL). Other than this, no external user interface is affected.

/cc @zhongzc @breezewish

@breezewish
Copy link
Member

I think it's fine, because renaming a protobuf field name should be a compatible change. @mornyx

@glorv
Copy link
Contributor Author

glorv commented Jan 4, 2023

So shall I conclude that we will keep the current definition unchanged. @sticnarf @nolouch PTAL again

Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

lgtm. I support to change resource_group_tag to resource_metering_tag or metering_tag

Copy link
Contributor

@BornChanger BornChanger left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@Connor1996 Connor1996 left a comment

Choose a reason for hiding this comment

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

LGTM

@glorv
Copy link
Contributor Author

glorv commented Jan 6, 2023

@sticnarf PTAL again, thanks

@sticnarf
Copy link
Collaborator

sticnarf commented Jan 9, 2023

I find the lock resolver sends requests without the resource group name. Typically, the amount should be small. Are you going to set resource group name also for lock resolving requests?

@glorv
Copy link
Contributor Author

glorv commented Jan 9, 2023

I find the lock resolver sends requests without the resource group name. Typically, the amount should be small. Are you going to set resource group name also for lock resolving requests?

@sticnarf. Sorry I missed it. I fixed this by fetch the resource group name from the context, so the caller can bind this kind of requests to a specific resource group.
PTAL again, thanks~

@sticnarf sticnarf merged commit 4e1d38d into tikv:master Jan 9, 2023
@glorv glorv deleted the resource-group-name branch January 9, 2023 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants