docker / cli

The Docker CLI
Apache License 2.0
4.91k stars 1.93k forks source link

Docker container keeps increasing memory usage #5017

Closed flyletc closed 6 months ago

flyletc commented 6 months ago

Description

A Java application deployed using Docker,but docker container keeps increasing memory usage, JVM memory is normal, How should I troubleshoot this issue,thank you!

Reproduce

  1. Service just started 1
  2. After 1 million requests 7

Expected behavior

Does the Docker Stats instruction count a decrease in memory usage after a period of time without receiving a request

docker version

Client: Docker Engine - Community
 Version:           26.0.1
 API version:       1.45
 Go version:        go1.21.9
 Git commit:        d260a54
 Built:             Thu Apr 11 10:54:59 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          26.0.1
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.9
  Git commit:       60b9add
  Built:            Thu Apr 11 10:53:19 2024
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.6.31
  GitCommit:        e377cd56a71523140ca6ae87e30244719194a521
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

1. linux
Linux localhost.localdomain 5.14.0-162.23.1.el9_1.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 11 19:09:37 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

NAME="Rocky Linux"
VERSION="9.1 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.1"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.1 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.1"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.1"

2. docker-compose
Docker Compose version v2.26.1

3. jdk
jdk 17

Additional Info

  1. jvm info

-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=172.168.50.82 -Dcom.sun.management.jmxremote.port=18000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.security.egd=file:/dev/./urandom -XX:ReservedCodeCacheSize=512m -XX:ReservedCodeCacheSize=512m -XX:CICompilerCount=4 -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms512m -Xmx512m -Xmn256m -XX:+PrintGCDetails -XX:NativeMemoryTracking=detail -XX:SurvivorRatio=8 -XX:+UseG1GC

2

3

4

5

6

vvoland commented 6 months ago

This is unlikely Docker's issue. The container also runs other processes other than JVM. As you can see on your screenshots, the amount of processes increased from 77 to 129 which means that the higher memory usage is most likely caused by additional processes being ran.

Let me close this issue, as it's not related to the CLI.