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

Resource Controller Limiter may not work well #8435

Closed
nolouch opened this issue Jul 23, 2024 · 2 comments · Fixed by #8436
Closed

Resource Controller Limiter may not work well #8435

nolouch opened this issue Jul 23, 2024 · 2 comments · Fixed by #8436
Labels
affects-7.1 affects-7.5 affects-8.1 report/customer Customers have encountered this bug. severity/major type/bug The issue is confirmed as a bug.

Comments

@nolouch
Copy link
Contributor

nolouch commented Jul 23, 2024

What did you do?

Run the test added in #8434 . my env 72 cores:

Concurrency reserveN limit Need Wait Actually QPS Actually RU_COST Pass
10000 1000 4000000 0s 1487846.00 1487846000.00
5000 1000 4000000 1.249s 3999.00 3999000.00
3840 1000 4000000 0s 1419048.00 1419048000.00
1000 1000 4000000 0s 1420002.00 1420002000.00
1000 200 4000000 0s 1474321.00 294864200.00
1000 5000 4000000 1.252s 801.00 4005000.00
10000 50 400000 0s 1375128.00 68756400.00
5000 50 400000 0s 1353481.00 67674050.00
3840 50 400000 0s 1428777.00 71438850.00
1000 50 400000 0s 1406483.00 70324150.00
500 50 400000 0s 1548921.00 77446050.00
200 50 400000 24.015ms 8000.00 400000.00
100 50 400000 12.179ms 8001.00 400050.00
1000 10 400000 0s 1452066.00 14520660.00
1000 250 400000 624.087ms 1599.00 399750.00
10000 500 400000 12.514s 800.00 400000.00
5000 500 400000 6.257s 799.00 399500.00
3840 500 400000 4.805s 799.00 399500.00
1000 500 400000 1.251s 800.00 400000.00
1000 100 200000 500.348ms 2003.00 200300.00
1000 100 400000 249.302ms 3998.00 399800.00
@nolouch
Copy link
Contributor Author

nolouch commented Jul 24, 2024

This is caused by:

  • In high concurrency scenarios, time may appear reversed because the now value passed from outside. high mutext completion leading to more non-sequential execution orders.
  • Time reversal allows for advancing more tokens, which can cause the issue. even result in no limit for controller.

@ti-chi-bot ti-chi-bot bot closed this as completed in 83f32e9 Jul 24, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jul 24, 2024
…#8436) (#8437)

close #8435

controller: Fix limiter not functioning well in high concurrency scenarios
- In high concurrency scenarios, time may appear rollback because the `now` value passed from outside. high mutext completion leading to more non-sequential execution orders.
- Time rollback allows advancing more tokens, which can cause the issue. even result in no limit for the controller.
- Fix the problem by avoiding time rollback; instead of acquiring time again within the lock to fix it, as this might incur high costs when frequently acquiring time.

Signed-off-by: nolouch <[email protected]>

Co-authored-by: nolouch <[email protected]>
ti-chi-bot bot pushed a commit that referenced this issue Jul 25, 2024
…#8436) (#8439)

close #8435

controller: Fix limiter not functioning well in high concurrency scenarios
- In high concurrency scenarios, time may appear rollback because the `now` value passed from outside. high mutext completion leading to more non-sequential execution orders.
- Time rollback allows advancing more tokens, which can cause the issue. even result in no limit for the controller.
- Fix the problem by avoiding time rollback; instead of acquiring time again within the lock to fix it, as this might incur high costs when frequently acquiring time.

Signed-off-by: nolouch <[email protected]>

Co-authored-by: nolouch <[email protected]>
ti-chi-bot bot pushed a commit that referenced this issue Jul 25, 2024
…#8436) (#8438)

close #8435

controller: Fix limiter not functioning well in high concurrency scenarios
- In high concurrency scenarios, time may appear rollback because the `now` value passed from outside. high mutext completion leading to more non-sequential execution orders.
- Time rollback allows advancing more tokens, which can cause the issue. even result in no limit for the controller.
- Fix the problem by avoiding time rollback; instead of acquiring time again within the lock to fix it, as this might incur high costs when frequently acquiring time.

Signed-off-by: nolouch <[email protected]>

Co-authored-by: nolouch <[email protected]>
ti-chi-bot bot pushed a commit to pingcap/tidb that referenced this issue Jul 25, 2024
ti-chi-bot bot pushed a commit to pingcap/tidb that referenced this issue Jul 26, 2024
@seiya-annie
Copy link

/report customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Jul 29, 2024
ti-chi-bot bot pushed a commit to pingcap/tidb that referenced this issue Jul 30, 2024
ti-chi-bot bot pushed a commit to pingcap/tidb that referenced this issue Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.1 affects-7.5 affects-8.1 report/customer Customers have encountered this bug. severity/major type/bug The issue is confirmed as a bug.
Projects
Development

Successfully merging a pull request may close this issue.

2 participants