runbroker.sh

#===========================================================================================
# JVM Configuration
#===========================================================================================
JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:PermSize=128m -XX:MaxPermSize=320m"
JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:+DisableExplicitGC"
JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:${HOME}/rmq_bk_gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow"
JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib"
#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n"
JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}"

-server By default, all client applications run in -client mode, while the directory server and certain server utilities run in -server mode. Generally, -server mode provides higher throughput than -client mode, at the expense of slightly longer startup times.

-Xms4g Sets the initial size (in bytes) of the heap. This value must be a multiple of 1024 and greater than 1 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, g or G to indicate gigabytes.

-Xmx4g Specifies the maximum size (in bytes) of the memory allocation pool in bytes.This value must be a multiple of 1024 and greater than 2 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, g or G to indicate gigabytes. The default value is chosen at runtime based on system configuration. For server deployments, -Xms and -Xmx are often set to the same value. See the section "Ergonomics" in Java SE HotSpot Virtual Machine Garbage Collection Tuning Guide.

click to see configuring-the-default-jvm-and-java-arguments

-Xmn2g Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery). Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, g or G to indicate gigabytes.

The young generation region of the heap is used for new objects. GC is performed in this region more often than in other regions. If the size for the young generation is too small, then a lot of minor garbage collections will be performed. If the size is too large, then only full garbage collections will be performed, which can take a long time to complete. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size. 7  8

-XX:PermSize=128m Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded. This option was deprecated un JDK 8, and superseded by the -XX:MetaspaceSize option.

-XX:MaxPermSize=320m Sets the maximum permanent generation space size (in bytes). This option was deprecated in JDK 8, and superseded by the -XX:MaxMetaspaceSize option.

-XX:+UseConcMarkSweepGC Enables the use of the CMS garbage collector for the old generation. Oracle recommends that you use the CMS garbage collector when application latency requirements cannot be met by the throughput (-XX:+UseParallelGC) garbage collector. The G1 garbage collector (-XX:+UseG1GC) is another alternative. By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM. When this option is enabled, the -XX:+UseParNewGC option is automatically set and you should not disable it, because the following combination of options has been deprecated in JDK 8: -XX:+UseConcMarkSweepGC -XX:-UseParNewGC.

-XX:+UseParNewGC Enables the use of parallel threads for collection in the young generation. By default, this option is disabled. It is automatically enabled when you set the -XX:+UseConcMarkSweepGC option. Using the -XX:+UseParNewGC option without the -XX:+UseConcMarkSweepGC option was deprecated in JDK 8.

-XX:+UseCMSCompactAtFullCollection 表示在FGC之后进行压缩,因为CMS默认不压缩空间的。

-XX:CMSInitiatingOccupancyFraction=70 使用cms作为垃圾回收,使用70%后开始CMS收集。

-XX:+CMSParallelRemarkEnabled 开启并行标记。

-XX:SoftRefLRUPolicyMSPerMB=0 每兆堆空闲空间中SoftReference的存活时间。This flag enables aggressive processing of software references. Use this flag if the software reference count has an impact on the Java HotSpot VM garbage collector.

-XX:+CMSClassUnloadingEnabled Enables class unloading when using the concurrent mark-sweep (CMS) garbage collector. This option is enabled by default. To disable class unloading for the CMS garbage collector, specify -XX:-CMSClassUnloadingEnabled.

-XX:SurvivorRatio=8 Sets the ratio between eden space size and survivor space size. By default, this option is set to 8. The following example shows how to set the eden/survivor space ratio to 4:-XX:SurvivorRatio=4

-XX:+DisableExplicitGC 关闭System.gc()

-verbose:gc Displays information about each garbage collection (GC) event.
-Xloggc:${HOME}/rmq_bk_gc.log Sets the file to which verbose GC events information should be redirected for logging. The information written to this file is similar to the output of -verbose:gc with the time elapsed since the first GC event preceding each logged event. The -Xloggc option overrides -verbose:gc if both are given with the same java command.
-XX:+PrintGCDetails Enables printing of detailed messages at every GC. By default, this option is disabled.
-XX:+PrintGCDateStamps Enables printing of a date stamp at every GC. By default, this option is disabled.

