Set the cpu_rate_limit
parameter to the fraction of CPU time over wall-clock time to which the combined, simultaneous CPU usage of all processes in the group should not exceed. Thus, the value assigned to cpu_rate_limit
should typically be less than or equal to 1.
The valid range of the cpu_rate_limit
parameter is 0 to 1.67772e+07. A setting of 0 means no CPU rate limit has been set for the resource group.
EDB Resource Manager utilizes CPU throttling
to keep the aggregate CPU usage of all processes in the group within the limit specified by the cpu_rate_limit
parameter. A process in the group may be interrupted and put into sleep mode for a short interval of time to maintain the defined limit. When and how such interruptions occur is defined by a proprietary algorithm used by EDB Resource Manager.
The ALTER RESOURCE GROUP
command with the SET cpu_rate_limit
clause is used to set the CPU rate limit for a resource group.
In the following example the CPU usage limit is set to 50% for resgrp_a
, 40% for resgrp_b
and 30% for resgrp_c
. This means that the combined CPU usage of all processes assigned to resgrp_a
is maintained at approximately 50%. Similarly, for all processes in resgrp_b
, the combined CPU usage is kept to approximately 40%, etc.
Changing the cpu_rate_limit
of a resource group not only affects new processes that are assigned to the group, but any currently running processes that are members of the group are immediately affected by the change. That is, if the cpu_rate_limit
is changed from .5 to .3, currently running processes in the group would be throttled downward so that the aggregate group CPU usage would be near 30% instead of 50%.
In a second session, the Linux top
command is used to display the CPU usage as shown under the %CPU
column. The following is a snapshot at an arbitrary point in time as the top
command output periodically changes.
session performing the factorial calculation is shown by the row where edb-postgres
appears under the COMMAND
column. The CPU usage of the session shown under the %CPU
column shows 39.9, which is close to the 40% CPU limit set for resource group resgrp_b
By contrast, if the psql
session is removed from the resource group and the factorial calculation is performed again, the CPU usage is much higher.
Under the %CPU
column for edb-postgres
, the CPU usage is now 93.6, which is significantly higher than the 39.9 when the process was part of the resource group.
The following command sequence displays the sum of all edb-postgres
processes sampled over half second time intervals. This shows how the total CPU usage of the processes in the resource group changes over time as EDB Resource Manager throttles the processes to keep the total resource group CPU usage near 40%.
In this example, two additional psql
sessions are used along with the previous two sessions. The third and fourth sessions perform the same factorial calculation within resource group resgrp_c
with a cpu_rate_limit
(30% CPU usage).
command displays the following output.
The second and third edb-postgres
processes belonging to the resource group where the CPU usage is limited to 40%, have a total CPU usage of 37.8. However, the first edb-postgres
process has a 58.6% CPU usage as it is not within a resource group, and basically utilizes the remaining, available CPU resources on the system.