Reputation: 405
I'm trying to tune production JVMs for spring boot Microservices and for now I made this list
-XX:+UnlockExperimentalVMOptions
-XX:+UseCGroupMemoryLimitForHeap
-XX:MaxRAMFraction=2
-XX:+UseStringDeduplication
-XX:+PrintStringDeduplicationStatistics
-XX:+CrashOnOutOfMemoryError
-XX:+HeapDumpOnOutOfMemoryError
-XX:+UseG1GC
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-Xloggc:/tmp/gc.log
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=5
-XX:GCLogFileSize=2000k
-XX:HeapDumpPath='/var/log/heap_dump.log'
-XX:+UseGCOverheadLimit
-XX:NativeMemoryTracking=summary
-XX:+UnlockDiagnosticVMOptions
-XX:+PrintNMTStatistics
What do you think, if I noticed that non of them 'duplicate' their functionality but I'm still not 100% is it enough or maybe I could add/remove some of them without worry of losing information.
my aim is to get as many information what is happening in jvm as I can get and to tune memory/gc performance to avoid oom. App is running on was in docker.
Some details: jdk 1.8 u152 spring-boot(s): 1.5.1
Upvotes: 1
Views: 784
Reputation: 533442
Currently i'am dealing with situations that app is just working few seconds or even minutes and immediately die without simple log and event error in Dropwizard Metrics
A process shouldn't just die, it should have either an exception or a crash dump. If your machine is overloaded, your process might get killed on linux to protect the system. If this happens it should be logged in /var/log/messages
If your program is randomly calling System.exit(int)
your SecurityManager should be preventing it or at least logging it.
So goal is to have memory optimized fully logged jvm.
Unfortunately, many of the logs you mention are buffered, so if the process is killed you are likely to lose the last few entries, possible the last few minutes of logging. These logs are useful for diagnosing performance issues, but might not help determine why the process dies unexpectedly.
tune memory/gc performance to avoid oom
This is different sort of problem. You need to try
Given memory is cheap, and your time is not, it might be simpler to increase memory. i.e. keep in mind how much memory can you buy for a day of your time.
Upvotes: 1