i'm running java app
inside of docker container
, restricted 4 cpu
, machine on docker container
runs, has 10 cpu
.
when calling nproc
inside docker container
, result 4
, when call runtime.getruntime().availableprocessors()
10
result.
- why happening? how come
java
seecpu
? - is there way of getting in
java
same result asanproc
, besides usingruntime.getruntime().exec("nproc")
?
according ken sipe (link below) there bug in java showing wrong no of cpus/cores when using shared cpus (default in docker) instead of cpusets (pinned cpus process).
i myself see wrong number regardless setting:
runtime.availableprocessors(), no docker: 8 in docker 4,
whereas nproc says 1 (when using --cpuset-cpus=0 <- pinned on cpu0)
Comments
Post a Comment