-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
343 lines (336 loc) · 11.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title></title>
<meta name="author" content="(remigius)"/>
<style type="text/css">
.underline { text-decoration: underline; }
</style>
<link rel="stylesheet" href="./reveal.js/css/reveal.css"/>
<link rel="stylesheet" href="./reveal.js/css/theme/league.css" id="theme"/>
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = './reveal.js/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<style type="text/css">.playback { display:none; }</style>
<script src="processing.min.js"></script>
<script type="text/javascript">/*Processing.disableInit();*/</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<section id="slide-org6da91de" data-autoslide="6666">
<h2 id="org6da91de">Garbage Collection in the HotSpot JVM 1.8</h2>
<p class="fragment appear">
HotSpot Java Virtual Machine (JVM) only
</p>
<p class="fragment appear">
Focus on version 1.8
</p>
</section>
</section>
<section>
<section id="slide-org49e2608" data-autoslide="6666">
<h2 id="org49e2608">Motivation & Goal</h2>
<p class="fragment appear">
Manage object life-cycle automatically
</p>
<p class="fragment appear">
Free as much memory as fast as possible
</p>
</section>
<section id="slide-org3d9d76f" data-state="mainjob" data-autoslide="5000">
<h3 id="org3d9d76f">Main Job</h3>
<canvas id="mainjob-canvas"></canvas>
<p class="fragment appear">
Scan for unused objects
</p>
<p class="fragment appear">
Remove them from memory
</p>
<p class="fragment appear">
Compact the memory in use
</p>
</section>
</section>
<section>
<section id="slide-orga562339" data-autoslide="5000">
<h2 id="orga562339">Preliminary Concepts</h2>
<p class="fragment appear">
<code>Heap</code> is the part of the memory processed by the garbage collector
</p>
<p class="fragment appear">
<code>Stop-the-world pauses</code> freeze the application from a user's perspective
</p>
<p class="fragment appear">
Many objects are short-lived (eg. created in a loop)
</p>
</section>
<section id="slide-org0954b19" data-autoslide="4000">
<h3 id="org0954b19">Client and Server class</h3>
<p class="fragment appear">
JVM automatically classifies machine as <code>client</code> or <code>server</code>
</p>
<p class="fragment appear">
May be overridden with command line flags
</p>
<p class="fragment appear">
32-Bit JVM with single core or on Windows leads to <code>client</code>
</p>
<p class="fragment appear">
Everything else, esp. all 64-Bit JVMs, lead to <code>server</code>
</p>
</section>
<section id="slide-org2022b8c" data-state="generational" data-autoslide="3333">
<h3 id="org2022b8c">Generational Heap</h3>
<canvas id="generational-canvas"></canvas>
<p class="fragment appear">
All garbage collectors split the heap into generations
</p>
<p class="fragment appear">
Old generation and young, further divided
</p>
<p class="fragment appear">
Eden space where new objects are created
</p>
<p class="fragment appear">
And two survivor spaces used alternating
</p>
<p class="fragment appear">
Objects are basically promoted from one generation to next
</p>
</section>
<section id="slide-org3acbb5a" data-autoslide="4000">
<h3 id="org3acbb5a">Generational Heap - Benefits</h3>
<p class="fragment appear">
Allows different algorithms for young and old generation
</p>
<p class="fragment appear">
Faster to scan young generation
</p>
<p class="fragment appear">
Shorter stop-the-world pauses
</p>
</section>
</section>
<section>
<section id="slide-org123e915" data-autoslide="4000">
<h2 id="org123e915">Algorithms</h2>
<p class="fragment appear">
Serial Garbage Collector - Single-threaded
</p>
<p class="fragment appear">
Throughput Collector - Multi-threaded
</p>
<p class="fragment appear">
Concurrent Mark and Sweep (CMS) Collector - Minimizes pauses
</p>
<p class="fragment appear">
Garbage First (G1) Collector - Minimizes pauses with large heaps
</p>
</section>
</section>
<section>
<section id="slide-org01a43f2" data-autoslide="4000">
<h2 id="org01a43f2">Serial Garbage Collector</h2>
<p class="fragment appear">
Default for <code>client class</code> machines
</p>
<p class="fragment appear">
Single-threaded collection of new and old generation
</p>
<p class="fragment appear">
Stop-the-world pauses for both collections
</p>
<p class="fragment appear">
Compacts the old generation on collection
</p>
</section>
</section>
<section>
<section id="slide-org6f56c0a" data-autoslide="3333">
<h2 id="org6f56c0a">Througput Collector</h2>
<p class="fragment appear">
Default for <code>server class</code> machines
</p>
<p class="fragment appear">
Collects multi-threaded
</p>
<ul><li style="list-style-type: none;" class="fragment appear">Two operations:</li>
<li class="fragment appear">Minor collection</li>
<li class="fragment appear">Full collection</li>
</section>
<section id="slide-orgcf078ff" data-state="throughput-minor" data-autoslide="3333">
<h3 id="orgcf078ff">Throughput - Minor Garbage Collection</h3>
<canvas id="throughput-minor-canvas"></canvas>
<p class="fragment appear">
Occurs when <code>eden space</code> occupancy exceeds threshold
</p>
<p class="fragment appear">
Promotes everything out of <code>eden space</code>
</p>
<p class="fragment appear">
Most of the objects are garbage and can be removed
</p>
<p class="fragment appear">
Some are promoted to the <code>survivor space</code>
</p>
<p class="fragment appear">
Other survivor space is cleared as well, some promotions to <code>old</code>
</p>
</section>
<section id="slide-org6bb0ad6" data-state="throughput-major" data-autoslide="5000">
<h3 id="org6bb0ad6">Throughput - Major Garbage Collection</h3>
<canvas id="throughput-major-canvas"></canvas>
<p class="fragment appear">
Occurs when <code>old generation</code> occupancy exceeds threshold
</p>
<p class="fragment appear">
Cleans or promotes everything out of <code>young generation</code>
</p>
<p class="fragment appear">
Cleans everything out of <code>old generation</code> without active references
</p>
</section>
</section>
<section>
<section id="slide-org92fc411" data-autoslide="3333">
<h2 id="org92fc411">Concurrent Mark and Sweep Collector</h2>
<p class="fragment appear">
Tries to eliminate long pauses during full GC
</p>
<ul><li style="list-style-type: none;" class="fragment appear">Three operations:</li>
<li class="fragment appear">Young collection - similar to <code>Throughput</code></li>
<li class="fragment appear">Full collection - similar to <code>Throughput</code></li>
<li class="fragment appear">Concurrent cycle</li></ul>
</section>
<section id="slide-org9dda899" data-state="cms-concurrent" data-autoslide="5000">
<h3 id="org9dda899">CMS - Concurrent Cycle</h3>
<canvas id="cms-concurrent-canvas"></canvas>
<p class="fragment appear">
JVM starts a concurrent cycle when heap sufficiently full
</p>
<p class="fragment appear">
Consists of multiple phases, two of them are <code>stop-the-world</code>
</p>
<p class="fragment appear">
<code>Old generation</code> is not compacted
</p>
</section>
</section>
<section>
<section id="slide-org836ab4d" data-autoslide="2500">
<h2 id="org836ab4d">Garbage First (G1) Collector</h2>
<p class="fragment appear">
Minimizes pauses for large heaps (>4GiB)
</p>
<p class="fragment appear">
Divides heap into regions but still generational
</p>
<ul><li style="list-style-type: none;" class="fragment appear">Four operations:</li>
<li class="fragment appear">Young collection</li>
<li class="fragment appear">Background, concurrent cycle</li>
<li class="fragment appear">Mixed collection</li>
<li class="fragment appear">Full collection</li></ul>
</section>
<section id="slide-org640d9a7" data-state="g1-minor" data-autoslide="5000">
<h3 id="org640d9a7">G1 - Young Collection</h3>
<canvas id="g1-minor-canvas"></canvas>
<p class="fragment appear">
<code>G1 young collection</code> triggered when eden regions fill up
</p>
<p class="fragment appear">
After collection there are no regions assigned to <code>eden</code>
</p>
<p class="fragment appear">
and at least one region assigned to <code>survivor</code>
</p>
</section>
<section id="slide-orgf3aebbe" data-state="g1-marking" data-autoslide="5000">
<h3 id="orgf3aebbe">G1 - Background Marking Cycle</h3>
<canvas id="g1-marking-canvas"></canvas>
<p class="fragment appear">
Several phases, some of them <code>stop-the-world</code>
</p>
<p class="fragment appear">
At least one young collection during marking cycle
</p>
<p class="fragment appear">
Marks old regions containing mostly garbage
</p>
</section>
<section id="slide-orgf1807ba" data-state="g1-mixed" data-autoslide="5000">
<h3 id="orgf1807ba">G1 - Mixed Collection</h3>
<canvas id="g1-mixed-canvas"></canvas>
<p class="fragment appear">
Uses input of marking cycle
</p>
<p class="fragment appear">
Combine young collection with collection of marked regions
</p>
<p class="fragment appear">
Non-garbage of marked regions moved to other regions
</p>
</section>
</section>
<section>
<section id="slide-orgdbd7905" data-autoslide="6666">
<h2 id="orgdbd7905">Summary</h2>
<p class="fragment appear">
Throughput collector (and basically Serial too) maximize throughput
</p>
<p class="fragment appear">
Concurrent collectors (CMS & G1) minimize pauses
</p>
</section>
</section>
<section>
<section id="slide-org230178e" data-background="./media/would_you_like_to_know_more.jpg" data-autoslide="2000">
<h2 id="org230178e"></h2>
<img src="media/java_performance_the_definitive_guide_cover.jpeg" height="250px">
</section>
</section>
</div>
</div>
<script src="./reveal.js/lib/js/head.min.js"></script>
<script src="./reveal.js/js/reveal.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: false,
progress: false,
history: false,
center: true,
slideNumber: false,
rollingLinks: false,
keyboard: true,
overview: false,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'slide', // default/cube/page/concave/zoom/linear/fade/none
transitionSpeed: 'default',
multiplex: {
secret: '', // null if client
id: '', // id, obtained from socket.io server
url: '' // Location of socket.io server
},
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'processingutils.js' }, { src: 'processing-animation-initialisations.js'},
{ src: './reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: './reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: './reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: './reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: './reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }]
,autoSlide: 2000, overview: true,});
</script>
</body>
</html>