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 heap profiling #376

Merged
merged 3 commits into from
Jul 12, 2024
Merged

Conversation

CalvinNeo
Copy link
Member

@CalvinNeo CalvinNeo commented Jul 10, 2024

What is changed and how it works?

Issue Number: Close #xxx

What's Changed:

  1. Enable heap_activate and heap_deactivate and heap_list API
    Note that TiKV no longer uses these APIs. They have switched to a continuous heap profiling.
    We can switch later to that, after we are assured that the deadlock problem is resolved by the latest pprof-rs.
  2. We no longer uses lg_prof_interval, since it can't be modified at runtime.
  3. It should cowork with TiFlash: Enable and inactive prof when start tiup#2437

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Release note


Signed-off-by: CalvinNeo <[email protected]>
@ti-chi-bot ti-chi-bot bot added the size/L label Jul 10, 2024
Signed-off-by: CalvinNeo <[email protected]>
@CalvinNeo
Copy link
Member Author

/retest

Comment on lines 12 to 13
&mut value as *mut _ as *mut _,
&mut len,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should allocate another local value for storing the "old_value" get from mallctl

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to "write" mode

@CalvinNeo CalvinNeo requested a review from JaySon-Huang July 11, 2024 07:44
a
Signed-off-by: CalvinNeo <[email protected]>
@CalvinNeo
Copy link
Member Author

/retest

1 similar comment
@CalvinNeo
Copy link
Member Author

/retest

@CalvinNeo
Copy link
Member Author

$ curl  "http://10.2.12.81:5765/debug/pprof/heap_activate"
activate heap profile success#
$ curl  "http://10.2.12.81:5765/debug/pprof/heap_list"
/DATA/disk4/luorongzhen/tidb-data/tiflash-5761/flash/heap-CaYe7c/000001.heap		2024-07-11 15:52:31#
$ ls -halt /DATA/disk4/luorongzhen/tidb-data/tiflash-5761/flash/heap-CaYe7c/000001.heap
-rw-r--r-- 1 tidb tidb 208K Jul 11 15:52 /DATA/disk4/luorongzhen/tidb-data/tiflash-5761/flash/heap-CaYe7c/000001.heap

Log

[2024/07/11 15:51:31.142 +08:00] [INFO] [profile.rs:149] ["periodical heap profiling is started"] [thread_id=669]
[2024/07/11 15:51:48.987 +08:00] [INFO] [profile.rs:271] ["list_heap_profiles gets 0 items"] [thread_id=668]
[2024/07/11 15:52:01.131 +08:00] [INFO] [profile.rs:271] ["list_heap_profiles gets 0 items"] [thread_id=668]
[2024/07/11 15:52:18.494 +08:00] [INFO] [profile.rs:271] ["list_heap_profiles gets 0 items"] [thread_id=669]
[2024/07/11 15:52:31.161 +08:00] [INFO] [profile.rs:285] ["a heap profile is dumped to /DATA/disk4/luorongzhen/tidb-data/tiflash-5761/flash/heap-CaYe7c/000001.heap"] [thread_id=668]

@CalvinNeo
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot added the lgtm label Jul 12, 2024
Copy link

ti-chi-bot bot commented Jul 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JinheLin

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

ti-chi-bot bot commented Jul 12, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-12 03:13:45.584705785 +0000 UTC m=+586522.819939898: ☑️ agreed by JinheLin.

@ti-chi-bot ti-chi-bot bot added the approved label Jul 12, 2024
@ti-chi-bot ti-chi-bot bot merged commit 87b6682 into pingcap:raftstore-proxy Jul 12, 2024
3 of 4 checks passed
CalvinNeo added a commit that referenced this pull request Jul 24, 2024
CalvinNeo added a commit that referenced this pull request Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants