Skip to content

seastore: Record slow transaction histograms - #69730

Merged
Matan-B merged 6 commits into
ceph:mainfrom
Matan-B:wip-matanb-seastore-metrics-txn
Jul 13, 2026
Merged

Matan-B merged 6 commits into
ceph:mainfrom
Matan-B:wip-matanb-seastore-metrics-txn

Conversation

@Matan-B

@Matan-B Matan-B commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This is a follow up to #69281 which adds a transaction breakdown metrics.
However, in order to better narrow down the histograms we need to collect stats for the tail txns only.
This will allow us to see which phases draw the most weight in these txns (over 5ms and over 10ms).

Also, adds a collection lock hold vs wait timings to measure queue depth (actual work vs waiting times).

For context: https://gist.github.com/Matan-B/44b17e2599bb409ca9d96a41fff390ae

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

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@Matan-B
Matan-B requested a review from a team as a code owner June 25, 2026 08:37
@Matan-B Matan-B added this to Crimson Jun 25, 2026
@Matan-B Matan-B moved this to Awaits review in Crimson Jun 25, 2026
Comment thread src/crimson/os/seastore/seastore.cc Resolved
@Matan-B
Matan-B requested review from a team, amathuria and ronen-fr June 29, 2026 06:57

@xxhdx1985126 xxhdx1985126 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Generally, LGTM. If detailed time sampling impacts the performance significantly, we can add some dedicated compiling flag and wrap the time sampling code with it.

@Matan-B

Matan-B commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Generally, LGTM. If detailed time sampling impacts the performance significantly, we can add some dedicated compiling flag and wrap the time sampling code with it.

I've added the compile flag in #69670 as this adds counters for each lookup/comparison.
For this PR, the overhead should be much lower. We're adding two extra histogram sets (3x12 histograms total instead of 12) and only updating the additional ones for slow/very-slow transactions.
Also, I expect we'll be spending more time analyzing slow transactions in the near future - so it would be useful to have these metrics available by default. wdyt?

@Matan-B

Matan-B commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@xxhdx1985126

Copy link
Copy Markdown
Member

Generally, LGTM. If detailed time sampling impacts the performance significantly, we can add some dedicated compiling flag and wrap the time sampling code with it.

I've added the compile flag in #69670 as this adds counters for each lookup/comparison. For this PR, the overhead should be much lower. We're adding two extra histogram sets (3x12 histograms total instead of 12) and only updating the additional ones for slow/very-slow transactions. Also, I expect we'll be spending more time analyzing slow transactions in the near future - so it would be useful to have these metrics available by default. wdyt?

I think we can use seastar::lowres_(system_)clock to minimize the cpu overhead, what do you think?

@Matan-B Matan-B moved this from Awaits review to Tested in Crimson Jul 8, 2026
@Matan-B

Matan-B commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor Author

I think we can use seastar::lowres_(system_)clock to minimize the cpu overhead, what do you think?

Agree, will update.

edit: switched all other timings to seastar lowres, its far less granular (~0.5ms cached now() ) but it is good enough for the purpose here and avoids extra cpu cycles.
output of histograms is now also in ms for that purpose. If this proves to be not enough we can fallback to std once again.

@Matan-B Matan-B moved this from Tested to In Progress in Crimson Jul 8, 2026
@Matan-B
Matan-B force-pushed the wip-matanb-seastore-metrics-txn branch from 69145c9 to bb0d9be Compare July 8, 2026 11:34
@Matan-B

Matan-B commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

