10 Ocak 2019 Perşembe

G1 Garbage Collector Seçenekleri

Giriş
G1 için tüm seçenekler burada.

-XX:MaxGCPauseMillis=n seçeneği
"Stop the World" evresinde en fazla ne kadar duraklama istediğimizi belirtiriz.
Sets a target for the maximum GC pause time. This is a soft goal, and the JVM will make its best effort to achieve it.
Bu değeri vermekte fayda var. Açıklaması şöyle
The Eden(Young Gen) Memory is determined by Heuristics collected by the G1 collector on every GC. It adjusts the Young Gen according to the GC history so that the maximum pause time matches your target pause time. If your target pause time is short, the eden memory can be short.

If nothing is set, the target pause time by default is 200ms.
Açıklaması şöyle.
If adaptive sizing is turned on, then you can use the MaxGCPauseMillis flag to tune GC behavior. This flag sets a target for the maximum GC pause time. When used with the Parallel collector, the JVM will adjust the size of the young and old generations in order to try and meet the goal. It will then adjust the size of the heap so that the time spent in GC does not exceed a certain value, which is, by default, 1 percent.
-XX:InitiatingHeapOccupancyPercent=n seçeneği
Heap'in yüzde kaçı dolu ise Concurrent GC döngüsü başlatılacağını belirtir.
Percentage of the (entire) heap occupancy to start a concurrent GC cycle. It is used by GCs that trigger a concurrent GC cycle based on the occupancy of the entire heap, not just one of the generations (e.g., G1). A value of 0 denotes 'do constant GC cycles'. The default value is 45.
Açıklaması şöyle.
This flag is set to 45 by default. This means that a GC cycle is triggered when the heap becomes 45 percent filled. Reducing this value means GC would get triggered earlier and more often. But care should be taken that the value is not set to a number that's too low which would result in GCs happening too frequently.
-XX:NewRatio=n seçeneği
Bu seçenek aslında JVM sizing options başlığı altında düşer.
Ratio of new/old generation sizes. The default value is 2.
-XX:SurvivorRatio=n seçeneği
Bu seçenek aslında JVM sizing options başlığı altında düşer.
Ratio of eden/survivor space size. The default value is 8.
-XX:MaxTenuringThreshold=n seçeneği
Maximum value for tenuring threshold. The default value is 15.
-XX:ParallelGCThreads=n seçeneği
Sets the number of threads used during parallel phases of the garbage collectors. The default value varies with the platform on which the JVM is running.
Bu thread'ler "Stop the World" evresinde koşarlar. Açıklaması şöyle.
G1 has both concurrent (runs along with application threads, e.g., refinement, marking, cleanup) and parallel (multi-threaded, e.g., stop the world) phases. Full garbage collections are still single threaded, but if tuned properly your applications should avoid full GCs.
-XX:ConcGCThreads=n seçeneği
Kaç tane thread kullanılacağını belirtir. Concurrent thread'ler uygulama thread'leri ile beraber koşar.
Number of threads concurrent garbage collectors will use. The default value varies with the platform on which the JVM is running.
Açıklaması şöyle.
The default value for this flag is set to the value of ParallelGCThreads plus 2, divided by 4. As long as you have sufficient CPU available on the machine, you can increase this value without incurring any performance penalties.
-XX:G1ReservePercent=n seçeneği
Sets the amount of heap that is reserved as a false ceiling to reduce the possibility of promotion failure. The default value is 10.
Elimizde çok fazla humongous object varsa elle bu değeri değiştirmek gerekebilir.

-XX:G1HeapRegionSize=n 
seçeneği
Normalde bu seçeneği kullanmaya gerek yok. JVM otomatik hesaplıyor. Ancak elimizde çok fazla humongous object varsa elle bu değeri değiştirmek gerekebilir.
Örnek
Bu değeri değiştirmek için şöyle yaparız
XX:G1HeapRegionSize=4M


Hiç yorum yok:

Yorum Gönder