Skip to content

mds: add ceph.dir.bal.mask vxattr for MDS Balancer - #52373

Open
yongseokoh wants to merge 3 commits into
ceph:mainfrom
yongseokoh:wip-61777
Open

yongseokoh wants to merge 3 commits into
ceph:mainfrom
yongseokoh:wip-61777

Conversation

@yongseokoh

Copy link
Copy Markdown
Contributor

tracker: https://tracker.ceph.com/issues/61777

Introduction
This PR introduces the ceph.dir.bal.mask vxattr, which is an option to rebalance a subtree within specific active MDSs. Similar to the CPU mask, this feature enables load balancing of specific directories across multiple MDS ranks. It is especially useful for fine-tuning and improving performance in various scenarios. Previously, the bal_rank_mask in #43284 supports isolating unpinned subtrees under the root directory ('/') to a specific MDS rank. However, with this new option vxattr, it becomes possible to isolate specific subdirectories to designated MDS ranks. By introducing the ceph.dir.bal.mask vxattr, this PR empowers Ceph administrators with enhanced control and flexibility for optimizing performance and fine-tuning their deployments.

Use Cases
The first is when it is difficult to pin a subdir to one MDS rank. The /home/images directory exists. There are /0 to /99 directories under it, and 10 million image files are stored in each directory. In this case, it is difficult to pin the entire images directory to one MDS rank. Also, pinning the huge 100 directories manually or using ephemeral pinning is not an easy task. Therefore, efficient resource management is possible by using ceph.dir.bal.mask.

Second, when there are several large directories such as /home/images, performance can be optimized by distributing them to different MDS rank groups using ceph.dir.bal.mask. Since the existing mdsmap’s bal_rank_mask isolated the entire ‘/’ directory to specific ranks, it can affect performance due to each other's migration overhead. For example, mdsmap’s bal_rank_mask is set to 0xf and /home/images and /home/backups large directories exist. If the load on /home/images instantaneously increases, metadata distribution occurs across ranks 0 to 3. Thus, users of /home/backups may be affected by noisy neighbors unnecessarily. If the two directories are set to MDS rank 0-1 (ceph.dir.bal.mask 0x3) and 2-3 (ceph.dir.bal.mask 0xC) respectively, the effect on each other can be minimized. Like this, it can be used efficiently for various directories.

How to use

# / root is distributed within MDS rank 0 to 3
# it overrides mdsmap bal_rank_mask value
setfattr -n ceph.dir.bal.mask -v 0x0f /

# /home/images subdir is distributed within MDS rank 1 and 2
setfattr -n ceph.dir.bal.mask -v 0x06 /home/images

# /home/images subdir is distributed within MDS rank 3 and 4
setfattr -n ceph.dir.bal.mask -v 0x18 /home/backups

# remove values and they will obey parent the value or mdsmap bal_rank_mask
setfattr -n ceph.dir.bal.mask -v -1 /home/images
setfattr -n ceph.dir.bal.mask -v -1 /home/backups

# /home/images is placed only on MDS rank1 (similar to ceph.dir.dir)
setfattr -n ceph.dir.bal.mask -v 0x02 /home/images

Contribution Guidelines

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

@yongseokoh
yongseokoh requested a review from a team as a code owner July 10, 2023 06:18
@github-actions github-actions Bot added cephfs Ceph File System core mon labels Jul 10, 2023
@vshankar vshankar self-assigned this Aug 17, 2023

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

Few things:

  • Please add the PR discussion to your commit message.
  • Because the bitset is 256 bits, it's not generally easy to compute the xattr value for the caller. I think it would be helpful to have the MDS compute the value by allowing something like setfattr -n ceph.dir.bal.mak -v 0,1,3,15 dir/ such that the MDS will do the bitwise or of those bits.
  • I'd like to see some tests in qa/tasks/cephfs/test_exports.py. You can use vstart_runner.py to test.
  • There should be some docs added to explain this and the MDSMap bal rank mask. Which should users prefer and when? Is it valid to set the rank mask on the root directory? Are values inherited or override-able?

