2

I can not choose optimal configuration for wildfly as. I have a droplet on DigitalOcean and it has 2GB Ram and 1vCPU. I have a social media application with mongodb(login and see your followers). This app triggers the Firebase Cloud Message service every 15 min. after FCM send notification to clients and clients send a request to server. After server make some db read/write operations. But the problem is server can not response approximately every 2-3 hours so I need to restart it. I track memory usage graph. after reboot memory usage graph increase slowly but always increase. Is this about wildfly conf or you can say anything about this? There is Nginx front of the Wildfly.

Wildfly conf:

bin/standalone.conf

if [ "x$JAVA_OPTS" = "x" ]; then  
   JAVA_OPTS="-Xms768m -Xmx1024m -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true"  
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true -Duser.timezone=GMT+3"  
else  
   echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"  
fi  

domain/configuration/domain.xml

<server-group name="main-server-group" profile="full">  
            <jvm name="default">  
                <heap size="1024m" max-size="1536m"/>  
            </jvm>  
            <socket-binding-group ref="full-sockets"/>  
        </server-group>  
        <server-group name="other-server-group" profile="full-ha">  
            <jvm name="default">  
                <heap size="1024m" max-size="1536m"/>  
            </jvm>  
            <socket-binding-group ref="full-ha-sockets"/>  
</server-group>  

domain/configuration/host.xml

<jvms>  
        <jvm name="default">  
            <heap size="1024m" max-size="1536m"/>  
            <jvm-options>  
                <option value="-server"/>  
                <option value="-XX:MetaspaceSize=96m"/>  
                <option value="-XX:MaxMetaspaceSize=256m"/>  
                <option value="--add-exports=java.base/sun.nio.ch=ALL-UNNAMED"/>  
            </jvm-options>  
        </jvm>  
    </jvms>  

Thank you.

Cagdas
  • 101
  • 2
  • 9

1 Answers1

0

Have you tried setting the Garbage collection in 'standalone.conf' located in libexec/bin?

I switched to Oracle's G1 garbage collection and it sorted out all my "out of memory" problems on WildFly 10/11. Now using it with 12.

http://www.oracle.com/technetwork/tutorials/tutorials-1876574.html

# G1 Garbage Collector
    JAVA_OPTS="-server -Xms2g -Xmx8g"
    JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC"
    JAVA_OPTS="$JAVA_OPTS -XX:MaxGCPauseMillis=200"
    JAVA_OPTS="$JAVA_OPTS -XX:InitiatingHeapOccupancyPercent=45"
    JAVA_OPTS="$JAVA_OPTS -XX:G1ReservePercent=25"
    JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:/Users/NOTiFY/IdeaProjects/MigrationTool/garbage-collection.log"
NOTiFY
  • 1,255
  • 1
  • 20
  • 36