zoukankan      html  css  js  c++  java
  • jdk8飞行记录器配置

    jdk8提供了jmc工具,应该比visualvm厉害吧

    下面贴一份tomcat的配置,自己留个备份,把下面的内容粘贴到tomcat setenv.sh就可以了

    nowday=`date +%Y%m%d_%H%M%S`
    test -d ../gclogs || mkdir ../gclogs
    
    if [ -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"
    fi
    
    if [ -z $CATALINA_HEAP ];then
        CATALINA_HEAP="-Xms7g -Xmx7g -Xmn2g -XX:PermSize=128m -XX:MaxPermSize=128m"
    fi
    if [ -z $CATALINA_STACK ];then
        CATALINA_STACK="-Xss1m"
    fi
    
    if [ -z $CATALINA_GC ];then
        CATALINA_GC="-XX:MaxTenuringThreshold=4 -XX:+UseConcMarkSweepGC -XX:SurvivorRatio=8 -XX:CMSInitiatingOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent"
    fi
    
    if [ -z $CATALINA_LOG ];then
        CATALINA_LOG="-XX:-OmitStackTraceInFastThrow -XX:+PrintFlagsFinal -XX:+PrintCommandLineFlags -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -Xloggc:../gclogs/gc.log.$nowday"
    fi
    
    if [ -z $CATALINA_COMPILER ];then
        CATALINA_COMPILER="-XX:CICompilerCount=6"
    fi
    
    
    if [[ ! -z "$JMX_PORT" && ! -z "$JMX_HOST" ]]; then
        CATALINA_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" ]]; then
            arr=(${JMX_LOGIN//:/ })
            JMX_USER=${arr[0]}
            JMX_PASS=${arr[1]}
            echo "$JMX_USER readwrite  create com.sun.management.*,com.oracle.jrockit.*  unregister" >> ../conf/jmxremote.access
            echo "$JMX_USER $JMX_PASS" >> ../conf/jmxremote.password
            chmod 400 ../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 "
        else
            CATALINA_EXTRA+=" -Dcom.sun.management.jmxremote.authenticate=false"
        fi
    fi
    
    if [[ ! -z "$JFR" ]];then
        CATALINA_EXTRA+=" -XX:+UnlockCommercialFeatures -XX:+FlightRecorder"
    fi
    
    if [ -z $CATALINA_OPTS ]; then
        CATALINA_OPTS="$CATALINA_EXTRA $CATALINA_HEAP $CATALINA_STACK $CATALINA_GC -server $CATALINA_LOG $CATALINA_COMPILER"
    fiJPDA_ADDRESS=8787
    JPDA_SUSPEND=n
    
    echo "using catalina jvm flags:$CATALINA_OPTS"

     脚本里的变量设置环境变量就可以了,其实是为了docker-compose启动方便配置

  • 相关阅读:
    [Swift通天遁地]七、数据与安全-(10)文件的加密压缩和解压加密压缩
    [Swift通天遁地]七、数据与安全-(9)文件的压缩和解压
    [Swift]LeetCode406. 根据身高重建队列 | Queue Reconstruction by Height
    [Swift]LeetCode403. 青蛙过河 | Frog Jump
    [Swift]LeetCode402. 移掉K位数字 | Remove K Digits
    [Swift]LeetCode399. 除法求值 | Evaluate Division
    [Swift通天遁地]七、数据与安全-(8)创建普通PDF文档和加密PDF文档
    Singleton单例模式
    Could not read from remote repository.
    Hadoop Web项目--Friend Find系统
  • 原文地址:https://www.cnblogs.com/txwsqk/p/6260646.html
Copyright © 2011-2022 走看看