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

api: use easyjson and context in regions interface (#6838) #6855

Merged

Conversation

ti-chi-bot
Copy link
Member

@ti-chi-bot ti-chi-bot commented Jul 27, 2023

This is an automated cherry-pick of #6838

What problem does this PR solve?

Issue Number: Close #6835

What is changed and how does it work?

  1. reduce half memory and cpu usage
  2. server stop solving when the client stop

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  1. bench
    go test -benchmem -run=^$ -bench ^BenchmarkGetRegions$ github.com/tikv/pd/server/api -benchtime=30s
times ns/op B/op allocs/op
default 12 2964076204 1153885878 4253342
default 12 2985435560 1271459127 4261952
default 12 2994243983 1241259906 4255758
jsoniter 15 2492527400 2384667309 4044502
jsoniter 18 2428125878 2545873184 4018365
jsoniter 18 2207472486 2214775903 3925291
easyjson 26 1381140866 803330238 3582216
easyjson 28 1339109264 786423035 3564425
easyjson 26 1370970701 801957518 3575059
this pr(c501fd8) 24 1386651999 789385029 3577663
this pr(c501fd8) 24 1512373970 814244526 3632067
this pr(c501fd8) 26 1455024327 794162807 3603735
this pr(2b1ab88) 31 1343236075 558050128 3568320
this pr(2b1ab88) 30 1249315290 551981506 3534328
this pr(2b1ab88) 31 1316071881 544873733 3557758
  ns/op ns diff B/op Bytes diff allocs/op alloc diff
default 2981251916   1222201637   4257017  
jsoniter 2376041921 -20% 2381772132 95% 3996053 -6%
easyjson 1363740277 -54% 797236930 -35% 3573900 -16%
this pr(c501fd8) 1451350099 -51% 799264121 -35% 3604488 -15%
this pr(2b1ab88) 1302874415 -56% 551635122 -55% 3553468 -17%
  1. kill and ensure the goroutine exit
    client: curl -s -o /dev/null http://192.168.8.88:2379/pd/api/v1/regions and ctrl-c
    server: goroutine exit

Release note

None.

close tikv#6835

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 27, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • HuSharp
  • bufferflies

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/cherry-pick-not-approved labels Jul 27, 2023
@ti-chi-bot ti-chi-bot added affects-6.5 affects-6.6 affects-7.0 affects-7.1 affects-7.2 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR. labels Jul 27, 2023
@ti-chi-bot ti-chi-bot bot requested review from JmPotato and lhy1024 July 27, 2023 18:17
Signed-off-by: AndreMouche <AndreMouche@126.com>
@AndreMouche
Copy link
Member

@lhy1024 could you please take a look? /scripts/embed-dashboard-ui.sh failed

@lhy1024
Copy link
Contributor

lhy1024 commented Jul 28, 2023

@AndreMouche It is an enhancement, I think we should provide a hotfix rather than pick it to 6.5.

Signed-off-by: lhy1024 <admin@liudos.us>
@lhy1024
Copy link
Contributor

lhy1024 commented Aug 9, 2023

@AndreMouche I fix the conflict, but I am not sure whether pick it to other branches. cc @nolouch @niubell

@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Patch coverage: 66.66% and project coverage change: -0.03% ⚠️

Comparison is base (3a19dec) 75.59% compared to head (d8ac207) 75.57%.
Report is 1 commits behind head on release-6.5.

Additional details and impacted files
@@               Coverage Diff               @@
##           release-6.5    #6855      +/-   ##
===============================================
- Coverage        75.59%   75.57%   -0.03%     
===============================================
  Files              328      329       +1     
  Lines            33199    33595     +396     
===============================================
+ Hits             25097    25389     +292     
- Misses            5947     6028      +81     
- Partials          2155     2178      +23     
Flag Coverage Δ
unittests 75.57% <66.66%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
server/api/region_easyjson.go 62.01% <62.01%> (ø)
server/config/store_config.go 80.43% <71.42%> (-1.18%) ⬇️
server/api/region.go 70.45% <83.87%> (+2.24%) ⬆️
server/cluster/cluster.go 81.58% <100.00%> (+0.02%) ⬆️
server/core/test_util.go 84.67% <100.00%> (+1.20%) ⬆️
server/schedule/waiting_operator.go 97.36% <100.00%> (ø)

... and 21 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Aug 10, 2023
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 14, 2023
@ti-chi-bot ti-chi-bot bot removed the status/LGT1 Indicates that a PR has LGTM 1. label Aug 15, 2023
@ti-chi-bot ti-chi-bot bot added the status/LGT2 Indicates that a PR has LGTM 2. label Aug 15, 2023
@lhy1024
Copy link
Contributor

lhy1024 commented Aug 15, 2023

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 15, 2023

@lhy1024: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 15, 2023

This pull request has been accepted and is ready to merge.

Commit hash: d8ac207

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 15, 2023
@ti-chi-bot ti-chi-bot bot merged commit 241ca13 into tikv:release-6.5 Aug 15, 2023
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 affects-6.6 affects-7.0 affects-7.1 affects-7.2 cherry-pick-approved Cherry pick PR approved by release team. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants