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

docker memory consumption #54

Closed
KonradHoeffner opened this issue Jan 14, 2022 · 2 comments
Closed

docker memory consumption #54

KonradHoeffner opened this issue Jan 14, 2022 · 2 comments

Comments

@KonradHoeffner
Copy link
Contributor

KonradHoeffner commented Jan 14, 2022

Using the current master branch, the docker container uses more than 500 MB of RAM even at the start when nothing is happening:

$ docker build -t lodview .
$ docker run --network=host --privileged -d lodview
$ docker stats
CONTAINER ID   NAME            CPU %     MEM USAGE / LIMIT     MEM %     NET I/O   BLOCK I/O     PIDS
413bd2f64fca   sweet_leavitt   0.00%     529.5MiB / 15.42GiB   3.35%     0B / 0B   57.6MB / 0B   36

Output of top from within the container:

top - 09:03:30 up 51 min,  0 users,  load average: 0.87, 0.95, 0.73
Tasks:   3 total,   1 running,   2 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.9 us,  2.1 sy,  0.0 ni, 89.8 id,  0.0 wa,  0.1 hi,  0.1 si,  0.0 st
MiB Mem :  15791.6 total,   7311.0 free,   3588.6 used,   4892.0 buff/cache
MiB Swap:  16384.0 total,  16384.0 free,      0.0 used.   9873.9 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                                                                                                
      1 root       1   0 8060128 536560  20060 S   0.3   3.3   0:13.90 java                                                                                                                                                                                                                                                   
     47 root       1   0    5756   3604   3108 S   0.0   0.0   0:00.08 bash                                                                                                                                                                                                                                                   
     59 root       1   0    9768   3368   2844 R   0.0   0.0   0:00.01 top 
# java -XX:+PrintFlagsFinal -version | grep -E "UseContainerSupport | InitialRAMPercentage | MaxRAMPercentage | MinRAMPercentage"
   double InitialRAMPercentage                      = 1.562500                            {product}
   double MaxRAMPercentage                          = 25.000000                           {product}
   double MinRAMPercentage                          = 50.000000                           {product}
     bool UseContainerSupport                       = true                                {product}
# jinfo 1 | grep "VM flags"
Non-default VM flags: -XX:CICompilerCount=4 -XX:InitialHeapSize=260046848 -XX:MaxHeapSize=4139778048 -XX:MaxNewSize=1379926016 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=86507520 -XX:OldSize=173539328 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseParallelGC

Is there a way to reduce the usage?

@KonradHoeffner
Copy link
Contributor Author

KonradHoeffner commented Jan 14, 2022

VisualVM

$ docker run --network=host --privileged -d -e CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=localhost" lodview

Opening a few tabs at the same time:

Heap

visualvm2
visualvm4

Garbage collection was manually performed at the end.

Serial garbage collector seems to be much better suited to minimize RAM usage.
visualvm-serial

docker run --network=host --privileged -e CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=localhost -XX:+UseSerialGC" lodview

Opening the same tabs as before.

@KonradHoeffner
Copy link
Contributor Author

Reduced somewhat by #55.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant