Gargbage Collection (GC) Schemes
Gargbage Collection (GC) Schemes
e
t
CPU 0
CPU 1
CPU 2
CPU 3
CPU !
CPU "
CPU #
CPU $
GC active
46
C+$ 2ith 'arallelis#
=emar& is typically the largest pause
>
2$ten larger than -oung GC pauses
>
#arallel remar& availa*le since ?ava @ plat$orm
Single mar&ing threa
>
Can &eep up with EFC4 cpus, usually not more
>
#arallel concurrent mar& availa*le in ?ava B plat$orm
Single sweeping threa
>
1ess o$ a *ottlenec& than mar&ing
>
#arallel concurrent sweep coming soon
47
C+$ 'hases 2ith 'arallelis#
Java thread
GC thread
I
n
i
t
i
a
l
M
a
r
k
C
o
n
c
u
r
r
e
n
t
M
a
r
k
R
e
m
a
r
k
C
o
n
c
u
r
r
e
n
t
S
w
e
e
p
R
e
e
t
CPU 0
CPU 1
CPU 2
CPU 3
CPU !
CPU "
CPU #
CPU $
GC active
48
Concurrent +ar3 $2eep Collector
Scheuling o$ collection hanle *y GC
>
>ase on statistics in ?GM
>
2r 2ccupancy level o$ tenure generation
>'HH(CMSTrigger=atio
>'HH(CMSInitiating2ccupancy)raction
Concurrent +ar3
Concurrent +ar3
and $2eep 4C+$5
and $2eep 4C+$5
Garage Collector.
Garage Collector.
Incre#ental +ode
Incre#ental +ode
50
C+$ Collector in Incre#ental +ode
CMS Collector can *e use in a moe in which the
concurrent phases are one incrementally
>
Meant to lesson the impact o$ long concurrent phases *y
perioically stopping the concurrent phase to yiel *ac&
processing to the application
Can *e e0plicitly re;ueste with
>
-XX:+CMSIncreen!alMode
51
C+$ 'hases
Java thread
GC thread
I
n
i
t
i
a
l
M
a
r
k
C
o
n
c
u
r
r
e
n
t
M
a
r
k
i
n
t
e
r
l
e
a
v
e
d
w
i
t
h
a
p
p
l
i
c
a
t
i
o
n
R
e
m
a
r
k
C
o
n
c
u
r
r
e
n
t
S
w
e
e
p
R
e
e
t
CPU 0
CPU 1
CPU 2
CPU 3
CPU !
CPU "
CPU #
CPU $
GC active
52
Other Incre#ental C+$ Options
'HH(CMSIncremental<utyCycleIJn"> (e$ault( @5!
'HH(CMSIncremental<utyCycleMinIJn"> (e$ault(
K5!
'HH(LCMSIncremental#acing (e$ault( true!
"rgono#ics
"rgono#ics
54
J/+ "rgono#ics
Throughput Collector
Ergonomics ena*les the $ollowing(
>
Throughput gar*age collector an %aptive Si3ing
>
('HH (L9se#arallelGC 'HH(L9se%aptiveSi3e#olicy!
>
Initial heap si3e o$ KMBF o$ physical memory up to KG*yte
>
Ma0imum heap si3e o$ KMF o$ physical memory up to KG*
>
Server runtime compiler ('server!
To ena*le server ergonomics on NO'*it Winows, use
the $ollowing $lags(
>
'server 'Hm0Kg 'HH(L9se#arallelGC
>
Garying the heap si3e.
55
)sing J/+ "rgono#ics
Ma0imum pause time goal
>
'HH(Ma0GC#auseMillisI<nnn>
>
This is a hint, not a guarantee
>
GC will ajust parameters to try an meet goal
>
Can aversely e$$ect application throughput
Throughput goal
>
'HH(GCTime=atioI<nnn>
>
GC Time ( %pplication time I K M (K L nnn!
>
e.g. 'HH(GCTime=atioIK6 (@7 o$ time in GC!
)ootprint goal
>
2nly consiere i$ $irst two goals are met
Gargbage Collection (GC)
Gargbage Collection (GC)
Schemes
Schemes
Sang Shin
Sang Shin
Technology Evangelist Technology Evangelist
Sun Microsystems, Inc. Sun Microsystems, Inc.
www.javapassion.com www.javapassion.com
56