Skip to content

mgr: Add per-module performance counters to mgr - #61131

Merged
NitzanMordhai merged 2 commits into
ceph:mainfrom
NitzanMordhai:wip-nitzan-mgr-modules-perf-counts
May 26, 2026
Merged

NitzanMordhai merged 2 commits into
ceph:mainfrom
NitzanMordhai:wip-nitzan-mgr-modules-perf-counts

Conversation

@NitzanMordhai

@NitzanMordhai NitzanMordhai commented Dec 18, 2024 •

Copy link
Copy Markdown
Contributor

This commit introduces performance counters for individual Ceph mgr modules.
These counters allow monitoring module behavior, debugging latency issues,
and identifying performance bottlenecks, all without modifying the modules themselves.

The following counters are now exposed under:

ceph daemon mgr. perf dump

Example structure:

"mgr_module_<module_name>": {
"notify_avg_usec": { <- Average time spent handling notify events
"sum": 0,
"avgcount": 0
},
"cmd_avg_usec": { <- Average time spent processing CLI/admin commands
"sum": 0,
"avgcount": 0
},
"alive": 1 <- Module is alive (1 = running, 0 = exited)
"cpu_usage": 0, <- CPU usage in percent
"mem_rss_change": 0, <- Memory RSS change in bytes
"mem_rss_current": 512045056, <- Memory RSS current in bytes
"serve_cpu_usage": 0 <- CPU usage by the serve thread of the module
},

Signed-off-by: Nitzan Mordechai [email protected]

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Feb 16, 2025
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution!

@github-actions

github-actions Bot commented Apr 9, 2025

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@github-actions github-actions Bot removed the stale label Apr 9, 2025
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-mgr-modules-perf-counts branch from 9843780 to f9e8fae Compare April 15, 2025 05:27
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Jun 14, 2025
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-mgr-modules-perf-counts branch from f9e8fae to f23d823 Compare June 26, 2025 09:23
@NitzanMordhai NitzanMordhai changed the title mgr: Add performance counters support for modules mgr: Add per-module performance counters to mgr Jun 26, 2025
@NitzanMordhai

Copy link
Copy Markdown
Contributor Author

i made some changes to the PR, I removed the memory and CPU since it didn't show correct results

@github-actions github-actions Bot removed the stale label Jun 26, 2025
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-mgr-modules-perf-counts branch from f23d823 to cc4d1d7 Compare July 2, 2025 13:37
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-mgr-modules-perf-counts branch from cc4d1d7 to 417ab97 Compare July 2, 2025 13:48
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@NitzanMordhai

Copy link
Copy Markdown
Contributor Author

@rzarzynski, I made the changes. There was also an issue with locks in the monitoring_loop that i needed to fix

@sseshasa sseshasa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Had a few general comments in the first pass. I will review it more in-depth.

Comment thread src/common/Finisher.h Resolved
Comment thread ThreadMonitor.h Resolved
Comment thread src/common/options/mgr.yaml.in Resolved

@sseshasa sseshasa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added a few more comments. Will continue the review.

Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.h Resolved
Comment thread src/mgr/ThreadMonitor.h Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved

@sseshasa sseshasa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added a few comments around the main monitoring loop. Will continue the review based on the outcome of existing comments.

Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-mgr-modules-perf-counts branch 2 times, most recently from cea0204 to e209c60 Compare April 26, 2026 10:45
@NitzanMordhai
NitzanMordhai requested a review from sseshasa April 26, 2026 10:47

@sseshasa sseshasa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@NitzanMordhai I did another pass over this PR and added a few comments. PTAL.

Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.h Resolved
Comment thread src/mgr/ThreadMonitor.h Resolved
Comment thread src/mgr/ThreadMonitor.h Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ActivePyModules.cc Resolved
Comment thread src/mgr/ActivePyModules.cc Resolved
Comment thread src/mgr/ActivePyModules.cc Resolved
Comment thread src/mgr/MgrStandby.h Resolved
Comment thread src/mgr/PyModuleRunner.cc Resolved
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-mgr-modules-perf-counts branch from e209c60 to 1db8e98 Compare April 29, 2026 14:25
@NitzanMordhai
NitzanMordhai requested a review from sseshasa April 29, 2026 14:28
@NitzanMordhai

Copy link
Copy Markdown
Contributor Author

@sseshasa, please see my updates and answers! thanks

@sseshasa sseshasa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Almost there. Added a few minor comments. PTAL. Thanks!

Comment thread src/mgr/MgrStandby.h Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.cc Resolved
Comment thread src/mgr/ThreadMonitor.h Resolved
Comment thread src/mgr/ThreadMonitor.h

#pragma once
#include "PyModule.h"
#include <unistd.h>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor nit: The includes from standard libraries should come first, followed by common/* and then the rest.

@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-mgr-modules-perf-counts branch from 1db8e98 to 2a02f7a Compare April 30, 2026 08:17
@NitzanMordhai
NitzanMordhai requested a review from sseshasa April 30, 2026 08:17

@sseshasa sseshasa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. A lingering minor nit.

Comment thread src/mgr/ThreadMonitor.h
Comment on lines +16 to +17
#include "PyModule.h"
#include "common/debug.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I meant the following as I see this convention being followed in other places,

