Skip to content

mds: return as early as possible from CDir::should_split_fast()#60236

Merged
vshankar merged 1 commit intoceph:mainfrom
MaxKellermann:CDir_should_split_faster
Nov 4, 2024
Merged

mds: return as early as possible from CDir::should_split_fast()#60236
vshankar merged 1 commit intoceph:mainfrom
MaxKellermann:CDir_should_split_faster

Conversation

@MaxKellermann
Copy link
Member

All we want to know is whether we're above the fast_limit; if we're above that, we don't need to know how many exactly.

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)

@github-actions github-actions bot added the cephfs Ceph File System label Oct 10, 2024
@MaxKellermann MaxKellermann force-pushed the CDir_should_split_faster branch from f84c7a0 to 8187794 Compare October 10, 2024 18:40
@MaxKellermann
Copy link
Member Author

Added an [[unlikely]] attribute. In this loop, it could make a (tiny) difference.

@vshankar vshankar requested a review from a team October 16, 2024 05:58
@vshankar vshankar changed the title MDS/CDir: return as early as possible from CDir::should_split_fast() mds: return as early as possible from CDir::should_split_fast() Oct 16, 2024
@vshankar
Copy link
Contributor

This PR is under test in https://tracker.ceph.com/issues/68578.

All we want to know is whether we're above the `fast_limit`; if we're
above that, we don't need to know how many exactly.

By returning early instead of iterating over all entries, a lot of CPU
time can be saved.  In a microbenchmark where `fio` was used to create
thousands of files, the CPU usage of `CDir::should_split_fast()` went
from 6% to less than 1% in the `perf report`.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
@MaxKellermann MaxKellermann force-pushed the CDir_should_split_faster branch from 8187794 to 27feea1 Compare October 18, 2024 07:50
Copy link
Contributor

@vshankar vshankar left a comment

Choose a reason for hiding this comment

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

@vshankar
Copy link
Contributor

jenkins retest this please

@vshankar
Copy link
Contributor

jenkins test make check

@batrick
Copy link
Member

batrick commented Oct 31, 2024

jenkins test make check

@vshankar vshankar merged commit 2505e27 into ceph:main Nov 4, 2024
@MaxKellermann MaxKellermann deleted the CDir_should_split_faster branch November 4, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants