Skip to content

crimson: simplify vstart crimson-osd reactor pinning - #63137

Merged
athanatos merged 3 commits into
ceph:mainfrom
athanatos:sjust/wip-vstart-crimson-pin-71096
May 12, 2025
Merged

athanatos merged 3 commits into
ceph:mainfrom
athanatos:sjust/wip-vstart-crimson-pin-71096

Conversation

@athanatos

Copy link
Copy Markdown
Contributor
Show available Jenkins commands

@athanatos
athanatos requested a review from perezjosibm May 6, 2025 16:15
@athanatos

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@athanatos

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

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

Just a typo, and a couple of minor suggestions please, thanks!

Comment thread src/vstart.sh Resolved
Comment thread src/vstart.sh Resolved
Comment thread src/vstart.sh Outdated
Comment on lines 278 to 280

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 no longer have the slack conversation, but iirc the best results by the team in India showed that the number of alien threads needed to be four times that of the total of CPU cores used by the Bluestore backend, I think that is part of the reason why there were two parameters for alienstore (num of threads and num of CPU cores).

For example, here is what I use last in my test driving script:

  if [ "$OSD_TYPE" == "blue" ]; then
                  NUM_ALIEN_THREADS=$(( 4 *NUM_OSD * NUM_REACTORS ))
                  title="${title} alien_num_threads=${NUM_ALIEN_THREADS}"
                  cmd="${cmd}  --crimson-alien-num-threads $NUM_ALIEN_THREADS"

The code in vstart used the remaining CPUs left once all OSDs reactors have been configured, within the number given by the above option. TBH I haven't worked out the minimal number of CPU cores for Alien threads that gives good performance.

Apologies if I'm wrong/confused.

@athanatos athanatos May 6, 2025 •

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.

Ah, I was sloppy and misunderstood that distinction:

-            if [ $crimson_alien_num_threads -gt 0 ]; then
-                echo "$CEPH_BIN/ceph -c $conf_fn config set osd crimson_alien_op_num_threads $crimson_alien_num_threads"
-                $CEPH_BIN/ceph -c $conf_fn config set osd crimson_alien_op_num_threads "$crimson_alien_num_threads"
-            fi

I'll add it back in.

Comment thread src/vstart.sh Resolved
@athanatos
athanatos force-pushed the sjust/wip-vstart-crimson-pin-71096 branch from 5ab8bc7 to 0ee010e Compare May 6, 2025 20:15
… for balance_cpu

Improvements:
- shorter
- has tests
- uses lscpu -e --json to get logical<->physical mappings and avoid
  needing to parse cpu ranges in lscpu --json
- supports allocating alienstore threads
- supports requiring physical cores only independently for alienstore
  and seastar reactors

Signed-off-by: Samuel Just <[email protected]>
@athanatos
athanatos force-pushed the sjust/wip-vstart-crimson-pin-71096 branch from 0ee010e to 30fe658 Compare May 7, 2025 01:17

@perezjosibm perezjosibm 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, thanks!

@athanatos
athanatos requested a review from Matan-B May 7, 2025 20:20
@athanatos

Copy link
Copy Markdown
Contributor Author

@Matan-B Does this seem reasonable?

@athanatos
athanatos marked this pull request as ready for review May 7, 2025 20:21
@Matan-B Matan-B added this to Crimson May 8, 2025
@Matan-B Matan-B moved this to Awaits review in Crimson May 8, 2025
@Matan-B Matan-B added the crimson label May 8, 2025

@Matan-B Matan-B 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.

This seem to address https://tracker.ceph.com/issues/66159, I've updated it so we can backport this easily - can you please add a "fixes"?

edit: discussed offline, the script is useful today for testing/verifying new allocation strategies - and is not yet proven (on a specific machine) to have any meaningful impact. Yet, we want to be able to easily mesaure and test this is this might change.

Comment thread src/vstart.sh Outdated

@Matan-B Matan-B May 8, 2025 •

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.

wrong description, Number of cores that alien-tp threads will use.

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.

Might be easier to read if this option is under --crimson-alien-num-threads:

	--crimson-alien-num-threads: number of alien-tp threads
	--crimson-alien-num-cores: number of cores that alien-tp threads will use

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.

Good catch, fixed.

Comment thread src/vstart.sh Resolved
Comment thread src/vstart.sh Resolved
Comment thread src/vstart.sh Resolved
Comment thread src/vstart.sh Resolved
Comment thread src/vstart.sh Resolved
Comment thread src/vstart.sh Resolved
@Matan-B Matan-B moved this from Awaits review to In Progress in Crimson May 8, 2025
@Matan-B

