linuxserver / docker-emulatorjs

Web based retro emulation frontend with rom scanning and automated art ingestion.
GNU General Public License v3.0
512 stars 51 forks source link

IPFS daemon high CPU #3

Closed sorentorp closed 2 years ago

sorentorp commented 2 years ago

linuxserver.io

The CPU-usage in idle is very high - havent even added ROMS yet. Port 4001 is disabled.

Expected Behavior

It should just idle at low CPU.

Current Behavior

CPU is hovering around 20%.

Steps to Reproduce

1. Start container
2. Let it download 
3. High CPU

Environment

OS: - Debian CPU architecture: x86_64/arm32/arm64 x86_64 How docker service was installed:

distro repo

Command used to create docker container (run/create/compose/screenshot)

version: "2.1"
services:
  emulatorjs:
    image: lscr.io/linuxserver/emulatorjs
    container_name: emulatorjs
    networks:
      - web
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Copenhagen
    volumes:
      - /home/boyd/ekstern/Emulator:/data
    ports:
      - 3000:3000
      - 82:80
#      - 4001:4001
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.emulatorjs.entrypoints=http"
      - "traefik.http.routers.emulatorjs.rule=Host(`emulatorjs.xn--xxxx4a.dk`)"
      - "traefik.http.middlewares.emulatorjs-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.emulatorjs.middlewares=emulatorjs-https-redirect"
      - "traefik.http.routers.emulatorjs-secure.entrypoints=https"
      - "traefik.http.routers.emulatorjs-secure.rule=Host(`emulatorjs.xn--xxxx4a.dk`)"
      - "traefik.http.routers.emulatorjs-secure.tls=true"
      - "traefik.http.routers.emulatorjs-secure.service=emulatorjs"
      - "traefik.http.services.emulatorjs.loadbalancer.server.port=80"
      - "traefik.docker.network=web"
      - 'traefik.http.routers.emulatorjs-secure.middlewares=authelia@docker'

networks:
  web:
    external: true

Docker logs

Screenshot 2021-11-23 23 45 11

 [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing... 
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing... 

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing... 
[cont-init.d] 20-config: exited 0.
[cont-init.d] 90-custom-folders: executing... 
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-files: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Initializing daemon...
go-ipfs version: 0.8.0-3a7b65e49c
Repo version: 11
System version: amd64/linux
Golang version: go1.16.10
2021/11/23 23:40:51 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/127.0.0.1/udp/4001/quic
Swarm listening on /ip4/172.25.0.2/tcp/4001
Swarm listening on /ip4/172.25.0.2/udp/4001/quic
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/127.0.0.1/udp/4001/quic
Swarm announcing /ip4/172.25.0.2/tcp/4001
Swarm announcing /ip4/172.25.0.2/udp/4001/quic
Swarm announcing /ip4/85.191.76.241/udp/13318/quic
Swarm announcing /ip4/85.191.76.241/udp/28029/quic
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready
github-actions[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

AndreaPro commented 2 years ago

I have almost the same configuration and I am experiencing the same issue

thelamer commented 2 years ago

Added this: https://github.com/linuxserver/docker-emulatorjs/blob/master/root/etc/cont-init.d/20-config#L9

You can apply this to your container if you hop into the shell and run

HOME=/data s6-setuidgid abc ipfs config profile apply lowpower

Any new spinup will get this setting as well, it basically reduces the amount of peers and puts it in dht client mode. It is not an end all solution, I want the user to be able to start and stop the IPFS daemon when they need it from the web interface, but the code is not there yet. Lowpower is not a night and day change, but it is a bit better for now. I need end users to host this art content or the app can never scale, so kind of a balancing act to not completely disable p2p stuff by default.

sorentorp commented 2 years ago

Makes sense! Thank you.