Docker Community Forums

Share and learn in the Docker community.

Excess resource usage

docker

(Stevegroom) #1

Expected behaviour

Less CPU used when idle

Actual behaviour

com.docker.hyperkit 96.7% CPU
com.docker.osxfs 45%CPU

Information

Diagnostic ID D8458696-5724-481F-A1E7-CE5B4577CDE1

  • the output of:
    • Moby Menu > Diagnose & Feedback on OSX

Docker for Mac: version: mac-v1.12.0-beta16.2
OS X: version 10.11.5 (build: 15F34)
logs: /tmp/20160621-212504.tar.gz
failure: No error was detected
[OK] docker-cli
[OK] app
[OK] menubar
[OK] virtualization
[OK] system
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux

  • a reproducible case if this is a bug, Dockerfiles FTW
  • page URL if this is a docs issue or the name of a man page
  • host distribution and version ( OSX 10.10.x, OSX 10.11.x, Windows, etc )

Steps to reproduce the behavior

docker-compose start ascetic
increases CPU and sets my macbook fans blowing hard.

The docker-compose.yml file is for running symfony. It has nginx, php and mysql containers. To try to improve the responsiveness of the web pages, I moved the asset generation from being dynamic as part of the page creation to having a separate process monitoring for file changes and generating assets on demand.

The extra container - ascetic - does detect file changes and generate assets into the correct locations, but uses too much resources when waiting on changes in the filesystem.

docker-compose.yml:
version: '2'
services:
  web:
    build: nginx

#    networks:
#      - outside
#      - default

    #ports:
      # Port should be set in docker-compose.override.yml
      # - "9999:80"
    volumes:
      - ./src:/usr/share/nginx/html

      - ./nginx/sites-enabled:/etc/nginx/sites-enabled
      - ./nginx/snippets:/etc/nginx/snippets
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf

    links:
      - php

  php:
    build: php/php7-fpm/php-fpm

#    networks:
#      - default

    ulimits:
      cpu_quota: unlimited
      nproc: 65535
      nofile:
        soft: 20000
        hard: 40000

    mem_limit: 4000000000
    memswap_limit: 8000000000
    privileged: true

    volumes:
      - ./src:/usr/share/nginx/html
      # On the php service run ps aux | grep php-fpm to see where the php-fpm.conf is found
      #decided to stop sharing these files and use the Dockerfile to create the required entries
      #- ./php/conf:/usr/local/etc
      - ./files:/files
    links:
      - db

  assetic:
    build: php/php7-fpm/php-fpm

#    networks:
#      - default
    entrypoint: /usr/share/nginx/html/app/console assetic:watch

    ulimits:
      cpu_quota: unlimited
      nproc: 65535
      nofile:
        soft: 20000
        hard: 40000

    mem_limit: 4000000000
    memswap_limit: 8000000000
    privileged: true

    volumes_from:
      - container:newgt_php_1

    links:
      - db

  db:
    build: mysql

#    networks:
#      - default

    volumes:
     - ./mysql/db:/var/lib/mysql
     - ./mysql/source:/home/mysql
     - ./mysql/source:/docker-entrypoint-initdb.d

    # Environment should be set in docker-compose.override.yml
    environment:
      - MYSQL_DATABASE=model
      - MYSQL_USER=root
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
      - DB_NAME=model
      - DB_USER=root
      - DB_PASS=rootpw



# Add a phpmyadmin container when needed.
# http://docker.dev:8000 to launch
# credentials:
  phpmyadmin:
    image: nazarpc/phpmyadmin
    #ports:
    #- "9998:80"
    links:
      - db:mysql

#networks:
#  outside:
#    external:
#      name: adbname

docker-compose stop assetic will stop the excess cpu
docker-compose start assetic will start the excess cpu again


(Soupman99) #2

My fans also run at full capacity while using docker-compose up even while sleeping if I don’t bring the containers back down again.

My Diagnostic ID is : 3B6F0C47-2344-4035-A3EA-6980BAEE7A73