Open georgyturevich opened 6 years ago
This is a golang/Windows limitation:
cc @jstarks @patricklang
@friism Hi Michael,
Thanks for sharing the finding!
I have a few questions there:
Do we have some ways to prioritize a fixing of this issue? (e.g .NET sorts it out somehow)
If I understand correctly this value is returned by sysinfo.NumCPU()
function. So mostlikely, we have a bug with setting CPU limits by --cpus
option which is calcuated there https://github.com/moby/moby/blob/3ba1dda1914fa7d380d9d3220c3b158a41f90cba/daemon/oci_windows.go#L268
According to the formula
cpuMaximum = uint16(c.HostConfig.NanoCPUs / int64(sysinfo.NumCPU()) / (1e9 / 10000))
it will allocate two times more CPUs for 128 CPUs servers. Not sure how it can be solved. Maybe by introducing separate Dockerd option like limit_numcpu
which will be used in the formula above.
It would interesting to see Darren's @darrenstahlmsft opinion as he already worked on some --cpus
issue.
Thanks!
Interesting. I don't think we want to introduce another parameter just to fix a bug unless we absolutely have to. I'll look into seeing if I can get NumCPU from another source that correctly reports on machines with over 64 CPUs though.
We will need to be careful though, as NumCPU returns the number of CPUs available to Go, which is needed for some calculations, and the other source would be for platform calls and returned API values only.
@darrenstahlmsft yeah, I think you should probably try to get this addressed in golang:
This is a much larger change to get support in Golang than just Moby. I think NumCPU is expected to return the number of CPUs available to Go, but go would need (likely major) runtime changes to support more than 64 CPUs for execution (and as a result, make it valid to return more than 64 CPUs here). The platform already supports more than 64 CPUs today (I'm pretty sure, at least), and I also see no reason that the Docker API should limit the returned CPUs based on Go's process limits.
Eventually this should be fixed in Go, but I think we can safely fix this in Moby without actually allowing dockerd.exe access to more than 64 CPUs (just containers started by dockerd.exe would have access to these CPUs).
That's my current understanding of the problem at least. I would need more time to look at it to confirm.
I also have an issue with the container randomly starting with 8 cpus or 64 cpus.
As reported by C++ std::thread::hardware_concurrency()
See #46885
Hello all,
I tested it on two machines with 128 CPUs - AWS x1.32xlarge and Azure M128S.
docker info
showsCPUs: 64
in both cases.I have a suspicion that it also can affect performance of containers if we set CPU limiting flags (--cpus/--cpu-percent) and in some other cases.
Output of
docker version
:Output of
docker info
for AWS x1.32xlarge:Output of
docker info
for Azure M128S:Thanks!