9.2.10.2 ahfctl setresourcelimit

Use the ahfctl setresourcelimit command to restrict the CPU and memory usage of Oracle Trace File Analyzer.

Note:

This feature is available only on Linux and only when Autonomous Health Framework is installed using a full installation by the root user.

AHF 25.1

CPU Resource Limiting on Oracle Linux 9

AHF now supports CPU resource limiting using cgroups v2, which is the default on Oracle Linux 9.

By default, AHF’s CPU usage is automatically restricted through the Linux cgroups feature, ensuring it does not consume excessive CPU resources out of the box. Users can easily adjust the CPU allocation for AHF to meet their specific needs. Oracle Linux 9 introduces the new cgroups v2 as its default, and starting with AHF 25.1, both cgroups v1 and v2 are fully supported by AHF.

Syntax

ahfctl setresourcelimit [-h] 
[-tool {tfa}] 
[-resource {cpu,kmem,swmem}] 
[-value VALUE] 
[-debug] 
[-force]

Parameters

Table 9-32 ahfctl setresourcelimit Command Parameters

Parameter Description

value

Set the limit to a minimum of 50% of a single CPU, and a maximum of 4 or 75% of the available CPUs, whichever is lower. By default, the CPU limit is set to the maximum.

To limit TFA to a maximum of 50% of a single CPU: ahfctl setresourcelimit -value 0.5

You can limit memory usage either at the system level using ahfctl setresourcelimit -resource kmem or combined system and swap memory using ahfctl setresourcelimit -resource swmem.

Set the kernel memory to a minimum of 500 MB, and a maximum of 2048 MB or 20% of the available memory, whichever is lower. By default, the kernel memory (kmem) limit is not set.

Set the system and swap memory to a minimum of 1024 MB, and a maximum of 8192 MB or 50% of the available memory, whichever is lower. By default, the system and swap memory (swmem) limit is not set.

tool

Currently, you can only specify tfa.

Default: tfa

resource

You can specify either CPU or memory.

value

Specify to limit the value.

  • CPU: Float number (rounded to 2 decimals) indicating the number of CPU that can be used.
    • Range of values: 0.5 <= value <= max_value, max_value is the minimum of (4, total number of CPUs * 0.75)
    • Default: max_value
  • Kernel Memory (kmem): Integer number (in MB) indicating the kernel memory that can be used.
    • Range of values: 1600 <= value <= max_value, max_value is the minimum of (20480, total system memory * 0.75)
    • Default: max_value
  • Memory+swap (swmem): Integer number (in MB) indicating the memory+swap that can be used.
    • Range of values: 1600 <= value <= max_value, max_value is the minimum of (20480, total system memory * 0.75)
    • Default: max_value

debug

Specify to enable debugging.

force

Specify to set the resource value beyond the max_value.

Example 9-35 setresourcelimit Examples

On a server with 10 CPUs, the default limit will be 4 CPUs:
# ahfctl setresourcelimit
Tool TFA: Resource CPU: Limit value: 4
On a server with 4 CPUs, the default limit will be 3 CPUs (75% of available CPUs):
ahfctl setresourcelimit
Tool TFA: Resource CPU: Limit value: 3
# ahfctl setresourcelimit -value 2
Tool TFA: Resource CPU: Limit value: 2
To limit the memory usage to only 500 MB of system memory run:
ahfctl setresourcelimit -resource kmem -value 500
To limit the combined total of system memory and the swap memory to 1 GB run:
ahfctl setresourcelimit -resource swmem -value 1024