Java GC notes

Source: Internet
Author: User
Tags zookeeper

Tag: ROM gcc indicates running condition please accumulate Maintenance unit

Take HBase as an example: the GC log output path is set under the configuration file path of HBase/app/hbase-config/hbase-env.sh

export HBASE_OPTS="-Xmx16384m -Xms16384m -Xmn8192m -XX:PermSize=160M -XX:MaxPermSize=160M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC  -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=3  -XX:+CMSParallelRemarkEnabled -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime -XX:PrintFLSStatistics=1 -Xloggc:/app/hbase/logs/hbase_gc.log $HBASE_OPTS"

Information about log can be queried.

#jstat-gccause 79751 1000 1000//Get GC-related metrics, which indicates a 79751 garbage collection condition is queried every 1000 milliseconds.
usage:jstat-help|-options
?????? jstat-<option> [-t] [-h<lines>] <vmid> [<interval> [ <count>]]
? parameter interpretation:
options-option, we generally use-gcutil to view GC status
Vmid??? — VM's process number, that is, the currently running Java process number
interval– interval time, Units are seconds or milliseconds
count?? — number of prints, and if you print countless times by default

    S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT    LGCC                 GCC  0.00   8.98  11.16  69.83  12.33    156   50.788    16  280.103  330.891 unknown GCCause      No GC  0.00   8.98  12.79  69.83  12.33    156   50.788    16  280.103  330.891 unknown GCCause      No GC  0.00   8.98  14.94  69.83  12.33    156   50.788    16  280.103  330.891 unknown GCCause      No GC  0.00   8.98  16.04  69.83  12.33    156   50.788    16  280.103  330.891 unknown GCCause      No GC  0.00   8.98  17.98  69.83  12.33    156   50.788    16  280.103  330.891 unknown GCCause      No GC  0.00   8.98  20.34  69.83  12.33    156   50.788    16  280.103  330.891 unknown GCCause      No GC  0.00   8.98  21.83  69.83  12.33    156   50.788    16  280.103  330.891 unknown GCCause      No GC  0.00   8.98  22.64  69.83  12.33    156   50.788    16  280.103  330.891 unknown GCCause      No GC

Column E represents
o e-->o Cenozoic Transfer to the old generation, O accumulate to 80% will trigger full GC

The specific meanings are as follows:
E (said, Eden), the New Generation Eden area representing this server uses 11.16 of the space,
S0 S1 two survivor area (s0,s1 means Survivor0, Survivor1), Survivor0 inside is empty, Survivor1 accounted for 8.98%

The ages (O, old) and the permanent bands (P, which represent permanent) use 69.83% and 12.33% respectively of space.
Minor GC (YGC, which represents young GC) has occurred 156 times since the program was run, taking 50.788 seconds to complete;
Occurs Fulle GC (FGC, representing full GC) 16 times, full GC total time spent (FGCT, representing full GC time) is 330.891 seconds, total GC total duration (GCT, GC times) is 330.891 seconds
LGCC cause of last garbage Collection.
GCC cause of current garbage Collection.

The Java 6 JDK output is as follows:
[Email protected] logs]$ jmap-heap 29877

Attaching to process ID 29877, please wait ... Debugger attached successfully. Server compiler detected. JVM version is 20.45-b01using parallel threads in the new Generation.using thread-local object allocation. Concurrent mark-sweep gcheap configuration:minheapfreeratio = + Maxheapfreeratio = Maxheapsize = 214748364 20480.0MB NewSize = 4294967296 (4096.0MB) maxnewsize = 4294967296 (4096.0MB) oldsize =      5439488 (5.1875MB) Newratio = 2 Survivorratio = 8 PermSize = 67108864 (64.0MB) maxpermsize     = 67108864 (64.0MB) Heap usage:new Generation (Eden + 1 Survivor Space): capacity = 3865509888 (3686.4375MB) used = 481048576 (458.763671875MB) free = 3384461312 (3227.673828125MB) 12.444634470949257% Usededen space:capacity = 3436052480 (3276.875MB) used = 481048576 (458.763671875MB) free = 2955003904 (2818.111328125MB) 14.0000357 6196834% Usedfrom space:capacity = 429457408 (409.5625MB)  Used = 0 (0.0MB) free = 429457408 (409.5625MB) 0.0% usedto space:capacity = 429457408 (409.5625MB) used  = 0 (0.0MB) free = 429457408 (409.5625MB) 0.0% usedconcurrent mark-sweep generation:capacity = 12884901888  (12288.0MB) used = 0 (0.0MB) free = 12884901888 (12288.0MB) 0.0% usedperm generation:capacity = 67108864 (64.0MB) used = 21153816 (20.173851013183594MB) free = 45955048 (43.826148986816406MB) 31.5216422080994% Used
    • Eden from to 3 add up to the young area

[Email protected] ~]$ JPS
10424 Jps
8229 Hregionserver

[Email protected] ~]$ jmap-heap 8229
Attaching to process ID 8229, please wait ...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.71-B01

Using Thread-local object allocation.
Garbage-first (G1) GC with 6 thread (s)

Heap Configuration:
Minheapfreeratio = 40
Maxheapfreeratio = 70
Maxheapsize = 25769803776 (24576.0MB)
NewSize = 1363144 (1.2999954223632812MB)
Maxnewsize = 17592186044415 MB
Oldsize = 5452592 (5.1999969482421875MB)
Newratio = 2
Survivorratio = 8
PermSize = 16777216 (16.0MB)
MaxPermSize = 83886080 (80.0MB)
G1heapregionsize = 8388608 (8.0MB)

Heap Usage:
G1 Heap:
Regions = 3072
Capacity = 25769803776 (24576.0MB)
used = 20409483264 (19464.0MB)
Free = 5360320512 (5112.0MB)
79.19921875% used
G1 Young Generation:
Eden Space:
Regions = 89
Capacity = 1182793728 (1128.0MB)
used = 746586112 (712.0MB)
Free = 436207616 (416.0MB)
63.12056737588652% used
Survivor Space:
Regions = 20
Capacity = 167772160 (160.0MB)
used = 167772160 (160.0MB)
Free = 0 (0.0MB)
100.0% used
G1 Old Generation:
Regions = 2324
Capacity = 24419237888 (23288.0MB)
used = 19495124992 (18592.0MB)
Free = 4924112896 (4696.0MB)
79.83510821023704% used
Perm Generation:
Capacity = 50331648 (48.0MB)
used = 42303832 (40.344078063964844MB)
Free = 8027816 (7.655921936035156MB)
84.05016263326009% used

G1 GC Notes:

About maximum GC pause times
When doing minor GC and mixed GC, the collector maintains a remembered set in memory that contains references to all objects in the heap to determine what can be recycled.
At each GC, G1 calculates the time each region is reclaimed by using a predictive model to pick up the pause time in the region within Maxgcpausemillis for garbage collection
?

About mixed GC

Mixed GC is a garbage collection method that reclaims both young and old areas, and it triggers the condition that the-xx:initiatingheapoccupancypercent,mixed GC is designed to delay the generation of full GC

The same YGC refers to recycling Young's garbage collection method

Full GC refers to the garbage collection method of reclaiming old, because the older area is larger, resulting in a longer GC time, and during the GC the Java process is stopped externally, and itself does not respond externally, causing Regionserver to register heartbeat information to zookeeper, Over Zookeeper (<name>zookeeper.session.timeout</name>) session time, it will be zookeeper to dead.

Hbase G1 parameter adjustment:

Parameters to be modified, modifying GC parameters requires restarting the cluster and scheduling the next reboot.

-xx:concgcthreads=12 number of execution threads for concurrent tokens =================== test data concgcthreads cannot be greater than-xx:parallelgcthreads, or an error will be
-xx:initiatingheapoccupancypercent=60? The GC is triggered when the heap is occupied by default of 45
-XX:PARALLELGCTHREADS=12 30

[Email protected] ~]$ jstat-gccapacity 61540
NGCMN ngcmx NGC s0c s1c EC ogcmn ogcmx OGC OC pgcmn pgcmx PGC PC YGC FGC
0.0 52428800.0 2490368.0 0.0 294912.0 2195456.0 0.0 52428800.0 44695552.0 44695552.0 16384.0 81920.0 49152.0 49152.0 2 0

GC Common commands:

[Email protected] 0321 ~]$ jmap-heap 61540

Attaching to process ID 61540, please wait ... Debugger attached successfully. Server compiler detected. JVM version is 24.71-b01using thread-local object allocation.      Garbage-first (G1) GC with a thread (s) Heap configuration:minheapfreeratio = Maxheapfreeratio = Maxheapsize   = 53687091200 (51200.0MB) NewSize = 1363144 (1.2999954223632812MB) maxnewsize = 17592186044415 MB Oldsize = 5452592 (5.1999969482421875MB) Newratio = 2 Survivorratio = 8 PermSize = 1677  7216 (16.0MB) MaxPermSize = 83886080 (80.0MB) g1heapregionsize = 16777216 (16.0MB) Heap usage:g1 heap:regions = 2880 capacity = 48318382080 (46080.0MB) used = 2519304864 (2402.5963439941406MB) free = 45799077216 (43677    .40365600586MB) 5.213967760403951% usedG1 young Generation:eden space:regions = 7 capacity = 2248146944 (2144.0MB) used = 117440512 (112.0MB) free = 2130706432 (2032.0MB) 5.223880597014926% Usedsurvivor SpaCe:regions = capacity = 301989888 (288.0MB) used = 301989888 (288.0MB) free = 0 (0.0MB) 100.0% used   G1 old generation:regions = 126 capacity = 45768245248 (43648.0MB) used = 2099874464 (2002.5963439941406MB) Free = 43668370784 (41645.40365600586MB) 4.588059805705051% usedperm generation:capacity = 50331648 (48.0MB) US ed = 42610464 (40.636505126953125MB) free = 7721184 (7.363494873046875MB) 84.65938568115234% used13018 interne D Strings occupying 1388240 bytes.

[[email protected] ~]$ jstat-gccause-h 61540)

  S0 S1 E O P ygc ygct FGC fgct GCT lgcc GCC 0.00 100.00 92.54 2    0.26 85.06 1.794 0 0.000 1.794 G1 evacuation Pause No GC 0.00 100.00 92.54 20.26 85.06 16     1.794 0 0.000 1.794 G1 evacuation Pause No GC 0.00 100.00 92.54 20.26 85.06 16 1.794 0 0.000 1.794 G1 Evacuation Pause No GC 0.00 100.00 93.28 20.26 85.06 1.794 0 0.000 1.794 G1 evacuati  On Pause No GC 0.00 100.00 93.28 20.26 85.06 + 1.794 0 0.000 1.794 G1 evacuation Pause No GC 0.00   100.00 93.28 20.26 85.06 1.794 0 0.000 1.794 G1 evacuation Pause No GC 0.00 100.00 1.42 21.24 85.06 1.877 0 0.000 1.877 G1 evacuation Pause No GC 0.00 100.00 1.42 21.24 85.06 17 1.8    0 0.000 1.877 G1 evacuation Pause No GC 0.00 100.00 3.55 21.24 85.06 17 1.877 0 0.000 1.877 G1 Evacuation PausE No GC 0.00 100.00 3.55 21.24 85.06 + 1.877 0 0.000 1.877 G1 evacuation Pause No GC S0 S1     E O P ygc ygct FGC fgct GCT LGCC GCC 0.00 100.00 3.55 21.24 85.06    1.877 0 0.000 1.877 G1 evacuation Pause No GC 0.00 100.00 3.55 21.24 85.06 17 1.877 0 0.000 1.877 G1 Evacuation Pause No GC 0.00 100.00 3.55 21.24 85.06 1.877 0 0.000 1.877 G1 Evacuation Pause no GC 0.00 100.00 3.55 21.24 85.06 1.877 0 0.000 1.877 G1 evacuation Pause No GC 0.00 100.00 3.55 21.24 85.06 + 1.877 0 0.000 1.877 G1 evacuation Pause No GC 0.00 100.00 3.5 5 21.24 85.06 1.877 0 0.000 1.877 G1 evacuation Pause No GC 0.00 100.00 4.26 21.24 85.06 1 7 1.877 0 0.000 1.877 G1 evacuation Pause No GC 0.00 100.00 4.26 21.24 85.06 17 1.877 0 0 .1.877 G1 EvacuatIon Pause No GC 0.00 100.00 4.26 21.24 85.06 + 1.877 0 0.000 1.877 G1 evacuation Pause No GC 0.0      0 100.00 4.26 21.24 85.06 1.877 0 0.000 1.877 G1 evacuation Pause No GC S0 S1 E O P YGC ygct FGC fgct GCT lgcc GCC 0.00 100.00 4.26 21.24 85.06 17 1.87 7 0 0.000 1.877 G1 evacuation Pause No GC 0.00 100.00 4.26 21.24 85.06 17 1.877 0 0.000 1 .877 G1 Evacuation Pause No GC 0.00 100.00 4.26 21.24 85.06 1.877 0 0.000 1.877 G1 evacuation Pa Use no GC 0.00 100.00 4.26 21.24 85.06 + 1.877 0 0.000 1.877 G1 evacuation Pause No GC 0.00 100. XX 4.26 21.24 85.06 1.877 0 0.000 1.877 G1 evacuation Pause No GC

#jstat-gcutil 27912 1s 50

Java GC notes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.