From: 段光辉 <badwolf09950@163.com>
To: musl@lists.openwall.com
Subject: [musl] Apine container can not get correct host cpu.
Date: Thu, 20 Jan 2022 11:47:24 +0800 (CST) [thread overview]
Message-ID: <65fb16c2.1dea.17e7598a494.Coremail.badwolf09950@163.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]
Hello:
I'm using alpine docker images in Kubernetes. Kubernetes version: v1.19.5, OS: CentOS 7.4.1708, Linux kernel: 3.10.0 .
command `nproc` in container should be return the host cpu count(8 cores, 0-7), but when deployment in kubernetes set limits cpu equals requests cpu,like :
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: "1"
memory: 1Gi
then `nproc` command return 1, not the host cpu count.
so, the program like java,python,go when get cpu cores will not be correct by methods sched_getaffinity or cpu_count,JVM (JDK8) may be crashed in container,jdk get min value between host and pod limit, method sched_getaffinity in container start from 1, not 0.
~ # apk info musl
musl-1.2.2-r7 description:
the musl c library (libc) implementation
musl-1.2.2-r7 webpage:
https://musl.libc.org/
musl-1.2.2-r7 installed size:
608 KiB
[-- Attachment #2: Type: text/html, Size: 2216 bytes --]
reply other threads:[~2022-01-20 12:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65fb16c2.1dea.17e7598a494.Coremail.badwolf09950@163.com \
--to=badwolf09950@163.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).