20110809

The maximum heap size of a Java application is limited by three factors

1、the process data model (32-bit or 64-bit) and the associated operating system limitations(what?)

2、the amount of virtual memory available on the system

3、the amount of physical memory available on the system

 

Committing too much of a system's physical memory is likely to result in paging of virtual memory to disk, quite likely during garbage collection operations, leading to significant performance issues。

 

young generation size:

1、the largest recommended value for the young generation is 3/8 of the maximum heap size.

Note that with the throughput and low pause time collectors it may be possible to exceed this ratio 

 

Garbage Collector Policy

The -XX:+UseParallelsGC parallel (throughput) garbage collector, or

The -XX:+UseConcMarkSweepGC concurrent (low pause time) garbage collector (also known as CMS)

The -XX:+UseSerialGC serial garbage collector (for smaller applications and systems)

 

Tuning for low pause times and high throughput

==加大new size,以及survivor size,减少minor gc;尽量减少gc的活动,以把cpu全部给应用;

一般应用于后台任务,非对外对外提供服务的应用;

 

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=31 

 

Comments:

-XX:+UseConcMarkSweepGC -XX:+UseParNewGC 

Selects the Concurrent Mark Sweep collector. This collector may deliver better response time properties for the application (i.e., low application pause time). It is a parallel and mostly-concurrent collector and and can be a good match for the threading ability of an large multi-processor systems.

-XX:SurvivorRatio=8 

Sets survivor space ratio to 1:8, resulting in larger survivor spaces (the smaller the ratio, the larger the space). Larger survivor spaces allow short lived objects a longer time period to die in the young generation.

-XX:TargetSurvivorRatio=90 

Allows 90% of the survivor spaces to be occupied instead of the default 50%, allowing better utilization of the survivor space memory.

-XX:MaxTenuringThreshold=31 

Allows short lived objects a longer time period to die in the young generation (and hence, avoid promotion). A consequence of this setting is that minor GC times can increase due to additional objects to copy. This value and survivor space sizes may need to be adjusted so as to balance overheads of copying between survivor spaces versus tenuring objects that are going to live for a long time. The default settings for CMS are SurvivorRatio=1024 and MaxTenuringThreshold=0 which cause all survivors of a scavenge to be promoted. This can place a lot of pressure on the single concurrent thread collecting the tenured generation. Note: when used with -XX:+UseBiasedLocking, this setting should be 15.

 

参考

server-class machine detection

http://download.oracle.com/javase/1.5.0/docs/guide/vm/server-class.html

 

http://www.oracle.com/technetwork/java/tuning-139912.html

http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html

http://www.oracle.com/technetwork/java/ergo5-140223.html

 

java6 performance tuning

http://www.oracle.com/technetwork/java/6-performance-137236.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值