|
Userspace Resource Manager
|
API Signature:
The tuneResources API is designed to work will all Resource Classes, i.e. Cluster, Core, CGroup, MPAM etc. URM validates resources individually: if a request contains both valid and invalid resources, invalid resource entries are skipped and the remaining valid resources continue through processing.
For example, a request may contain two resources:
In this case, URM skips only the invalid RES_SCALE_MAX_FREQ entry and still applies the valid RES_SCALE_MIN_FREQ entry. If no valid resources remain after validation, no resource is applied for that request.
Following code snippets illustrate this:
=> Suppose, we are tuning a single resource as part of the resource. This resource with the ResCode: 0x0002a0be is a Cluster Apply Type Resource. The following example shows how to tune it on the logical cluster ID: 1 => Internally, this logical cluster ID will be mapped to the appropriate physical cluster ID, and the configured value will be applied to that node.
Note: Setting the logical cluster ID only effectuates change, if the targeted resource actually has an ApplyType of "cluster" (this can be verified by referring "ResourcesConfig.yaml").
Resources which can have different configured value on different cores. To tune such a resource, along with the resource "ResCode", the desired core must also be passed, i.e. the core on which the value should take effect. Here, logical values are used.
=> Suppose, we are tuning a single resource as part of the resource. This resource with the ResCode: 0x00250dfc is a Core Apply Type Resource. The following example shows how to tune it on 2nd core in the second logical cluster. => Internally, this logical core ID will be mapped to the appropriate physical core ID, and the configured value will be applied to that core.
Note: Setting the logical core ID only effectuates change, if the targeted resource actually has an ApplyType of "core" (this can be verified by referring "ResourcesConfig.yaml").
To configure a value for all the cores part of a cluster, specify a logical core ID of 0.
The above snippet will apply the request to all the cores (resource nodes) part of the physical cluster corresponding to the logical cluster ID 2.
Resources which can have different configured value across different cgroups, for example the node "memory.max" can have different values for cgrpA and cgrpB. To tune such a resource, along with the resource "ResCode", the desired cgroup identifier must also be passed, i.e. the cgroup on which the value should take effect.
=> To obtain the correct cgroup identifier, refer the config file "InitConfigs.yaml", which maps identifiers (integer values) to cgroup names. => Resource Tuner, supports multi-valued resources, and expects the first value to be the cgroup identifier, the following values are treated as values, and can differ according to the resource node. => Internally, this identifier will be used to identify the correct cgroup node to which the configured value should be applied.
=> Suppose, we are tuning a single resource as part of the resource. This resource with the ResCode: 0x00090007 is a CGroup Apply Type Resource. The following example shows how to tune it for the cgroup with the identifier: 1
The following example, illustrates how to tune the "cpuset.cpus" node for a particular cgroup
This will update the cpuset.cpus node for the cgroup with identifier: 1, to: "0-1,3"
The following example, illustrates how to tune the "memory.max" node for a particular cgroup
A similar strategy can be adopted for other cgroup resources as well.