Managing Resources
The haf-tool supports resource management in two modes on offload nodes: querying the resource configuration and configuring resources.
To query the resource configuration, run the following command:
su -s /bin/bash - haf -c "haf-tool resource -r <resource_target>"
Option |
Description |
Mandatory |
|---|---|---|
-r target resource/--resource=target resource |
target resource indicates the resource object. The value can be daemon or haf_user. |
x |
- If -r is not specified, the configurations of all resources are queried.
- If -r is specified, the configuration of the specified resource is queried.
To configure resources, run the following command:
su -s /bin/bash - haf -c "haf-tool resource -r <resource_target> -c <cpu> -m <mem>"
Option |
Description |
Mandatory |
|---|---|---|
-r <resource_target>/--resource=<resource_target> |
<resource_target> indicates the resource to be modified. The value can be daemon or haf_user. |
√ |
-c <cpu limit>/--cpu=<cpu limit> |
Set the CPU resource limit. The maximum value is the total number of CPU cores. The CPU can be configured independently. |
x |
-m <memory limit>/--mem=<memory limit> |
Set the memory resource limit. The maximum value is the total memory of the current node, in MB. The memory can be configured independently. |
x |
- Set the CPU resource limit. Use CGROUP to set HAF processes and HAF application service resources.
- A haf directory in the /sys/fs/cgroup directory is created. It contains the daemon and haf_user folders which are used to control the CPU resources of the daemon and executor respectively. When the service is uninstalled, the directory is not deleted. When the haf directory exists, if you redeploy the service, the corresponding permissions are directly granted to you.