RocketMQ runbroker.sh 分析JVM启动参数的更多相关文章

  1. NetBeansRCP-添加/修改NetBeans的JVM启动参数

    NetBeans运行的速度实在是不敢恭维.还好机器配置还可以,修改其JVM启动参数命令行,以期运行的更加顺畅. 那么如何修改NetBeans IDE的JVM参数呢? 1.到NetBeans IDE的安 ...

  2. JVM启动参数小结

    一:JVM启动参数共分为三类:         其一是标准参数(-),所有的JVM实现都必须实现这些参数的功能,而且向后兼容:        其二是非标准参数(-X),指的是JVM底层的一些配置参数, ...

  3. 业务系统的JVM启动参数推荐

    关键业务系统的JVM启动参数推荐,原文链接请参见:http://calvin1978.blogcn.com/articles/jvmoption-2.html

  4. jvm启动参数设置 -Dfile.encoding=UTF-8 解决freemark乱码

    今天一个spring boot应用windows跑起来后页面显示乱码,加上jvm启动参数为utf-8后,页面显示正常.

  5. jvm 启动参数设置(转载)

    JVM启动参数 http://onlyor.iteye.com/blog/1722413 博客分类: java java java启动参数共分为三类其一是标准参数(-),所有的JVM实现都必须实现这些 ...

  6. Eclipse jvm启动参数在哪设置

    学习并转载自https://jingyan.baidu.com/article/624e7459653ca534e8ba5a26.html Java是一门非常受欢迎的编程语言,Java的开发人员多数使 ...

  7. JVM 启动参数,共分为3类

    JVM 启动参数,共分为3类: 类别 说明 标准参数(-) 所有的JVM实现都必须实现这些参数的功能,而且向后兼容: 非标准参数(-X) 这些参数不是虚拟机规范规定的.因此,不是所有VM的实现(如:H ...

  8. JVM系统属性 OS环境变量 JVM启动参数

    JVM系统属性(System Properties) 1.不支持通过文件查看和设置系统属性 2.可以通过JDK自带的工具jvisulavm.exe查看 3.可以在Java程序中使用API来查看系统属性 ...

  9. 【java】java获取JVM启动参数 System.getProperty

    java获取JVM启动参数 System.getProperty取 -D后的key即可 public class Test { public static void main(String[] arg ...

随机推荐

  1. OA办公自动化系统源码

    最新extjs6富客户端,.net平台开发,sql server数据库,基础权限人员基础平台,可方便二次开发,使用EF为orm,autofac为ioc,Castle为基础的aop,实现常用OA系统功能 ...

  2. Mysql数据库 - 增删改

    一. Create 1. 单条插入, sql格式: insert into (列名) values(列值); INSERT INTO test.tch_teacher ( Sex, BId, NO, ...

  3. C#文件和文件夹输入输出流代码

    1.建立一个文本文件 public class FileClass { public static void Main() { WriteToFile(); } static void WriteTo ...

  4. PostgreSQL Replication之第十章 配置Slony(2)

    10.2 理解 Slony如何工作 在我们开始复制我们的第一个数据库之前,我们想深入Slony的架构.理解这是如何工作的是非常重要的,否则,将不可能以一种有用的和合理的方法使用这个软件.与事务日志流不 ...

  5. 转学步园:jquery offset

    JQuery Offset实验与应用 我们有时候需要实现这样一种功能:点击一个按钮,然后在按钮的下方显示一个div.当按钮位于角落时,div的位置设定就需要计算,使div完全显示. 我打算使用offs ...

  6. Android 自学之基本界面组件(上)

    文本款(TextView)和编辑框(EditText)的功能和用法 TextView直接继承了View,他还是EditText.Button两个UI组件的父类,TextView的作用就是在界面上显示文 ...

  7. servlet其工作原理和例子证明

    servlet简单介绍 当我们在地址栏里面输入www.baidu.com,终于呈如今我们面前的是百度搜索的页面.在这些訪问过程中,都会有一个webserver来处理这些请求以及訪问处理后的结果. 而s ...

  8. 通过Chocolatey软件包管理器安装.NET Core

    在Linux的世界里,有了yum/apt-get百分之九十的软件都可以通过它来安装管理.但是在Windows系统上,装个软件还是挺折腾的.比如我要装个Chrome浏览器,我先得打开IE浏览器吧,我还打 ...

  9. Access Treeview树节点代码一

    Private Sub TreeView0_Updated(Code As Integer)Dim ndeindex As NodeSet ndeindex = TreeView0.Nodes.Add ...

  10. JS动态创建元素

    动态添加标签,可从服务器获取标签文本,然后加载到指定div中,可用于权限控制. 1.添加标签字符串方式 var str='<div>5555555555555555555555555555 ...