0

I am trying to understand the effect of setting cpu.cpu_quota_us in cpu cgroup subsytem on application performance. Essentially by reducing the CPU quota, but increasing the number of CPUs such that "effective" CPUs are still the same, would it impact the application? For example, is 4 CPU 100% quota configuration same as 8 CPU 50% quota configuration?

I have written a simple CPU-intensive program at https://github.com/ashu-mehra/cpu-quota-test and ran it under following cgroup configuration:

1) In cgroup which has 4 cpus and no limit on quota

2) In cgroup which has 8 cpus and 50% quota

When running this program for 32 threads I noticed following difference in the throughput reported by the program for the two configurations:

4CPU@100    8CPU@50 
176236      87252.5

Performance of 8CPU@50 is less than half of what I get with 4CPU@100.

On debugging further, I noticed my system is configured to use "powersave" CPU freq governor. In this mode the CPU frequency of the cores when program is running on 4CPU@100 shot to maximum but for 8CPU@50 CPU frequence of the cores was much lower.

When I changed the CPU freq governor to "performance" (which is the only other freq governor available), performance with 8CPU@50 increases considerably as the cores started running at max frequency:

4CPU@100    8CPU@50 
175804      163831 

My system details are:

Ubuntu 16.04.2 LTS

Kernel 4.4.0-103-generic

I have following questions regarding the CPUFreq governors:

1) This link https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt tells, "The CPUfreq governor "powersave" sets the CPU statically to the lowest frequency within the borders of scaling_min_freq and scaling_max_freq." However, I noticed the frequency changes as the load increases. How does "powersave" actually work?

2) Wy is the CPU frequency not increasing to max when "powersave" CPU freq governor is in use and CPU quota is set. Is setting CPU quota causing "powersave" to misbehave?

1 Answer 1

0

The document referenced in your question 1 is for the acpi-cpufreq CPU frequency scaling driver. I think, but am not certain, you are using the intel_pstate CPU frequency scaling driver. The way to know for sure is to ask your system:

$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate

The powersave governor in the intel_pstate driver behaves similarly to the ondemand governor in the acpi-cpufreq driver. The control algorithms have been changing, but if you have recent enough kernel should be load based.

The CPU frequency does not go up much, or even at all, when you limit use to 50% because the load based algorithm isn't presented with enough load to warrant raising the CPU frequency.

2
  • You are right, scaling driver is intel_pstate. Thanks for pointing that out.
    – Ashutosh
    Commented Feb 20, 2018 at 3:42
  • The CPU frequency does not go up much, or even at all, when you limit use to 50% because the load based algorithm isn't presented with enough load to warrant raising the CPU frequency. This would mean if the system is configured to use "powersave", performance with 8CPU@50% won't be same as 4CPU@100% even though "effective" CPU is same. That may not work well in cloud environment which use quota to assign CPU resource to the applications as the performance would suffer, unless "powersave" is not the default governor.
    – Ashutosh
    Commented Feb 20, 2018 at 3:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .