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

[BUG] cpu limit #10073

Closed
nexcode opened this issue Dec 13, 2022 · 2 comments · Fixed by #10100
Closed

[BUG] cpu limit #10073

nexcode opened this issue Dec 13, 2022 · 2 comments · Fixed by #10100

Comments

@nexcode
Copy link

nexcode commented Dec 13, 2022

Description

#9268
#9552

Steps To Reproduce

compose example file:

version: "2.4"
services:
  service:
    image: clickhouse/clickhouse-server:22.6.9.11
    container_name: clickhouse
    network_mode: host
    restart: on-failure
    cpus: 8

docker inspect clickhouse | grep -i cpu:

            "CpuShares": 0,
            "NanoCpus": 0,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "CpuCount": 0,
            "CpuPercent": 0,

But, if manual set from docker docker update --cpus 8 clickhouse:

            "CpuShares": 0,
            "NanoCpus": 8000000000,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "CpuCount": 0,
            "CpuPercent": 0,

Compose Version

Docker Compose version v2.12.2

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.12.2)
  scan: Docker Scan (Docker Inc., v0.21.0)

Server:
 Containers: 29
  Running: 28
  Paused: 0
  Stopped: 1
 Images: 237
 Server Version: 20.10.21
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1c90a442489720eec95342e1789ee8a5e1b9536f
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.14.0-191.el9.x86_64
 Operating System: CentOS Stream 9
 OSType: linux
 Architecture: x86_64
 CPUs: 96
 Total Memory: 251GiB
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
@glours
Copy link
Contributor

glours commented Dec 13, 2022

hello @nexcode
The cpus attribute has been deprecated, you should use deploy.reservations.cpus instead

@ndeloof
Copy link
Contributor

ndeloof commented Dec 19, 2022

While being deprecated, compose-go should have translated this legacy attribute to it's canonical definition.
I also tried using deploy: resources: reservations: cpus: '2' but container is created without constraint on CPU

So we definitively have a bug here, I'm re-opening this issue.

@ndeloof ndeloof reopened this Dec 19, 2022
@ndeloof ndeloof self-assigned this Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants