nri icon indicating copy to clipboard operation
nri copied to clipboard

Support adjust oom_Score_adj for NRI plugins

Open zxj874478410 opened this issue 1 year ago • 2 comments

The LinuxContainer structure transferred by the containerd contains the OomScoreAdj field. However, the NRI plugins do not support the adjustment of this field. Theoretically, the OomScoreAdj field should be customized by users to provide more refined QoS control.

The definition of LinuxContainer:

type LinuxContainer struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Namespaces  []*LinuxNamespace `protobuf:"bytes,1,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
	Devices     []*LinuxDevice    `protobuf:"bytes,2,rep,name=devices,proto3" json:"devices,omitempty"`
	Resources   *LinuxResources   `protobuf:"bytes,3,opt,name=resources,proto3" json:"resources,omitempty"`
	OomScoreAdj *OptionalInt      `protobuf:"bytes,4,opt,name=oom_score_adj,json=oomScoreAdj,proto3" json:"oom_score_adj,omitempty"`
	CgroupsPath string            `protobuf:"bytes,5,opt,name=cgroups_path,json=cgroupsPath,proto3" json:"cgroups_path,omitempty"`
}

The definition of LinuxContainerAdjustment:

type LinuxContainerAdjustment struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Devices     []*LinuxDevice  `protobuf:"bytes,1,rep,name=devices,proto3" json:"devices,omitempty"`
	Resources   *LinuxResources `protobuf:"bytes,2,opt,name=resources,proto3" json:"resources,omitempty"`
	CgroupsPath string          `protobuf:"bytes,3,opt,name=cgroups_path,json=cgroupsPath,proto3" json:"cgroups_path,omitempty"`
}

Obviously, losing the ability to oom adjust is not reasonable.

zxj874478410 avatar Jul 10 '24 03:07 zxj874478410

Obviously, losing the ability to oom adjust is not reasonable.

NRI currently supports a subset of fields as adjustable, and accepts pull requests to increase the set of supported fields. Supporting a subset was a reasonable mechanism to start experimenting with NRI and discovering use-cases that it can satisfy.

I would be open to supporting OomScoreAdj.

samuelkarp avatar Jul 10 '24 03:07 samuelkarp

NRI currently supports a subset of fields as adjustable, and accepts pull requests to increase the set of supported fields. Supporting a subset was a reasonable mechanism to start experimenting with NRI and discovering use-cases that it can satisfy.

I tried to modify some of the NRI code to add the ability to adjust the OomScoreAdj, and it passed the functional verification. The relevant code is attached in PR #94.

zxj874478410 avatar Jul 10 '24 07:07 zxj874478410