Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in vCPUS computing #6

Open
RenaudDemarneffe opened this issue Sep 12, 2019 · 1 comment · May be fixed by #11
Open

Error in vCPUS computing #6

RenaudDemarneffe opened this issue Sep 12, 2019 · 1 comment · May be fixed by #11

Comments

@RenaudDemarneffe
Copy link

RenaudDemarneffe commented Sep 12, 2019

Hi,

I built a container with the scripts and executed it on K8S.

I have an error on vCPU computing when running on IBM K8S cluster. I give 2 CPU to the Informix container.

The value of vCPU_CONTAINER returned by the container (in the script "calculate_onconfig.sh") is 40000.

informix@informixdb-0:/opt/ibm/config$ cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us
40000
informix@informixdb-0:/opt/ibm/config$ cat /sys/fs/cgroup/cpu/cpu.cfs_period_us
20000

When I run the same command in a docker on my laptop (CentOS), I get the following values.

informix@informixdb-0:/opt/ibm/config$ cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us
200000
informix@informixdb-0:/opt/ibm/config$ cat /sys/fs/cgroup/cpu/cpu.cfs_period_us
100000

I think the right formula to compute the number of vCPU allocated to the container is the following:

CPUFILE_QUOTA="/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
CPUFILE_PERIOD="/sys/fs/cgroup/cpu/cpu.cfs_period_us"

vCPUS_CONTAINER_QUOTA=`cat $CPUFILE_QUOTA`
vCPUS_CONTAINER_PERIOD=`cat $CPUFILE_PERIOD`

###
### Set the amount of CPU's available to the docker container
###
if [[ $vCPUS_CONTAINER == "-1" ]]
then
   vCPUS=$vCPUS_HOST
else
   vCPUS=`echo "$vCPUS_CONTAINER_QUOTA / $vCPUS_CONTAINER_PERIOD" | bc`
fi

Could you please check?

Regards,
Renaud

@RenaudDemarneffe
Copy link
Author

Hi,

I have created a path with the solution I propose to the issue.
Could you please check it and integrate in into the master branch?

Regards,
Renaud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant