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

1. perf(qrm): improve performance of calculating hints 2. feat(qrm): involve memory bandwidth when admitting in cpu plugin #650

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions cmd/katalyst-agent/app/options/qrm/qrm_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ type GenericQRMPluginOptions struct {
ExtraStateFileAbsPath string
PodDebugAnnoKeys []string
UseKubeletReservedConfig bool
PodAnnotationKeptKeys []string
PodLabelKeptKeys []string
}

func NewGenericQRMPluginOptions() *GenericQRMPluginOptions {
return &GenericQRMPluginOptions{
QRMPluginSocketDirs: []string{"/var/lib/kubelet/plugins_registry"},
StateFileDirectory: "/var/lib/katalyst/qrm_advisor",
PodDebugAnnoKeys: []string{},
QRMPluginSocketDirs: []string{"/var/lib/kubelet/plugins_registry"},
StateFileDirectory: "/var/lib/katalyst/qrm_advisor",
PodDebugAnnoKeys: []string{},
PodAnnotationKeptKeys: []string{},
PodLabelKeptKeys: []string{},
}
}

Expand All @@ -49,6 +53,10 @@ func (o *GenericQRMPluginOptions) AddFlags(fss *cliflag.NamedFlagSets) {
o.PodDebugAnnoKeys, "pod annotations keys to identify the pod is a debug pod, and qrm plugins will apply specific strategy to it")
fs.BoolVar(&o.UseKubeletReservedConfig, "use-kubelet-reserved-config",
o.UseKubeletReservedConfig, "if set true, we will prefer to use kubelet reserved config to reserved resource configuration in katalyst")
fs.StringSliceVar(&o.PodAnnotationKeptKeys, "pod-annotation-kept-keys",
o.PodAnnotationKeptKeys, "pod annotation keys will be kept in qrm state")
fs.StringSliceVar(&o.PodLabelKeptKeys, "pod-label-kept-keys",
o.PodLabelKeptKeys, "pod label keys will be kept in qrm state")
}

func (o *GenericQRMPluginOptions) ApplyTo(conf *qrmconfig.GenericQRMPluginConfiguration) error {
Expand All @@ -57,6 +65,8 @@ func (o *GenericQRMPluginOptions) ApplyTo(conf *qrmconfig.GenericQRMPluginConfig
conf.ExtraStateFileAbsPath = o.ExtraStateFileAbsPath
conf.PodDebugAnnoKeys = o.PodDebugAnnoKeys
conf.UseKubeletReservedConfig = o.UseKubeletReservedConfig
conf.PodAnnotationKeptKeys = o.PodAnnotationKeptKeys
conf.PodLabelKeptKeys = o.PodLabelKeptKeys
return nil
}

Expand Down
8 changes: 6 additions & 2 deletions pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ type DynamicPolicy struct {
qosConfig *generic.QoSConfiguration
dynamicConfig *dynamicconfig.DynamicAgentConfiguration
podDebugAnnoKeys []string
podAnnotationKeptKeys []string
podLabelKeptKeys []string
transitionPeriod time.Duration
cpuNUMAHintPreferPolicy string
cpuNUMAHintPreferLowThreshold float64
Expand Down Expand Up @@ -200,6 +202,8 @@ func NewDynamicPolicy(agentCtx *agent.GenericContext, conf *config.Configuration
enableCPUIdle: conf.CPUQRMPluginConfig.EnableCPUIdle,
reclaimRelativeRootCgroupPath: conf.ReclaimRelativeRootCgroupPath,
podDebugAnnoKeys: conf.PodDebugAnnoKeys,
podAnnotationKeptKeys: conf.PodAnnotationKeptKeys,
podLabelKeptKeys: conf.PodLabelKeptKeys,
transitionPeriod: 30 * time.Second,
}

Expand Down Expand Up @@ -612,7 +616,7 @@ func (p *DynamicPolicy) GetTopologyHints(ctx context.Context,
// we should do it before GetKatalystQoSLevelFromResourceReq.
isDebugPod := util.IsDebugPod(req.Annotations, p.podDebugAnnoKeys)

qosLevel, err := util.GetKatalystQoSLevelFromResourceReq(p.qosConfig, req)
qosLevel, err := util.GetKatalystQoSLevelFromResourceReq(p.qosConfig, req, p.podAnnotationKeptKeys, p.podLabelKeptKeys)
if err != nil {
err = fmt.Errorf("GetKatalystQoSLevelFromResourceReq for pod: %s/%s, container: %s failed with error: %v",
req.PodNamespace, req.PodName, req.ContainerName, err)
Expand Down Expand Up @@ -687,7 +691,7 @@ func (p *DynamicPolicy) Allocate(ctx context.Context,
// we should do it before GetKatalystQoSLevelFromResourceReq.
isDebugPod := util.IsDebugPod(req.Annotations, p.podDebugAnnoKeys)

qosLevel, err := util.GetKatalystQoSLevelFromResourceReq(p.qosConfig, req)
qosLevel, err := util.GetKatalystQoSLevelFromResourceReq(p.qosConfig, req, p.podAnnotationKeptKeys, p.podLabelKeptKeys)
if err != nil {
err = fmt.Errorf("GetKatalystQoSLevelFromResourceReq for pod: %s/%s, container: %s failed with error: %v",
req.PodNamespace, req.PodName, req.ContainerName, err)
Expand Down
Loading
Loading