Matan-B commented May 8, 2025

Copy link
Copy Markdown
Contributor

Even though there's no src change here, we should backport this into T so we can test the script with actual deployments as well in the next tech-preview release.

@Matan-B Matan-B 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.

2 comments from previous round might be worth addressing. Other than that lgtm!

It seems that doc/dev/crimson/BalanceCPUCrimson.md might need an update after this PR. We can address this out of scope of this PR.

note: we should verify that seastar's resource.cc doesn't provide similar strategies since it might.

@Matan-B Matan-B moved this from In Progress to Tested in Crimson May 8, 2025
@athanatos
athanatos force-pushed the sjust/wip-vstart-crimson-pin-71096 branch 2 times, most recently from c39e69a to a804b05 Compare May 8, 2025 16:08
@athanatos

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@athanatos
athanatos force-pushed the sjust/wip-vstart-crimson-pin-71096 branch from 527e6be to e1894cd Compare May 8, 2025 21:50
@athanatos

Copy link
Copy Markdown
Contributor Author

I apparently hadn't actually removed the sequential pinning default from the reactors, only from alienstore. It should actually default to simply setting crimson_seastar_cpu_cores now:

diff --git a/src/vstart.sh b/src/vstart.sh
index 1970b9725b0..ea3577bf4af 100755
--- a/src/vstart.sh
+++ b/src/vstart.sh
@@ -1250,15 +1250,7 @@ start_osd() {
     for osd in `seq $start $end`
     do
        if [ "$ceph_osd" == "crimson-osd" ]; then
-        if [ ! -z "$crimson_balance_cpu" ]; then
-            do_balance_cpu $osd
-        else
-            bottom_cpu=$(( osd * crimson_smp ))
-            top_cpu=$(( bottom_cpu + crimson_smp - 1 ))
-            # set exclusive CPU nodes for each osd
-            echo "$CEPH_BIN/ceph -c $conf_fn config set osd.$osd crimson_seastar_cpu_cores $bottom_cpu-$top_cpu"
-            $CEPH_BIN/ceph -c $conf_fn config set "osd.$osd" crimson_seastar_cpu_cores "$bottom_cpu-$top_cpu"
-        fi
+        do_balance_cpu $osd
     fi
        if [ "$new" -eq 1 -o $inc_osd_num -gt 0 ]; then
             wconf <<EOF

@athanatos

Copy link
Copy Markdown
Contributor Author

jenkins test api

athanatos added 2 commits May 8, 2025 18:09
This commit simplifies the internal flow in a few ways:
- core assignment is entirely handled by prep_balance_cpu and
  do_balance_cpu.  The latter simply does as the cpu_table
  instructs.
- assign_crimson_cores calls lscpu and taskset internally, no
  need for temp files.

It also changes some defaults:
- if crimson-balance-cpu is unset or set to none, crimson-osd will not
  pin cpus at all rather than using the simple sequential allocation
  scheme, which could be much less efficient on platforms where
  cpuids 0,1,2,3,... are on socket 0,1,2,3,...  "osd" and "socket"
  options provide numa aware assignments when requested.

New features:
- Alienstore cores are now assigned with assign_crimson_cores
  using the same balance strategy using
  --crimson-alien-num-cores.
- --crimson-reactor-physical-only and
  --crimson-alienstore-physical-only will cause reactor or
  alienstore cpus respectively to be allocated with one
  cpu per physical core rather than including smt siblings.

Fixes: https://tracker.ceph.com/issues/71096
Signed-off-by: Samuel Just <[email protected]>
Replaced by assign_crimson_cores.

Signed-off-by: Samuel Just <[email protected]>
@athanatos
athanatos force-pushed the sjust/wip-vstart-crimson-pin-71096 branch from e1894cd to 7eaa56b Compare May 9, 2025 01:15
@athanatos

Copy link
Copy Markdown
Contributor Author

@Matan-B

Matan-B commented May 11, 2025

Copy link
Copy Markdown
Contributor

jenkins test make check

@Matan-B

Matan-B commented May 11, 2025

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@athanatos
athanatos merged commit 474e653 into ceph:main May 12, 2025
@Matan-B Matan-B moved this from Tested to Merged (Main) in Crimson May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged (Pre Umbrella cutoff)

Development

Successfully merging this pull request may close these issues.

3 participants