RocketMQ runbroker.sh 分析JVM启动参数

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.

时间: 2024-10-11 07:30:23

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

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

NetBeans运行的速度实在是不敢恭维.还好机器配置还可以,修改其JVM启动参数命令行,以期运行的更加顺畅. 那么如何修改NetBeans IDE的JVM参数呢? 1.到NetBeans IDE的安装目录的etc子目录,例如我的是"D:\Netbeans-7.2\etc". 2.在该目录下有个叫netbeans.conf的文件,呵呵,这就是我们要找的文件啦. 3.在编辑器打开该文件,netbeans_default_options="--"就是我们要添加/修改的地

Eclipse jvm启动参数在哪设置

学习并转载自https://jingyan.baidu.com/article/624e7459653ca534e8ba5a26.html Java是一门非常受欢迎的编程语言,Java的开发人员多数使用Eclipse作为自己的IDE, 在代码调试的过程中有时会遇到内存不足的错误,有没有办法手动指定JVM的启动 参数呢?所以今天笔者和大家分享下"jvm启动参数在哪设置",希望能给大家带来一些帮助. ①打开Eclipse ②创建一个类,编写一段演示用的代码,在代码编辑区右键单击,依次选择[

JVM 启动参数及原理 转

Java虚拟机(JVM)是Java应用的运行环境,从一般意义上来讲,JVM是通过规范来定义的一个虚拟的计算机,被设计用来解释执行从Java源码编译而来的字节码.更通俗地说,JVM是指对这个规范的具体实现.这种实现基于严格的指令集和全面的内存模型.另外,JVM也通常被形容为对软件运行时环境的实现.通常JVM实现主要指的是HotSpot. JVM规范保证任何的实现都能够以同样的方式解释执行字节码.其实现可以多样化,包括进程.独立的Java操作系统或者直接执行字节码的处理器芯片.我们了解最多的JVM是

【JVM】jvm启动参数

-server -Xmx2048m -Xms1500m -Xmn1024m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInit

memcached源码分析-----memcached启动参数详解以及关键配置的默认值

转载请注明出处: http://blog.csdn.net/luotuo44/article/details/42672913 本文开启本系列博文的代码分析.本系列博文研究是memcached版本是1.4.21. 本文将给出memcached启动时各个参数的详细解释以及一些关键配置的默认值.以便在分析memcached源码的时候好随时查看.当然也方便使用memcached时可以随时查看各个参数的含义.<如何阅读memcached源码>说到memcached有很多全局变量(也就是关键配置),这些

JVM启动参数详解 (转)

非标准参数 非标准参数又称为扩展参数,其列表如下: -Xint  设置jvm以解释模式运行,所有的字节码将被直接执行,而不会编译成本地码.   -Xbatch  关闭后台代码编译,强制在前台编译,编译完成之后才能进行代码执行:  默认情况下,jvm在后台进行编译,若没有编译完成,则前台运行代码时以解释模式运行.   -Xbootclasspath:bootclasspath  让jvm从指定路径(可以是分号分隔的目录.jar.或者zip)中加载bootclass,用来替换jdk的rt.jar:若

修改weblogic jvm启动参数

进入: D:\Oracle\Middleware\user_projects\domains\base_domain\startWebLogic.cmd 在call 上一行增加: set USER_MEM_ARGS=-Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m 例如: @ECHO OFF @REM WARNING: This file is created by the Configuration Wizard.@REM A

resin设置jvm启动参数

在resin.xml的 <cluster id="web">后面加上 <server-default> <jvm-arg>-Xms4096m</jvm-arg> <jvm-arg>-Xmx2048m</jvm-arg> <jvm-arg>-Xmn1024m</jvm-arg> <jvm-arg>-XX:PermSize=1048m</jvm-arg> <jvm-

(入门贴)JVM堆内存相关的启动参数:年轻代、老年代和永久代的内存分配

如果想观察JVM进程占用的堆内存,可以通过命令工具jmap或者可视化工具jvisualvm.exe.JVM这些启动参数都拥有默认值,如果想了解JVM的内存分配策略,最好手动设置这些启动参数.再通过JDK提供的工具的统计结果,进行对比,就比较容易理解这些内存分配的理论知识.运行环境是win7 32位操作系统,JDK1.7.0_60版本. 测试代码和JVM启动参数如下: public class Test { public static void main(String[] args) { int