Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sysadvisor): get util based headroom per-numa #772

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

funnydreamwinz
Copy link
Member

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Special notes for your reviewer:

@funnydreamwinz funnydreamwinz force-pushed the dev/fix-util-based-headroom branch from ccf04e5 to 50b426d Compare January 24, 2025 08:53
@funnydreamwinz funnydreamwinz force-pushed the dev/fix-util-based-headroom branch 3 times, most recently from fd8aa40 to 3383b49 Compare January 24, 2025 09:59
@@ -40,11 +41,8 @@ const (

func (ha *HeadroomAssemblerCommon) getUtilBasedHeadroom(options helper.UtilBasedCapacityOptions,
Copy link
Collaborator

Choose a reason for hiding this comment

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

add a input parameter numaList []int, such as:

func (ha *HeadroomAssemblerCommon) getUtilBasedHeadroom(options helper.UtilBasedCapacityOptions,
	reclaimMetrics *metaserverHelper.ReclaimMetrics,
	lastReclaimedCPUPerNuma map[int]float64,
        numaList []int,
)

@@ -54,10 +52,14 @@ func (ha *HeadroomAssemblerCommon) getUtilBasedHeadroom(options helper.UtilBased
}

util := reclaimMetrics.CgroupCPUUsage / reclaimMetrics.ReclaimedCoresSupply
lastReclaimedCPU := 0.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

sum the lastReclaimedCPU by numaList, such as:

for _, numaID := range numaList {
   lastReclaimedCPU += lastReclaimedCPUPerNuma[numaID]
}

headroom, err := ha.getUtilBasedHeadroom(options, reclaimMetrics)
lastReclaimedCPUPerNuma := make(map[int]float64)
lastReclaimedCPUPerNuma[numaID] = reclaimedCPUs[numaID]
headroom, err := ha.getUtilBasedHeadroom(options, reclaimMetrics, lastReclaimedCPUPerNuma)
Copy link
Collaborator

Choose a reason for hiding this comment

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

only input the numaID as list and all numa reclaimed CPUs reclaimedCPUs

headroom, err := ha.getUtilBasedHeadroom(options, reclaimMetrics, reclaimedCPUs,[]int{numaID})

@@ -201,7 +211,7 @@ func (ha *HeadroomAssemblerCommon) getHeadroomByUtil() (resource.Quantity, map[i
}

options.MaxCapacity *= float64(len(nonBindingNumas))
headroom, err := ha.getUtilBasedHeadroom(options, reclaimMetrics)
headroom, err := ha.getUtilBasedHeadroom(options, reclaimMetrics, lastReclaimedCPUPerNuma)
Copy link
Collaborator

Choose a reason for hiding this comment

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

here only need use nonBindingNumas:

headroom, err := ha.getUtilBasedHeadroom(options, reclaimMetrics, reclaimedCPUs, nonBindingNumas)

@funnydreamwinz funnydreamwinz force-pushed the dev/fix-util-based-headroom branch from 3383b49 to cf0a6cf Compare January 26, 2025 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants