Soothing Excited Garbage Collector

I have a program that works very happily with -Xmx2g. With -Xmx1ghe stops. He never gets an exception from memory - or at least I never had the patience to wait long enough.

This suggests that the total size of the place fits into 1g, but that the GC is experiencing some concern about a possible exit from space.

Memory capacity is a combination of some large, stable elements with lots of ephemeral traffic.

Are any more or less obscure GC options applicable to this situation?

+3
source share
4 answers

OOME . , , GC , . , , 1 0,01 GC, , - 0,01 1 GC . , , 512 . 1 .

VisualVM VisualGC - ; , .

+2

JVM , http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html. - GC, , . , , .

, , , VisualVM ( JDK6, , 7+) . hprof ( .hprof?).

+4

, JVM . , 1 , . , , .

, , W1, , , W2, , . ( , , ... .)

, 1Gb 0.9Gb, . , GC , 0,1 , W1 * 0.9Gb + W2 * 0.1Gb . (W1 * 0.9Gb + W2 * 0.1Gb) / 0.1Gb; .. 9 * W1 + W2.

, 2Gb 0.9Gb, . (W1 * 0.9Gb + W2 * 1.1Gb) / 1.1Gb W1 * 9/11 + W2.

, , GC W1 * 8 , 1Gb, 2Gb.

, , . :

  • JVM

  • JVM OOM, GC , () 25% .

+3

If you do not fine-tune, you should check the parameters MinHeapFreeRatioand MaxHeapFreeRatioamong the others described here Java SE 6 HotSpot [tm] Configuring the settings for the garbage of a virtual machine this can lead to a "tranquilizer effect".

0
source

Source: https://habr.com/ru/post/1733096/


All Articles