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

install.sh vcpu count has issues in Kubernetes/OpenShift #25

Open
sgaragan opened this issue May 7, 2024 · 3 comments
Open

install.sh vcpu count has issues in Kubernetes/OpenShift #25

sgaragan opened this issue May 7, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@sgaragan
Copy link

sgaragan commented May 7, 2024

When running the install.sh script, it determines the number of vCPUs by the following line:

readonly available_vcpu=$(egrep 'processor' /proc/cpuinfo | wc -l)

Later in the script, the value is used to determine the number of jobs to run for the 'make' command:

make -j`echo $((${available_vcpu} - 1))`

When running in Kubernetes/OpenShift, "egrep 'processor' /proc/cpuinfo | wc -l" gives the total number of processors on the node running the build as /proc/cpuinfo is not scoped by cgroup. The result is that it runs with as many jobs as there are cores (in our case, 72) which blows the RAM usage through the roof.

I was able to fix this by changing the value to 2 manually in the Dockerfile but if this could be added as an argument to install.sh (or available to override via an env variable) that would allow the build to work more effectively in a k8s-based environment

Thanks,
Sean

@scuzzilla scuzzilla added the enhancement New feature or request label May 11, 2024
@scuzzilla scuzzilla self-assigned this May 11, 2024
@scuzzilla
Copy link
Collaborator

@sgaragan many thanks for your request. As a potential quick & easy solution to your problem, you might consider setting the global variable 'available_vcpu' to a value >= 3. For reference, see: https://github.com/network-analytics/mdt-dialout-collector/blob/main/install.sh#L44.

@ustorbeck
Copy link
Contributor

You also could try to use the nproc command, which is more smart to get the number of cores assigned to a process. But I don't know if it's available on all platforms and how it behaves on kubernetes.

@sgaragan
Copy link
Author

Thanks for the responses. We tried nproc but sadly it is not namespace aware so it too reports the total number of cores available to a node. We added the following to the Dockerfile to hardcode the value:

RUN cd /opt/mdt-dialout-collector && sed -i 's/available_vcpu=.*/available_vcpu=2/g' ./install.sh

Which does the trick but took a while to figure out why the builds were blowing up the memory being used to get here

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

No branches or pull requests

3 participants