JDK8 provides JMC tools, it should be worse than VISUALVM.
Post a Tomcat configuration, leave a backup of yourself and paste the following into Tomcat setenv.sh.
Nowday= 'Date+%y%m%d_%h%m%S ' Test-D: /gclogs | |mkdir.. /Gclogsif[-R"$CATALINA _base/bin/setenv_custom.sh"]; Then . "$CATALINA _base/bin/setenv_custom.sh"elif[-R"$CATALINA _home/bin/setenv_custom.sh"]; Then . "$CATALINA _home/bin/setenv_custom.sh"fiif[-Z $CATALINA _heap]; ThenCatalina_heap="-xms7g-xmx7g-xmn2g-xx:permsize=128m-xx:maxpermsize=128m"fiif[-Z $CATALINA _stack]; ThenCatalina_stack="-xss1m"fiif[-Z $CATALINA _GC]; Thencatalina_gc="-xx:maxtenuringthreshold=4-xx:+useconcmarksweepgc-xx:survivorratio=8-xx:cmsinitiatingoccupancyfraction=70- Xx:+explicitgcinvokesconcurrent"fiif[-Z $CATALINA _log]; ThenCatalina_log="-xx:-O mitstacktraceinfastthrow-xx:+printflagsfinal-xx:+printcommandlineflags-xx:+printgcdatestamps-xx:+ printtenuringdistribution-xx:+printgcdetails-xx:+printgctimestamps-xx:+printgcapplicationstoppedtime-xx:+ PRINTGCAPPLICATIONCONCURRENTTIME-XLOGGC:.. /gclogs/gc.log. $nowday"fiif[-Z $CATALINA _compiler]; ThenCatalina_compiler="-xx:cicompilercount=6"fiif[[!-Z"$JMX _port"&&! -Z "$JMX _host"]; ThenCatalina_extra="-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=${jmx_port}- Dcom.sun.management.jmxremote.ssl=false-djava.rmi.server.hostname=${jmx_host}- Dcom.sun.management.jmxremote.rmi.port=${jmx_port}" if[[!-Z"$JMX _login"]]; Thenarr= (${jmx_login//:/ })jmx_user=${arr[0]} jmx_pass=${arr[1]} Echo "$JMX _user readwrite Create com.sun.management.*,com.oracle.jrockit.* unregister">>.. /conf/jmxremote.accessEcho "$JMX _user $JMX _pass">>.. /conf/Jmxremote.passwordchmod -.. /conf/jmxremote.access. /conf/Jmxremote.password Catalina_extra+="-dcom.sun.management.jmxremote.authenticate=true-dcom.sun.management.jmxremote.password.file=. /conf/jmxremote.password-dcom.sun.management.jmxremote.access.file=. /conf/jmxremote.access" ElseCatalina_extra+="-dcom.sun.management.jmxremote.authenticate=false" fifiif[[!-Z"$JFR"]]; ThenCatalina_extra+="-xx:+unlockcommercialfeatures-xx:+flightrecorder"fiif[-Z $CATALINA _opts]; Thencatalina_opts="$CATALINA _extra $CATALINA _heap $CATALINA _stack $CATALINA _gc-server $CATALINA _log $CATALINA _compiler"fijpda_address=8787Jpda_suspend=NEcho "using Catalina JVM Flags: $CATALINA _opts"
Variables in the script set environment variables can be, in fact, in order to docker-compose start convenient configuration
JDK8 Flight Recorder Configuration