Comment thread src/mon/FSCommands.cc Resolved
Comment thread src/include/cephfs/types.h Resolved
Comment thread src/mon/FSCommands.cc Outdated
if (r != 0) {
return r;
}
std::bitset<MAX_MDS> rank_mask = std::bitset<MAX_MDS>(bin_string);

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.

Please carve out this into a separate commit since this is through the fs set interface (for mdsmap) rather than the vxattr interface proposal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will split the PR once the discussion about restrictionon rank0 is resolved.
#52373 (comment)

Comment thread src/mds/CInode.cc Resolved
@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

@yongseokoh

Copy link
Copy Markdown
Contributor Author

@batrick @vshankar Please review my changes.

Few things:

  • Please add the PR discussion to your commit message.

Done.

  • Because the bitset is 256 bits, it's not generally easy to compute the xattr value for the caller. I think it would be helpful to have the MDS compute the value by allowing something like setfattr -n ceph.dir.bal.mak -v 0,1,3,15 dir/ such that the MDS will do the bitwise or of those bits.

I agree. It is not easy to calculate numerous bits and configure the bitfield.

  • I'd like to see some tests in qa/tasks/cephfs/test_exports.py. You can use vstart_runner.py to test.

Test cases for ceph.dir.bal.mask were implemented in test_exports.py.

  • There should be some docs added to explain this and the MDSMap bal rank mask. Which should users prefer and when? Is it valid to set the rank mask on the root directory? Are values inherited or override-able?

How to use ceph.dir.bal.mask is explained in the document.

@idryomov
idryomov removed the request for review from a team September 16, 2023 13:21
@idryomov idryomov removed the rbd label Sep 16, 2023
@yongseokoh

Copy link
Copy Markdown
Contributor Author

jenkins retest this please

@yongseokoh
yongseokoh force-pushed the wip-61777 branch 2 times, most recently from 4aca9f4 to 53a786c Compare September 18, 2023 04:55
@yongseokoh

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@yongseokoh

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

12 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@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 13, 2026
@anthonyeleven

Copy link
Copy Markdown
Contributor

This seems really useful, would love for someone to pick it back up

@github-actions github-actions Bot removed the stale label Jun 13, 2026
@vshankar

Copy link
Copy Markdown
Contributor

This seems really useful, would love for someone to pick it back up

Yes, for Vampire 👍

@vshankar
vshankar force-pushed the wip-61777 branch 3 times, most recently from 4a52725 to 5e3806e Compare August 3, 2026 11:45
@github-actions

github-actions Bot commented Oct 3, 2026

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

Copy link
Copy Markdown

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

That introduces the ceph.dir.bal.mask vxattr, which
is an option to rebalance a subtree within
specific active MDSs. Similar to the CPU mask,
this feature enables load balancing of specific
directories across multiple MDS ranks. It is especially
useful for fine-tuning and improving performance
in various scenarios. Previously, the bal_rank_mask
in ceph#43284 supports isolating unpinned subtrees under
the root directory ('/') to a specific MDS rank.
However, with this new option vxattr, it becomes
possible to isolate specific subdirectories to
designated MDS ranks. By introducing the
ceph.dir.bal.mask vxattr, this PR empowers
Ceph administrators with enhanced control and
flexibility for optimizing performance and
fine-tuning their deployments.

trakcer: https://tracker.ceph.com/issues/61777
Signed-off-by: Yongseok Oh <[email protected]>
@yongseokoh

Copy link
Copy Markdown
Contributor Author

@vshankar is this PR still on track for Vampire?

@vshankar

Copy link
Copy Markdown
Contributor

@vshankar is this PR still on track for Vampire?

Yes. It's waiting on me to do the needful. We have until January end before Vampire bis branched off, however, my target to get this in is in a months time.

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.

7 participants