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

Support only set prof.active #393

Merged
merged 6 commits into from
Aug 28, 2024

Conversation

CalvinNeo
Copy link
Member

@CalvinNeo CalvinNeo commented Aug 28, 2024

What is changed and how it works?

Issue Number: Close #xxx

Introduce /debug/pprof/set_prof_active and /debug/pprof/set_prof_inactive only to control prof.active.

What's Changed:


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


a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
@ti-chi-bot ti-chi-bot bot added the size/M label Aug 28, 2024
@CalvinNeo
Copy link
Member Author

CalvinNeo commented Aug 28, 2024

NOTE the following design is too complicated, so we decide not to use

[calvin@10-2-12-79 ~]$ curl "http://127.0.0.1:5765/debug/pprof/heap_activate"
set prof.active = true[calvin@10-2-12-79 ~]$
[calvin@10-2-12-79 ~]$
[calvin@10-2-12-79 ~]$ curl "http://127.0.0.1:5765/debug/pprof/heap_activate?period=1"
activate heap profile success[calvin@10-2-12-79 ~]$
[calvin@10-2-12-79 ~]$ curl "http://127.0.0.1:5765/debug/pprof/heap_list"
[calvin@10-2-12-79 ~]$ curl "http://127.0.0.1:5765/debug/pprof/heap_list"
/DATA/disk4/luorongzhen/tidb-data/tiflash-5761/flash/heap-F9tLc3/000001.heap

Introduced a period argument, which means periodically dump heap file.

  • If call http://127.0.0.1:5765/debug/pprof/heap_activate?period=1, prof.activate would be set to true, and a dedicated thread will dump heap file at a given interval. Which is the previous path

  • If call http://127.0.0.1:5765/debug/pprof/heap_activate?period=0, or http://127.0.0.1:5765/debug/pprof/heap_activate would be set to true.

  • If call http://127.0.0.1:5765/debug/pprof/heap_deactivate?period=1, we will only stop the periodical dump thread. However, prof.activate would be set to true, if there is a previous profiling. Or remain false, if there is no profiling.

  • If call http://127.0.0.1:5765/debug/pprof/heap_deactivate?period=0 or http://127.0.0.1:5765/debug/pprof/heap_deactivate, prof.activate would be set to false. And the periodical dump thread will be stopped, if any.

a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/S and removed size/M labels Aug 28, 2024
a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/M and removed size/S labels Aug 28, 2024
@CalvinNeo
Copy link
Member Author

