- 浏览: 518759 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (161)
- 多线程与并发编程 (20)
- 算法和数据结构 (8)
- 缓存 (0)
- HttpClient (2)
- 疑难杂症 (11)
- Java内存管理 (17)
- 分布式开发 (14)
- Linux常用命令 (10)
- OSGI (0)
- UML (2)
- 趣味面试题 (5)
- 设计模式 (8)
- Java类加载 (2)
- JSTL (1)
- Web 服务器 (4)
- IT人生 (3)
- Java基础 (11)
- Flash技术 (7)
- 新知识 (3)
- 常用速备速查 (4)
- 版本控制 (1)
- Java集合工具类 (6)
- web前端技术 (1)
- 趣味话题 (1)
- 安全 (0)
- 架构设计 (5)
- Spring (4)
- 负载均衡技术 (2)
- 持久层技术 (2)
- MySQL单机多实例方案 (1)
- 收藏备用 (0)
- 性能优化 (3)
最新评论
-
liuwuhen:
...
Pushlet的工作原理 -
fbwfbi:
fengchuizhuming 写道楼主的完全正确。鉴定完毕楼 ...
硬件同步原语(CAS)理论 -
passerby_whu:
uule 写道这个测试后结果为:“testPageConten ...
FutureTask的使用方法和使用实例 -
fengchuizhuming:
楼主的完全正确。鉴定完毕
硬件同步原语(CAS)理论 -
edwardjuice:
FutureTask的使用方法和使用实例
今天终于有所斩获,发现了Sun Hotspot JVM GC最全的参数调整列表:
http://blogs.sun.com/watt/resource/jvm-options-list.html
http://www.cnblogs.com/totti19841106/archive/2009/01/12/1374274.html
有关JVM默认值的参考资料如下:
https://gist.github.com/827140
http://hg.openjdk.java.net/jdk6/jdk6/hotspot/file/tip/src/share/vm/runtime/globals.hpp
Java 5以上版本(包含Java 5)GC的调整参数包含以下内容:
1.虚拟机GC性能调整工具参数:
–XX:+PrintGCDetails:
–XX:+PrintGCTimeStamps:
-XX:-DisableExplicitGC
-XX:+UseGCOverheadLimit
-XX:+StringCache
-XX:LargePageSizeInBytes=4m
-Xnoclassgc
-XX:MaxTenuringThreshold=<n>
指定一个 object 在经历了 n 次 young gc 后转移到 old generation 区 , 在 linux64 的 java6 下默认值是 15, 此参数对于 throughput collector 无效 , 如 :-XX:MaxTenuringThreshold=31
-XX:+UseFastAccessorMethods
get,set 方法转成本地代码
-XX:+PrintGCApplicationStoppedTime
打应垃圾收集时 , 系统的停顿时间 , 如 :
Total time for which application threads were stopped: 0.0225920 seconds
-Xmn<n>
指定 jvm 中 New Generation 的大小 , 如 :-Xmn256m。 这个参数很影响性能, 如果你的程序需要比较多的临时内存, 建议设置到512M, 如果用的少, 尽量降低这个数值, 一般来说128/256足以使用了。
-Xss<n>
指定线程桟大小 , 如 :-Xss128k, 一般来说,webx框架下的应用需要256K。 如果你的程序有大规模的递归行为, 请考虑设置到512K/1M。 这个需要全面的测试才能知道。 不过, 256K已经很大了。 这个参数对性能的影响比较大的。
-XX:PretenureSizeThreshold =<value>:当对象大于该值就直接分配到堆的 ‘老生代’ 区域
2.GC的关键选项参数:
2.1堆和代的大小调整参数
Option | Default | Description |
-Xms<n> | Initial size, in bytes, of the heap. | |
–Xmx<n> | Maximum size, in bytes, of the heap. | |
–XX:MinHeapFreeRatio=minimum and –XX:MaxHeapFreeRatio=maximum |
40 (min) 70 (max) |
Target range for the proportion of free space to total heap size. These are applied per generation. For example, if minimum is 30 and the percent of free space in a generation falls below 30%, the size of the generation is expanded so as to have 30% of the space free. Similarly, if maximum is 60 and the percent of free space exceeds 60%, the size of the generation is shrunk so as to have only 60% of the space free. |
–XX:NewSize=n | Default initial size of the new (young) generation in bytes. |
|
–XX:NewRatio=n | 2 on client JVM, 8 on server JVM |
Ratio between the young and old generations. For example, if n is 3, then the ratio is 1:3 and the combined size of Eden and the survivor spaces is one fourth of the total size of the young and old generations. |
–XX:SurvivorRatio=n | 32 | Ratio between each survivor space and Eden. For example, if n is 7, each survivor space is one–ninth of the young generation (not one–eighth, because there are two survivor spaces). |
–XX:MaxPermSize=n | Platform–dependent | Maximum size of the permanent generation. |
2.3垃圾回收器选择参数
Option | Garbage Collector Selected |
–XX:+UseSerialGC | 串行回收器 |
–XX:+UseParallelGC | 并行回收器 |
–XX:+UseParallelOldGC | Parallel compacting |
–XX:+UseConcMarkSweepGC | Concurrent mark–sweep (CMS) |
2.4并行(Java5 以及以上版本-Server 模式默认的垃圾回收器)和并行压缩垃圾回收器的GC调整参数
Option | Default | Description |
–XX:ParallelGCThreads=n | The number of CPUs | Number of garbage collector threads. |
–XX:MaxGCPauseMillis=n | No default | Indicates to the collector that pause times of n milliseconds or less are desired. |
–XX:GCTimeRatio=n | 99 | Number that sets a goal that 1/(1+n) of the total time be spent on garbage collection. |
2.5 CMS垃圾回收器的GC调整参数
Option | Default | Description |
–XX:+CMSIncrementalMode | Disabled | Enables a mode in which the concurrent phases are done incrementally, periodically stopping the concurrent phase to yield back the processor to the application. |
–XX:+CMSIncrementalPacing | Disabled | Enables automatic control of the amount of work the CMS collector is allowed to do before giving up the processor, based on application behavior. |
–XX:ParallelGCThreads=n | The number of CPUs | Number of garbage collector threads for the parallel young generation collections and for the parallel parts of the old generation collections. |
补充参数:
-XX:CMSInitiatingOccupancyFraction
-XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled
-XX:+UseCMSInitiatingOccupancyOnly
指示只有在 old generation 在使用了初始化的比例后 concurrent collector 启动收集
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
http://www.md.pp.ru/~eu/jdk6options.html
发表评论
-
JVM四种对象引用类型
2011-05-17 16:27 1553JVM 中将对象的引用分为了四种类型,不同的对象引用类型会造成 ... -
Garbage First - Card Table
2011-05-12 17:36 1452之前一直以为只是在Garbage First垃圾回收器中,有C ... -
Red5 0.7和0.9 版本配置远程JConsole监控
2010-12-12 16:23 2517JConsole可以帮助你监控虚拟机的状态,垃圾回收的时间,调 ... -
Java内存Dump文件查看和分析工具介绍
2010-12-06 16:51 15539为了查red5-0.7.0的内存泄露问题,由于dump文件太大 ... -
深入垃圾收集器与内存分配策略
2010-11-05 15:45 1375Java与C++之间有一堵由 ... -
实战OutOfMemoryError(转)
2010-11-05 15:41 1766实战 OutOfMemoryError 上述区域中 ... -
JVM 运行时区域划分(转载)
2010-11-05 15:39 1574VM 运行时数据区域 JVM 执行 Java ... -
使用jconsole远程监控linux下tomcat使用情况
2010-10-26 09:11 3672启动tomcat/bin/startup.sh中增加一下变量: ... -
Eclipse经常出现OutOfMemory错误,如何解决
2010-04-15 16:59 23050今天有个同事问我一个问题,他的Eclipse经常出现OutOf ... -
Java内存泄露示例代码总汇
2010-04-09 13:57 3563Java尽管采用自动的内存 ... -
HotSpot VM - OutOfMemory Error 总汇
2010-04-06 16:02 2209OutOfMemory Error表明Java 堆没有足够的内 ... -
Java内存管理-Permanent Space
2010-03-10 13:21 4990VM 的Permanent generation space, ... -
JVM -Server -Client 模式
2010-03-10 09:39 2755JVM -Server 与 -Client启动,最主要的差别在 ... -
Java内存管理-监控工具篇
2010-03-09 22:31 120651.JConsole Jconsole,Java ... -
Java内存管理基础篇 - Java内存回收-常见的垃圾回收策略
2010-03-08 16:33 1719Java的内存使用完之后,是通过JVM的GC进行回收的。 ... -
Java内存管理基础篇 - Java内存分配
2010-03-04 22:19 29661.简介 现摘录一段Java5内存管理白皮书中的 ...
相关推荐
jvm配置参数详解,以及Java gc详解
本文档可以作为学习JVM GC的工具书所使用,对于想深入学习JVM GC原理的同学,这一本书就足够了。因为本文档是作者花费数月时间,查阅GC相关的国内外众多资料并加以思路清晰的条目化而形成。因为篇幅所限,可能有部分...
Sun JVM原理与内存管理
java6 JVM 调优参数大全 -XX
jvmgc过程介绍(jpg)
JAVA应用JVM原理及参数调优深入讲解视频.5 JAVA应用JVM原理及参数调优深入讲解视频.6 JAVA应用JVM原理及参数调优深入讲解视频.7 JAVA应用JVM原理及参数调优深入讲解视频.8 JAVA应用JVM原理及参数调优深入讲解视频.9 ...
JVM GC垃圾回收.pdf
Java 6 JVM参数选项大全, 希望对大家有帮助!
jvm 配置jvm参数 配置jvm参数
如何配置jvm参数,并且调优,适合各路开发者,
JVM参数设置,提供java虚拟机运行时的参数设置
Java JVMJava JVMJava JVM
GC有两种类型:Scavenge GC(也称Young GC)和Full GC。 一般Full GC时,机器的Load会升高,应用也会停止响应一会(持续长达几秒),如果应用一直频繁的进行FullGC,一方面会出现应用无法提供正常服务,另一方面...
详细介绍JVM命令行参数,详细会对你有所帮助的。
java进阶必备书籍,高清版。带目录结构。方便阅读,书中内容讲的透彻
jvm gc jvm gc jvm调优 查看工具
JVM参数使用说明
Java 6 JVM 参数选项大全(中文版) 作者:KenWu Email:ken.wug@gmail.com 转载本文档请注明原文链接 http://kenwublog.com/docs/java6-jvm-options-chinese-edition.htm! 本文是基于最新的SUN官方文档...
JVM_GC调优