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

Modify user or privilege will consume a significant amount of time and resources in million users scenario #55563

Open
lilinghai opened this issue Aug 21, 2024 · 0 comments
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@lilinghai
Copy link
Contributor

lilinghai commented Aug 21, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. Create 1 million databases with 2 tables per database.
  2. Create 2 users for each schema and grant privileges on the schema to the users.

From the monitoring of TiDB, it can be observed that the QPS for creating users and granting permissions is continuously declining. When the number of users reaches 200,000, the QPS is nearly 1.
TiDB maintains a full set of user and permission information in memory. When there are changes to users or permissions (triggered by statements such as create/alter user, grant, etc.), TiDB calls the NotifyUpdatePrivilege function which loads the full user and permission information from TiKV to refresh the cache. As the user information increases, this operation will become increasingly time-consuming and resource-intensive. Actual tests show CPU resource consumption at over 80%, and Golang GC causes memory fluctuations exceeding 10GB.

image
image
image

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

master

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

3 participants