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

PCP-24: Improve the performance of the HTTP API for getting all regions #1837

Closed
nolouch opened this issue Oct 23, 2019 · 4 comments
Closed
Labels
component/api HTTP API. difficulty/medium Medium task. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/enhancement The issue or PR belongs to an enhancement.

Comments

@nolouch
Copy link
Contributor

nolouch commented Oct 23, 2019

Description

There is a test that dumps all regions(about 100w) that need about 20s. the test way:

# create regions
create table x(a int);
split table x between (0) and (10000000) regions 100000;
split table x between (10000000) and (20000000) regions 100000;
# dump regions
time curl http://127.0.0.1:2379/pd/api/v1/regions > region.json
real	0m22.316s
user	0m0.063s
sys	0m0.948s
....
# some debug logs
[2019/10/23 12:19:55.653 +00:00] [INFO] [region.go:154] ["[DEBUG] got all regions from core"] [cost=149.863003ms]
[2019/10/23 12:19:59.083 +00:00] [INFO] [region.go:157] ["[DEBUG] convert all regions to API regions"] [cost=3.430113877s]
[2019/10/23 12:20:17.575 +00:00] [INFO] [region.go:160] ["[DEBUG] send all regions to client"] [cost=18.491626948s]

and a memory pprof:
mem.pprof.zip
alloc_space svg:
profile001.svg.zip

Goal

  • Shorten request time
  • Reduce memory allocation

Difficulty

  • Medium

Score

  • 900

Mentor(s)

@nolouch nolouch added type/enhancement The issue or PR belongs to an enhancement. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. component/api HTTP API. PCP-S1 difficulty/medium Medium task. labels Oct 23, 2019
@breezewish breezewish changed the title PCP: Improve the performance of the HTTP API for getting all regions PCP-24: Improve the performance of the HTTP API for getting all regions Oct 28, 2019
@ekalinin
Copy link
Contributor

/pick-up-challenge

@sre-bot
Copy link
Contributor

sre-bot commented Nov 20, 2019

@ekalinin pick up issue success

@ekalinin
Copy link
Contributor

/pick-up-challenge

@sre-bot
Copy link
Contributor

sre-bot commented Nov 25, 2019

@ekalinin pick up issue success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/api HTTP API. difficulty/medium Medium task. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants