태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

'PretenureSizeThreshold'에 해당되는 글 1건

  1. 2007.10.19 [Sun Java Forum] PretenureSizeThreshold의 의미... (1)

[Sun Java Forum] PretenureSizeThreshold의 의미...

Enterprise Java 2007.10.19 23:39
PretenureSizeThreshold 옵션을 사용해본 사람이 있는지 모르겠다.
이 옵션은 Object를 Young Generation을 거치지 않고 Old Generation에 직접 저장하는 기능을 활성화한다.
가령 이 값이 1000이면 1000바이트 이상되는 Object들은 Old Generation으로 직접 들어가게 된다.
왜 이런 옵션을 사용할까?
  • 특정 크기 이상의 Object가 Long-Lived, 즉 장수하고 있다는 사실을 미리 알고 있다면...
  • 이런 Object들을 Young Generation에 살게 했다가 나이가 들면 다시 Old Generation으로 옮기는 일련의 과정이 오버헤드가 된다.
  • 따라서 PretenureSizeThreshold 옵션을 사용하면 이런 오버헤드를 줄일 수 있다.
상당히 좋은 기능이다.
하지만, Application을 작성해본 사람은 다 알겠지만, 이렇게 심플한 상황이 어디 흔한가? 크기가 큰 객체도 단명(Short Lived)하는 경우가 비일비재하다. 그런 경우에 이 옵션을 사용했다가는 마치 암 환자를 요양소에 밀어 놓는 꼴이고, 불필요한 Full GC를 유발하게 된다.

아래 글이 이런 내용에 대해 논의를 하고 있다.
이런 옵션을 사용하고 또 이런 내용이 공개적으로 토론이 된다는 사실이 부러울 뿐이다.
(아래 Dion_Cho 가 본인...)

혹시 이 글을 읽는 사람들 중에 CMS Collector를 사용하고 있는 사람은 얼마나 되는지 모르겠다.
언젠가 한번 설문조사를 해보아야 할 듯 하다...


DiegoCarzaniga
Posts:109
Registered: 12.01.06
Using -XX:PretenureSizeThreshold
Oct 17, 2007 2:56 AM

Hi guys,

I hava a question about Gargabe Collector tuning.

My real time application generates every second (with a certainquantity of traffic) some objects with long time life (MEMORY_OLD), andsome with short long life (MEMORY_YOUNG).

After a code review I reduced the quantity of objects created, in orderto optimize GC pauses and frequency. The ratio MEMORY_YOUNG/MEMORY_OLDis augmented to about 3.3.

With this ratio i choose these JVM options:
-Xmx1024m -Xms1024m -XX:MaxNewSize=16m -XX:NewSize=16m

The problem is that with a so high MEMORY_YOUNG/MEMORY_OLD ratio, everyGC young copies many objects to Tenured space... this augments GC YOUNGpauses to about 70 ms. To make smaller these pauses I could sizesmaller -XX:MaxNewSize, but in this way GC young frequency will augmenttoo much causing problems during CMS phases.

So I though about -XX:PretenureSizeThreshold option that copies objects bigger than defined size, directly into Tenured Space.
Does something know if this option can be useful in this scenario?
Tuning it with the right size could be avoid unnecesary promotion toTenure Space... but on the other side it will copy to tenured spacealso objects that otherwise will die in Eden space at the first GCYoung.

Can anyone give me some advice?

Thank you very much all in advance
Diego
Dion_Cho
Posts:60
Registered: 9/6/07
Re: Using -XX:PretenureSizeThreshold
Oct 18, 2007 6:11 AM (reply 1 of 2)

1. Young generation = 16M? Is this just mistake or really 16M? Don'tyou think young generation size is way too small? Especially when yourjava heap size is 1G?
I'm not quite sure about the structure of your app... But, if younggeneration size is this too small, minor gc occurs too frequently andmore objects would be promoted to old generation without any chance tobe collected(as you told yourself in original post)

You can try -XX:+UseParNewGC with bigger young generation size if you're on multiple CPU.
(You may be already turning this option on in recent version...)

2. If you're worried about stop-the-world full gc under CMS collector,you can tweak following options: CMSInitiatingOccupancyFraction,CMSIncrementalMode, UseCMSInitiatingOccupancyOnly, ...
Consult JVM garbage collector tuning guide for more info.

3. PretenureSizeThreshold option exactly matches your request. Justwant to check one thing. Is your big object is a real "one" bigobject(like big array) or just a set of small objects? In latter case,it would not go directly to tenured generation.

Anyway, what JVM version and optionally what OS are you on? Coz every version has its own GC features...

DiegoCarzaniga
Posts:109
Registered: 12.01.06
Re: Using -XX:PretenureSizeThreshold
Oct 18, 2007 7:13 AM (reply 2 of 2)

Thank you Dion_Cho!
My EDEN SPACE is about 16M.... it's not a mistake.
My application is a real time one which needs short stop-the-worldpauses in order to avoid protocol retransmission (which could casecongestion of the application).
So I prefer smaller GC YOUNG pauses.... although in this way GC YOUNG frequency is very high.

I'm using 1.4 JVM on a Sun machine.

I'm already using -XX:+UseConcMarkSweepGC and -XX:+UseParNewGC.

Regard to PretenureSizeThreshold... I tried to set it to 1000 B. Inthis way some big objects can be directly promoted to the TENUREDSPACE. Unfortunately performance didn't improve, probably because inthis way not only old objects, but also some young objects sarepromoted directly.

Thank you again for your reply
Diego


신고
Trackback 0 : Comment 1
  1. FryRachael32 2011.12.01 12:22 Modify/Delete Reply

    관리자의 승인을 기다리고 있는 댓글입니다

Write a comment

티스토리 툴바