Skip to content

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

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

vshankar merged 1 commit into
ceph:mainfrom
MaxKellermann:CDir_should_split_faster

Conversation

@MaxKellermann

Copy link
Copy Markdown
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
Copy Markdown
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
Comment thread src/mds/CDir.cc Resolved
@vshankar

Copy link
Copy Markdown
Contributor

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 <[email protected]>
@MaxKellermann
MaxKellermann force-pushed the CDir_should_split_faster branch from 8187794 to 27feea1 Compare October 18, 2024 07:50

@vshankar vshankar 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.

@vshankar

Copy link
Copy Markdown
Contributor

jenkins retest this please

@vshankar

Copy link
Copy Markdown
Contributor

jenkins test make check

@batrick

batrick commented Oct 31, 2024

Copy link
Copy Markdown
Member

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