`
relaxbod
  • 浏览: 4929 次
社区版块
存档分类
最新评论

Hotspot JVM 参数总结

阅读更多
我对Java Hotspot
VM的部分翻译,有些在工作中完全没有用到的参数我没有做解释,原文章在这
Java HotSpot VM Options

同时,在工作中有一些没有接触到的参数,我不打清楚其含义跟作用, 也请了解的朋友留言赐教.这些Option我贴在了文章最后面.

JVM 选项不严格的被分为三类:
1.Behavioral options, 用以改变VM的基本行为.

2.Performance tuning options,影响VM的重要参数,对其进行调整进行性能调优.

3.Debug Options,用来在log中进行跟踪,打印一些VM信息.

可管理标记的使用:

1.Boolean Options:

-XX:+  表示打开

-XX:-  表示关闭

2.Numeric options
-XX:=. 数字需包括'm' or 'M'代表单位megabytes, 'k' or 'K'代表单位 kilobytes,'g' or 'G' 代表单位 gigabytes,例如 for example, 32k
与32768代表同一值 32x1024.

3.String options
-XX:=,通常用来声明 log path.

罗列一些常用参数极其代表含义:

Behavioral Options

-XX:-DisableExplicitGC
关闭调用System.gc()方法, 但是JVM还是会在需要的时候进行full GC.

-XX:+ScavengeBeforeFullGC
在Major GC 之前 进行一次 Minor GC

-XX:-UseConcMarkSweepGC
对 Tenured Generation 使用 CMS(concurrent mark-sweep collection)算法.

-XX:-UseParallelGC
Young Generation使用Parallel算法,Tenured Generation 使用 Serial算法.

-XX:-UseParallelOldGC
在Full GC 中使用 Parallel GC 算法

-XX:-UseSerialGC
使用Young Old 带均使用Serial算法

Performance Options

-XX:LargePageSizeInBytes=size
为java heap 设置page size

-XX:MinHeapFreeRatio=40
在GC之后 最小的空闲heap占总heap的比例Minimum percentage of heap free after GC to avoid expansion.

-XX:MaxHeapFreeRatio=70
设置在GC之后, 最大的空闲heap占总heap的比例

-XX:MaxNewSize=size
设置 New Generation最大值.

-XX:MaxPermSize=size
设置Perm Generation的大小.

-XX:NewRatio=n
n = new/old generation sizes

-XX:NewSize=2.125m
new generation的默认值

-XX:TargetSurvivorRatio=50
回收后survior区的期望比例

Debugging Options

-XX:HeapDumpPath=
设置Heap Dum 存储路径

-XX:-HeapDumpOnOutOfMemoryError
在OOM时生成heapdump文件.

-XX:OnOutOfMemoryError=";
用户自定义命令, 在OutOfMemory Error抛出时运行定义命令.

-XX:-PrintGC
打印GC时的信息

-XX:-PrintGCDetails
打印GC时的详细信息

-XX:-PrintGCTimeStamps
打印GC的时间戳

-XX:-PrintTenuringDistribution
打印Tenured区的信息

-XX:ParallelGCThreads=
设置Parallel Garbage Collector的thread 数量

-XX:MaxTenuringThreshold=
设置控制对象从新生代转移到到旧生代的Minor GC次数
----------------------------------------------------------------------------------------------------

[
-XX:-TraceClassLoading Trace loading of classes.

-XX:-TraceClassLoadingPreorder Trace all classes loaded in order
referenced (not loaded). (Introduced in 1.4.2.XX:-TraceClassResolution
Trace constant pool resolutions. (Introduced in 1.4.2.)

-XX:-TraceClassUnloading
Trace unloading of classes.

-XX:-TraceLoaderConstraints
Trace recording of loader constraints. (Introduced in 6.)

-XX:+PerfSaveDataToFile
Saves jvmstat binary data on exit.

-XX:+UseCompressedOops
Enables the use of compressed pointers (object references represented as
32 bit offsets instead of 64-bit pointers) for optimized 64-bit
performance with Java heap sizes less than 32gb.

-XX:+AlwaysPreTouch
Pre-touch the Java heap during JVM initialization. Every page of the
heap is thus demand-zeroed during initialization rather than
incrementally during application execution.

-XX:AllocatePrefetchDistance=
Sets the prefetch distance for object allocation. Memory about to be
written with the value of new objects is prefetched into cache at this
distance (in bytes) beyond the address of the last allocated object.
Each Java thread has its own allocation point. The default value varies
with the platform on which the JVM is running.

-XX:InlineSmallCode= I
Inline a previously compiled method only if its generated native code
size is less than this. The default value varies with the platform on
which the JVM is running.

-XX:MaxInlineSize=35
Maximum bytecode size of a method to be inlined.

-XX:FreqInlineSize=
Maximum bytecode size of a frequently executed method to be inlined. Thedefault value varies with the platform on which the JVM is running.

-XX:LoopUnrollLimit=
Unroll loop bodies with server compiler intermediate representation node count less than this value. The limit used by the server compiler is a function of this value, not the actual value. The default value varies with the platform on which the JVM is running.

-XX:InitialTenuringThreshold=7
Sets the initial tenuring threshold for use in adaptive GC sizing in the parallel young collector. The tenuring threshold is the number of timesan object survives a young collection before being promoted to the old,or tenured, generation.

-XX:-PrintClassHistogram
Print a histogram of class instances on Ctrl-Break. Manageable.
(Introduced in 1.4.2.) The jmap -histo command provides equivalent
functionality.

-XX:-PrintConcurrentLocks
Print java.util.concurrent locks in Ctrl-Break thread dump. Manageable.
(Introduced in 6.) The jstack -l command provides equivalent
functionality.

-XX:-PrintCommandLineFlags
Print flags that appeared on the command line. (Introduced in 5.0.)

-XX:-PrintCompilation
Print message when a method is compiled.
]

1
0
分享到:
评论

相关推荐

    Java HotSpot VM Options

    jvm参数介绍,oracle HotSpot官方参数文档。

    java 6 jvm 参数选项大全

    研究JVM参数的朋友有帮助! 另外,考虑到本文档是初稿,如有描述错误,敬请指正。 非稳态选项使用说明  -XX:+<option>启用选项 -XX:-<option>不启用选项 -XX:<option>=<number>给选项设置一个数字类型值...

    HotSpot虚拟机主要参数表

    包含参数如下: 1. 内存管理参数 2. 及时编译参数 3. 类型加载参数 4. 多线程相关参数‘ 5. 性能参数 6. 调试参数

    HotSpot GC官网文档截图 - 20200917

    官网英文文档介绍GC的各个版本发展、GC选取、调优参数等; 当前压缩包为官网文档截图文件集合,个人觉得资源珍贵且比网上各个帖子更有参考价值,故存储自用并分享。

    JVM-Java虚拟机

    2JVM参数;3,垃圾回收原理;4,垃圾回收器的使用;5,调优实战案例 导语:平时我们所说的JVM广义上指的是一种规范。狭义上的是JDK中的JVM虚拟机。JVM的实现是由各个厂商来做的。比如现在流传最广泛的是hotspot。...

    java查看sun包源码-monitor:java生产环境内存调优(包括jvm参数类型,JVM的参数类型jinfo&jps(参数和进程查看)j

    jvm参数类型:alien: jinfo & jps(参数和进程查看):alien: jstat(类加载、垃圾收集、JIT 编译):alien: jmap+MAT(内存溢出):alien: jstack(线程、死循环、死锁):alien: JVisualVM(本地和远程可视化监控:alien: 使用 ...

    resin-jvm 调优

    6.2.客户机:通过在JNLP文件中设置参数来调整客户端JVM JNLP中参数:initial-heap-size和max-heap-size 这可以在framework的RequestManager中生成JNLP文件时加入上述参数,但是这些值是要求根据客户机的硬件状态...

    HotSpot Runtime概述

    本节介绍与HotSpot Runtime系统的主要子系统相关的关键概念。涵盖以下主题:  命令行参数处理  VM生命周期  VM类加载  字节码验证器和格式检查器  类数据共享  解释器  Java异常处理  同步  线程...

    JDK1.8所有vmXX选项及值(java)

    JDK1.8.0_112所有vm选项,用于...基于Java 6(update 21oder 21之后)版本, HotSpot JVM 提供给了两个新的参数,在JVM启动后,在命令行中可以输出所有XX参数和值。 -XX:+PrintFlagsFinal and -XX:+PrintFlagsInitial

    深入理解_Java_虚拟机 JVM_高级特性与最佳实践

    / 57 3.4.3 Parallel Scavenge收集器 / 59 3.4.4 Serial Old收集器 / 60 3.4.5 Parallel Old收集器 / 61 3.4.6 CMS收集器 / 61 3.4.7 G1收集器 / 64 3.4.8 垃圾收集器参数总结 / 64 3.5 内存分配与回收策略 /...

    虚拟机

    实际问题OOM内存不足问题GC问题(阅读GC日志) 配置/优化JVM参数目标内存管理和GC 字节码和类加载器JVM参数配置和优化CS核心基金会硬件网络操作系统DS /算法虚拟机类别物理硬件的系统VM(例如:Virtual Box,VMware...

    淘宝前台系统优化实践

    主要内容 •QPS(吞吐量)三要素 •优化模板 –至少提升50% ...•优化jvm参数 –合理配置young区的大小(0%~100%) –减少GC的总时间 •保持优化的成果 –Daily load running –Daily hotspot code analysis

    hsdis-amd64.dll-jdk11

    我们有了这个插件后,通过JVM参数-XX:+PrintAssembly就可以加载这个HSDIS插件,然后为我们把JIT动态生成的那些本地代码还原成汇编代码,然后打印出来。这个hsdis-amd64.dll是基于openjdk11 编译。

    hsdis-amd64.dll-jdk8

    我们有了这个插件后,通过JVM参数-XX:+PrintAssembly就可以加载这个HSDIS插件,然后为我们把JIT动态生成的那些本地代码还原成汇编代码,然后打印出来。这个hsdis-amd64.dll是基于openjdk8编译。

    JVM-类加载器与双亲委托

    虚拟机为HotSpot 1.类加载器 类加载器一般只有3种(除开自己定义的)分别为: 1.Bootstrap ClassLoader:根加载器 2.Extension ClassLoader:扩展加载器 3.System ClassLoader:系统加载器 以下我们将对这3种加载器进行...

    Eclipse 启动运行速度调优

    运行参数如下: eclipse.exe -vmargs -Xverify:none -XX:+UseParallelGC -XX:PermSize=20M <br>-------------- <br>JVM 提供了各种用于调整内存分配和垃圾回收行为的标准开关和非标准...

    Java虚拟机

    3.5.9 垃圾收集器参数总结 3.6 内存分配与回收策略 3.6.1 对象优先在Eden分配 3.6.2 大对象直接进入老年代 3.6.3 长期存活的对象将进入老年代 3.6.4 动态对象年龄判定 3.6.5 空间分配担保 3.7 本章小结 第4...

    jvm_book:《深入理解Java虚拟机(第3版)》样例代码&勘误

    JetBrains的远程方案,不用纠结如何搭建IDE环境调试HotSpot源码了,如对您有用,望不吝给个Star  本工程为《深入理解Java虚拟机(第3版)》书中的样例代码,以方便读者自行测试。部分代码需要在特定的虚拟机版本、...

    ZhiShan-zh.github.io:互联网开发工程师知识笔记

    1.2 JVM-HotSpot 虚拟机监控工具:虚拟机监控工具概述▣Attach 机制▣查看JVM进程 1.3 Tomcat Tomcat介绍 Tomcat架构 1.4 Spring Spring技术栈简介 1.4.1 Spring Framework Spring基础: Spring入门▣Spring配置▣...

    kafka_2.9.2-0.8.2.1.tgz

    Kafka默认开启JVM压缩指针,但只是在64位的HotSpot VM受支持,如果安装了32位的HotSpot VM,需要修改/bin/kafka-run-class.sh文件 KAFKA_JVM_PERFORMANCE_OPTS="-server -XX:+UseCompressedOops -XX:+UseParNewGC...

Global site tag (gtag.js) - Google Analytics