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

enable but inact memory profiling #1272

Merged
merged 2 commits into from
Apr 1, 2021

Conversation

hicqu
Copy link
Contributor

@hicqu hicqu commented Apr 1, 2021

Signed-off-by: qupeng qupeng@pingcap.com

What problem does this PR solve?

Close #1270 and tikv/tikv#9538.

Check List

Tests

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release notes:

NONE

Signed-off-by: qupeng <qupeng@pingcap.com>
@CLAassistant
Copy link

CLAassistant commented Apr 1, 2021

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot requested a review from lucklove April 1, 2021 08:32
@ti-chi-bot ti-chi-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 1, 2021
@lucklove
Copy link
Member

lucklove commented Apr 1, 2021

/lgtm

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lucklove

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 1, 2021
@lucklove
Copy link
Member

lucklove commented Apr 1, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: d65016d

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 1, 2021
@lucklove
Copy link
Member

lucklove commented Apr 1, 2021

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 1, 2021
@lucklove
Copy link
Member

lucklove commented Apr 1, 2021

To fix tikv/tikv#9538, maybe you want to change tiup-playground instead of tiup-cluster?

@hicqu
Copy link
Contributor Author

hicqu commented Apr 1, 2021

To fix tikv/tikv#9538, maybe you want to change tiup-playground instead of tiup-cluster?

@lucklove all TiKV clusters have the problem, regardless they are deployed with playground or cluster.

This PR is only for cluster, do you have any idea for setting environment variables for playground?

@hicqu
Copy link
Contributor Author

hicqu commented Apr 1, 2021

BTW I will do a bench for this change. The result will be post later.

@lucklove
Copy link
Member

lucklove commented Apr 1, 2021

To fix tikv/tikv#9538, maybe you want to change tiup-playground instead of tiup-cluster?

@lucklove all TiKV clusters have the problem, regardless they are deployed with playground or cluster.

This PR is only for cluster, do you have any idea for setting environment variables for playground?

TiUP set envs for each component here.

  1. You can add a Envs []string filed for PrepareCommandParams
  2. And add envs = append(envs, p.Envs) on L224.
  3. Then add envs arg for NewComponentProcess
  4. Add your env when call NewComponentProcess in TiKVInstance

@codecov-io
Copy link

Codecov Report

Merging #1272 (d28621f) into master (c9b58c9) will increase coverage by 27.37%.
The diff coverage is n/a.

❗ Current head d28621f differs from pull request most recent head d65016d. Consider uploading reports for the commit d65016d to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1272       +/-   ##
===========================================
+ Coverage   26.28%   53.66%   +27.37%     
===========================================
  Files         263      289       +26     
  Lines       18840    20780     +1940     
===========================================
+ Hits         4953    11152     +6199     
+ Misses      13115     7891     -5224     
- Partials      772     1737      +965     
Flag Coverage Δ
cluster 45.14% <ø> (?)
dm 26.70% <ø> (?)
integrate 48.16% <ø> (+31.62%) ⬆️
playground 3.11% <ø> (?)
tiup 16.56% <ø> (+0.02%) ⬆️
unittest 22.81% <ø> (ø)

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

Impacted Files Coverage Δ
pkg/logger/logger.go 100.00% <0.00%> (ø)
components/playground/instance/ticdc.go 0.00% <0.00%> (ø)
pkg/cluster/operation/scale_in.go 58.27% <0.00%> (ø)
components/playground/instance/process.go 0.00% <0.00%> (ø)
pkg/logger/debug.go 16.66% <0.00%> (ø)
pkg/cluster/operation/check.go 47.76% <0.00%> (ø)
pkg/logger/audit.go 53.33% <0.00%> (ø)
pkg/cluster/operation/telemetry.go 0.00% <0.00%> (ø)
components/playground/instance/tiflash.go 0.00% <0.00%> (ø)
pkg/cluster/operation/action.go 60.63% <0.00%> (ø)
... and 203 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c9b58c9...d65016d. Read the comment docs.

@hicqu
Copy link
Contributor Author

hicqu commented Apr 1, 2021

I have benchmarked it, here is the result:

without any environment variables:
$ cargo bench
running 7 tests
test bench_malloc_128k ... bench:          39 ns/iter (+/- 7)
test bench_malloc_128m ... bench:       4,134 ns/iter (+/- 412)
test bench_malloc_1g   ... bench:       8,478 ns/iter (+/- 2,356)
test bench_malloc_1k   ... bench:          48 ns/iter (+/- 5)
test bench_malloc_1m   ... bench:          37 ns/iter (+/- 5)
test bench_malloc_8k   ... bench:          30 ns/iter (+/- 4)
test bench_malloc_8m   ... bench:          35 ns/iter (+/- 3)
with `export MALLOC_CONF="prof:true,prof_active:true,prof.active:false"`
$ cargo bench
running 7 tests
test bench_malloc_128k ... bench:          37 ns/iter (+/- 16)
test bench_malloc_128m ... bench:       4,136 ns/iter (+/- 605)
test bench_malloc_1g   ... bench:       8,426 ns/iter (+/- 1,134)
test bench_malloc_1k   ... bench:          44 ns/iter (+/- 6)
test bench_malloc_1m   ... bench:          35 ns/iter (+/- 3)
test bench_malloc_8k   ... bench:          32 ns/iter (+/- 3)
test bench_malloc_8m   ... bench:          37 ns/iter (+/- 5)

There aren't obvious dirrerences.

The reason is memory profiling is compiled for both 2 cases, and it's not actived in both 2 cases.

Signed-off-by: qupeng <qupeng@pingcap.com>
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed status/can-merge Indicates a PR has been approved by a committer. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 1, 2021
@lucklove lucklove added this to the v1.4.1 milestone Apr 1, 2021
@lucklove
Copy link
Member

lucklove commented Apr 1, 2021

/hold cancel

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 1, 2021
@lucklove
Copy link
Member

lucklove commented Apr 1, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: c8f2b81

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 1, 2021
@ti-chi-bot ti-chi-bot merged commit e280d83 into pingcap:master Apr 1, 2021
@hicqu hicqu deleted the enable-and-inactive-prof branch April 1, 2021 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enable but deactive memory profiling for TiKV
5 participants