Plex container and host SWAP memory usage

Hi folks,

I’m using now Plex from Linuxserver.io image for a while and quite happy with it :slight_smile:

I’m monitoring my host with Grafana/Prometheus and I have noticed that my host SWAP memory usage is increasing slowly every day.

I have used for smem and I have noticed that it’s mainly the Plex container that is using SWAP space.

$ smem -s swap -r
  PID User     Command                         Swap      USS      PSS      RSS
3005268 adm     /usr/lib/plexmediaserver/Pl      440    78632    79543    81180
3533339 adm     /usr/bin/python3 /usr/bin/s        0     8120     8945    14572
3503301 adm     -bash                              0     4532     4593     6884
3503210 adm     /usr/libexec/gvfs-mtp-volum        0      808      975     6528
3503201 adm     /usr/libexec/goa-identity-s        0     1520     2036     9512
3503187 adm    /usr/libexec/goa-daemon            0    18500    20494    34688
3503181 adm     /usr/libexec/gvfs-goa-volum        0      784     1015     6404
3503175 adm     /usr/libexec/gvfs-gphoto2-v        0     1012     1294     7344
3503152 adm     /usr/libexec/gvfs-afc-volum        0     1252     1622     8916
3503127 adm     /usr/libexec/gvfs-udisks2-v        0     2132     2650    10048
3503112 adm     /usr/libexec/gvfsd-fuse /ru        0      988     1192     6912
3503081 adm     /usr/libexec/gvfsd                 0      968     1321     7736
3503046 adm     /usr/bin/dbus-daemon --sess        0      584      752     4476
3503040 adm     /usr/libexec/tracker-miner-        0     9376    11684    24404
3503036 adm     /usr/bin/pulseaudio --daemo        0     3964     4913    14724
3503019 adm     /lib/systemd/systemd --user        0     3032     3973    10228
3005428 adm     /usr/lib/plexmediaserver/Pl        0     1692     2226     3460
3005426 adm     /usr/lib/plexmediaserver/Pl        0     6584     7313     8752
3005294 adm    Plex Plug-in [com.plexapp.s        0    34092    34382    35188

I’m using Portainer with agent and Docker Compose to deploy for all my containers.
Also all containers are still up-to-date thanks to watchtower monitoring running.
Here is my docker-compose file used within Portainer to deploy for Plex

version: "3.8"

services:
  plex:
    image: lscr.io/linuxserver/plex
    container_name: plex
    hostname: plex
    tty: true
    #network_mode: host
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    environment:
      - PUID=1000
      - PGID=1000
      - VERSION=docker
      - PLEX_CLAIM= #optional
      - TZ=Europe/Paris
    volumes:
      - "config:/config"
      - "transcode:/transcode"
      - "/mnt/seedbox/enfant:/child"
      - "/mnt/seedbox/parent:/movies"
    devices:
      - "/dev/dri:/dev/dri"
    mac_address: 02:42:c0:a8:01:93
    networks:
      default:
        ipv4_address: 192.168.1.147
    restart: unless-stopped

networks:
  default:
    external:
        name: macvlan-unifi

volumes:
  config:
  transcode:

My host has 8Gb of RAM and usually not used more than 30% so still have 5Gb free memory.

I don’t understand why Plex container is using SWAP space and is there a way to change this settings ? I would prefer Plex container to use RAM instead of SWAP.

Many thanks for your support
Cheers
Cyril