example:

            "seastore_do_transaction_stage_lat": {
                "shard": "0",
                "shard_store_index": "0",
                "stage": "collock_hold",
                "tail": "slow",
                "value": {
                    "sum": 4272.8715629999961,
                    "count": 377,
                    "buckets": [
                        {
                            "le": 1,
                            "count": 29
                        },
                        {
                            "le": 1.5,
                            "count": 0
                        },
                        {
                            "le": 2,
                            "count": 0
                        },
                        {
                            "le": 3,
                            "count": 1
                        },
                        {
                            "le": 5,
                            "count": 9
                        },
                        {
                            "le": 7.5,
                            "count": 30
                        },
                        {
                            "le": 10,
                            "count": 38
                        },
                        {
                            "le": 15,
                            "count": 241
                        },
                        {
                            "le": 20,
                            "count": 22
                        },
                        {
                            "le": 30,
                            "count": 6
                        },
                        {
                            "le": 50,
                            "count": 1
                        },
                        {
                            "le": 100,
                            "count": 0
                        },
                        {
                            "le": "+Inf",
                            "count": 377
                        }
                    ]

Matan-B added 5 commits July 8, 2026 11:56
collock_wait already tells us how long a transaction waits for the
per-collection ordering_lock, but not how long the lock is then held.

comparing hold to wait time can point at either slow in-lock or
contention of a hot pg.

Signed-off-by: Matan Breizman <[email protected]>
on hot shards a small fraction of transactions dominate latency,collecting
one histogram for all is not enough.

Add two more histograms of the same strcutre for txns that take more
than 5ms and more than 10ms.

Signed-off-by: Matan Breizman <[email protected]>
do_transaction timing runs on the hot path and used for
latency histograms. std::chrono::steady_clock's per-call clock_gettime
is too costly for these needs. seastar::lowres_clock uses cached now()
at every task_quota poll (~0.5ms) - which is granular enough.

Signed-off-by: Matan Breizman <[email protected]>
The do_transaction latency histograms now source their samples from
seastar::lowres_clock (~0.5ms default). Drop the sub 1ms buckets.

Signed-off-by: Matan Breizman <[email protected]>
The do_transaction latency histograms were bucketed and summed in
microseconds, but with seastar::lowres_clock (~task_quota, ~0.5ms) and
the ms-scale buckets we keep - microsecond values only add noise to the
exported numbers.

Signed-off-by: Matan Breizman <[email protected]>
@Matan-B
Matan-B force-pushed the wip-matanb-seastore-metrics-txn branch from bb0d9be to 8e5606a Compare July 8, 2026 12:03
@xxhdx1985126
xxhdx1985126 self-requested a review July 8, 2026 12:20
@perezjosibm

perezjosibm commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor
PR=wip-perezjos-crimson-only-09-07-2026-PR69730
$ teuthology-suite -s crimson-rados -p 101 --force-priority -c $PR  -f debug  --filter-out rgw  --filter seastore --suite-branch main --suite-repo https://github.com/ceph/ceph.git
2026-07-13 09:24:36,590.590 INFO:teuthology.suite.run:Test results viewable at 

https://pulpito-ng.ceph.com/jjperez-2026-07-13_09:19:53-crimson-rados-wip-perezjos-crimson-only-09-07-2026-PR69730-distro-debug-trial/

  • As discussed via slack:
teuthology-kill -o jjperez -m trial -r jjperez-2026-07-13_09:19:53-crimson-rados-wip-perezjos-crimson-only-09-07-2026-PR69730-distro-debug-trial
Traceback (most recent call last):
 File "/tank/home/jjperez/teuthology/virtualenv/bin/teuthology-kill", line 10, in <module>
   sys.exit(main())
            ^^^^^^
 File "/tank/home/jjperez/teuthology/scripts/kill.py", line 41, in main
   teuthology.kill.main(args)
 File "/tank/home/jjperez/teuthology/teuthology/kill.py", line 42, in main
   kill_run(
 File "/tank/home/jjperez/teuthology/teuthology/kill.py", line 52, in kill_run
   run_info = report.ResultsReporter().get_run(run_name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/tank/home/jjperez/teuthology/teuthology/report.py", line 389, in get_run
   response.raise_for_status()
 File "/tank/home/jjperez/teuthology/.venv/lib/python3.12/site-packages/requests/models.py", line 1028, in raise_for_status
   raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://paddles-paddles.apps.pok.os.sepia.ceph.com/runs/jjperez-2026-07-13_09:19:53-crimson-rados-wip-perezjos-crimson-only-09-07-2026-PR69730-distro-debug-trial/

@perezjosibm perezjosibm moved this from Needs QA to QA in Progress in Crimson Jul 9, 2026
@Matan-B

Matan-B commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author
  • Shaman build (in progress): wip-perezjos-crimson-only-09-07-2026-PR69730

Thank you!

@Matan-B

Matan-B commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Comment thread src/crimson/os/seastore/seastore.cc Resolved
@perezjosibm perezjosibm moved this from QA in Progress to Tested in Crimson Jul 13, 2026
@Matan-B
Matan-B merged commit 913357c into ceph:main Jul 13, 2026
6 checks passed
@Matan-B Matan-B moved this from Tested to Merged (Main) in Crimson Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Merged (Main)

Development

Successfully merging this pull request may close these issues.

5 participants