set prof.active succeed[calvin@10-2-12-79 ~]$ curl "http://127.0.0.1:5765/debug/pprof/set_prof_active"
set prof.active succeedcurl "http://127.0.0.1:5765/debug/pprof/heap_activate"
activate heap profile scurl "http://127.0.0.1:5765/debug/pprof/heap_deactivate"
deactivate heap profiletail /data4/luorongzhen/tidb-deploy/tiflash-5761/log/tiflash_tikv.log
[2024/08/28 15:44:38.016 +08:00] [INFO] [raft_client.rs:830] ["resolve store address ok"] [addr=10.2.12.79:5721] [store_id=1] [thread_id=398]
[2024/08/28 15:44:38.016 +08:00] [INFO] [raft_client.rs:699] ["server: new connection with tikv endpoint"] [store_id=1] [addr=10.2.12.79:5721] [thread_id=398]
[2024/08/28 15:44:38.023 +08:00] [INFO] [raft_client.rs:873] ["connection established"] [try_count=1] [msg_count=2] [cost=17.76472ms] [addr=10.2.12.79:5721] [store_id=1] [thread_id=398]
[2024/08/28 15:44:38.989 +08:00] [INFO] [kv.rs:794] ["batch_raft RPC is called, new gRPC stream established"] [source_store_id=Some(1)] [thread_id=7]
[2024/08/28 15:44:38.991 +08:00] [INFO] [raft.rs:1386] ["received a message with higher term from 10006"] ["msg type"=MsgAppend] [message_term=25] [term=24] [from=10006] [raft_id=10007] [region_id=10005] [thread_id=442]
[2024/08/28 15:44:38.991 +08:00] [INFO] [raft.rs:1151] ["became follower at term 25"] [term=25] [raft_id=10007] [region_id=10005] [thread_id=442]
[2024/08/28 15:44:38.991 +08:00] [INFO] [region.rs:125] [" 122:10005 0, peer changed"] [is_replicated=false] [role=Follower] [leader_id=10006] [region_id=10005] [thread_id=442]
[2024/08/28 15:44:46.913 +08:00] [INFO] [client.rs:799] ["set cluster version to 8.4.0-alpha"] [thread_id=102]
[2024/08/28 15:45:53.543 +08:00] [INFO] [profile.rs:171] ["periodical heap profiling is started"] [has_active=true] [thread_id=669]
[2024/08/28 15:45:57.288 +08:00] [INFO] [profile.rs:189] ["periodical heap profiling is canceled"] [active=true] [thread_id=669]
[calvin@10-2-12-79 ~]$
[calvin@10-2-12-79 ~]$ curl "http://127.0.0.1:5765/debug/pprof/set_prof_inactive"
set prof.active succeedcurl "http://127.0.0.1:5765/debug/pprof/heap_activate"
activate heap profile scurl "http://127.0.0.1:5765/debug/pprof/heap_deactivate"_prof_inactive"
deactivate heap profiletail /data4/luorongzhen/tidb-deploy/tiflash-5761/log/tiflash_tikv.log
[2024/08/28 15:44:38.989 +08:00] [INFO] [kv.rs:794] ["batch_raft RPC is called, new gRPC stream established"] [source_store_id=Some(1)] [thread_id=7]
[2024/08/28 15:44:38.991 +08:00] [INFO] [raft.rs:1386] ["received a message with higher term from 10006"] ["msg type"=MsgAppend] [message_term=25] [term=24] [from=10006] [raft_id=10007] [region_id=10005] [thread_id=442]
[2024/08/28 15:44:38.991 +08:00] [INFO] [raft.rs:1151] ["became follower at term 25"] [term=25] [raft_id=10007] [region_id=10005] [thread_id=442]
[2024/08/28 15:44:38.991 +08:00] [INFO] [region.rs:125] [" 122:10005 0, peer changed"] [is_replicated=false] [role=Follower] [leader_id=10006] [region_id=10005] [thread_id=442]
[2024/08/28 15:44:46.913 +08:00] [INFO] [client.rs:799] ["set cluster version to 8.4.0-alpha"] [thread_id=102]
[2024/08/28 15:45:53.543 +08:00] [INFO] [profile.rs:171] ["periodical heap profiling is started"] [has_active=true] [thread_id=669]
[2024/08/28 15:45:57.288 +08:00] [INFO] [profile.rs:189] ["periodical heap profiling is canceled"] [active=true] [thread_id=669]
[2024/08/28 15:46:33.355 +08:00] [INFO] [profile.rs:171] ["periodical heap profiling is started"] [has_active=false] [thread_id=669]
[2024/08/28 15:46:35.881 +08:00] [INFO] [profile.rs:189] ["periodical heap profiling is canceled"] [active=true] [thread_id=669]
[2024/08/28 15:46:35.881 +08:00] [INFO] [profile.rs:178] ["disable prof.active after periodical heap profiling"] [thread_id=669]

a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
Copy link

ti-chi-bot bot commented Aug 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Lloyd-Pottiger

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

@ti-chi-bot ti-chi-bot bot added the lgtm label Aug 28, 2024
Copy link

ti-chi-bot bot commented Aug 28, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-28 09:01:17.502629725 +0000 UTC m=+947272.637079846: ☑️ agreed by Lloyd-Pottiger.

@ti-chi-bot ti-chi-bot bot added the approved label Aug 28, 2024
@ti-chi-bot ti-chi-bot bot merged commit 3bf0400 into pingcap:raftstore-proxy Aug 28, 2024
5 checks passed
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.

2 participants