Suggested change
#include "PyModule.h"
#include "common/debug.h"
#include <unistd.h>$
#include "common/debug.h"
#include "PyModule.h"

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-mgr-modules-perf-counts branch from 2a02f7a to 60b3919 Compare May 25, 2026 07:12
This commit introduces performance counters for individual Ceph mgr modules.
These counters allow monitoring module behavior, debugging latency issues,
and identifying performance bottlenecks, all without modifying the modules themselves.

The following counters are now exposed under:
  > ceph daemon mgr.<id> perf dump

Example structure:
"mgr_module_<module_name>": {
    "notify_avg_usec": {     <- Average time spent handling notify events
        "avgcount": 0,
        "sum": 0
    },
    "cmd_avg_usec": {        <- Average time spent processing CLI/admin commands
        "avgcount": 0,
        "sum": 0
    },
    "serve_avg_usec": {      <- Average time spent in module serve loop (if applicable)
        "avgcount": 0,
        "sum": 0
    },
    "alive": 1               <- Module is alive (1 = running, 0 = exited)
    "cpu_usage": 0,          <- CPU usage in percent
    "mem_rss_change": 0,     <- Memory RSS change in bytes
    "mem_rss_current": 490737664 <- Memory RSS current in bytes

}

Signed-off-by: Nitzan Mordechai <[email protected]>

Conflicts:
  src/mgr/ActivePyModules.cc - finisher.queue changed by 63859, adding py_module to the parameter list
  src/mgr/PyModuleRegistry.cc - check_all_modules_started added by 63859
…able\perf counts

Simple test to enable \ disable and get counters dump
for checking perf counters.

Signed-off-by: Nitzan Mordechai <[email protected]>
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-mgr-modules-perf-counts branch from 60b3919 to 54d3b93 Compare May 25, 2026 07:48
@NitzanMordhai

Copy link
Copy Markdown
Contributor Author

Test /a/skanta-2026-05-08_15:03:45-rados-wip-bharath17-testing-2026-05-08-0400-distro-default-trial/199166/teuthology.log faile with:
2026-05-08T15:17:25.107 INFO:teuthology.orchestra.run.trial030.stderr:available_objects: 1001 in_flight_objects: 2 total objects: 1003 in_flight 2 2026-05-08T15:17:25.297 INFO:teuthology.orchestra.run.trial030.stderr:terminate called after throwing an instance of 'std::future_error' 2026-05-08T15:17:25.297 INFO:teuthology.orchestra.run.trial030.stderr: what(): std::future_error: Future already retrieved 2026-05-08T15:17:25.297 INFO:teuthology.orchestra.run.trial030.stderr:*** Caught signal (Aborted) ** 2026-05-08T15:17:25.297 INFO:teuthology.orchestra.run.trial030.stderr: in thread 7f2c15633c00 thread_name:ceph_test_objec 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: ceph version 21.0.0-1200-g95e8a733 (95e8a733c5a4b7b16e287d28a4315a3ed511282d) umbrella (dev - RelWithDebInfo) 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: 1: /lib64/libc.so.6(+0x3fc30) [0x7f2c13a3fc30] 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: 2: /lib64/libc.so.6(+0x8d03c) [0x7f2c13a8d03c] 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: 3: raise() 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: 4: abort() 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: 5: /lib64/libstdc++.so.6(+0xa1b21) [0x7f2c154a1b21] 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: 6: /lib64/libstdc++.so.6(+0xad53c) [0x7f2c154ad53c] 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: 7: /lib64/libstdc++.so.6(+0xad5a7) [0x7f2c154ad5a7] 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: 8: /lib64/libstdc++.so.6(+0xad809) [0x7f2c154ad809] 2026-05-08T15:17:25.298 INFO:teuthology.orchestra.run.trial030.stderr: 9: (std::__throw_future_error(int)+0x3f) [0x7f2c154a475b] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 10: (Finisher::start()+0x184) [0x7f2c146a36d4] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 11: (BlueStore::_kv_start()+0x38) [0x885d08] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 12: (BlueStore::_fsck(BlueStore::FSCKDepth, bool)+0x2e8) [0x85c4d8] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 13: ceph_test_objectstore() [0x6b4bc2] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 14: (StoreTestBase::doSyntheticTest(int, int, unsigned long, unsigned long, unsigned long)+0x585) [0x6b9c15] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 15: (testing::Test::Run()+0xe3) [0x961963] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 16: (testing::TestInfo::Run()+0x41d) [0x961e1d] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 17: ceph_test_objectstore() [0x986043] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 18: (testing::internal::UnitTestImpl::RunAllTests()+0x58f) [0x97bd7f] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 19: (testing::UnitTest::Run()+0x8a) [0x9790fa] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 20: main() 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 21: /lib64/libc.so.6(+0x2a610) [0x7f2c13a2a610] 2026-05-08T15:17:25.299 INFO:teuthology.orchestra.run.trial030.stderr: 22: __libc_start_main() 2026-05-08T15:17:25.300 INFO:teuthology.orchestra.run.trial030.stderr: 23: _start()
fixed in the PR

@NitzanMordhai

Copy link
Copy Markdown
Contributor Author

@NitzanMordhai
NitzanMordhai merged commit 2c3d140 into ceph:main May 26, 2026
5 of 6 checks passed
@NitzanMordhai
NitzanMordhai deleted the wip-nitzan-mgr-modules-perf-counts branch May 26, 2026 09:31
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.

6 participants