Docker Community Forums

Share and learn in the Docker community.

Execution time does not scale up/down linearly with --cpu-period and --cpu-quota

Docker version: 18.09.6
Kernel Version: 4.4.0-150-generic
Operating System: Ubuntu 16.04.6 LTS
Container OS: Ubuntu 14.04.5 LTS

I use --cpu-period and --cpu-quota in order to limit the CPU resources for each container. I run a simple program which calculates the factorial of 100000, and set --cpu-period=30000 and --cpu-quota=10000. I run the program 10 tims, and here are the execution time for each run in ms:

10943
11343
12507
11644
12268
13531
11855
10856
12120
11463

Now, when I set --cpu-period=30000 and --cpu-quota=5000, I should expect the execution time to be doubled. However, it’s now always the case. Here are the results:

35672
37260
34200
34353
34408
23849
27870
25170
31768
36210

The question is, why is the execution time not 2x slower?