-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.html
317 lines (259 loc) · 8.79 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>From CRUD to Event Sourcing</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<link rel="stylesheet" href="css/custom.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal" id="presentation">
<div class="slides">
<section>
<h2>From CRUD to Event Sourcing</h2>
<p style="font-style: italic;">Why CRUD is the wrong approach for microservices</p>
<p style="margin-top: 100px; font-weight: bold;">James Roper</p>
<p><tt>@jroper</tt></p>
<img style="width: 30%; margin-top: 50px; border: none; background: none; box-shadow: none;" src="assets/lightbend-logo.svg"/>
</section>
<section>
<h2>Agenda</h2>
<ul>
<li class="fragment">Failure test CRUD solutions</li>
<li class="fragment">Learn about Event Sourcing</li>
<li class="fragment">See why Event Sourcing is resilient</li>
<li class="fragment">Live coding!</li>
</ul>
</section>
<section>
<section>
<h2>Holiday Rentals</h2>
<ul>
<li class="fragment">Airbnb like application</li>
<li class="fragment">Asynchronous microservice architecture</li>
<li class="fragment">Kafka for messaging</li>
<li class="fragment">Reservation service uses CRUD persistence</li>
</ul>
</section>
<section>
<h2>Architecture</h2>
<img src="assets/architecture.png" />
</section>
</section>
<section>
<section>
<h2>Service implementation</h2>
<ul>
<li class="fragment">Basic approach:
<ul>
<li class="fragment">Update database</li>
<li class="fragment and-link"><em>and</em></li>
<li class="fragment">Publish to Kafka</li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Naive approach</h2>
<div class="image-fragments">
<img src="assets/publish-after-1.png" class="fragment"/>
<img src="assets/publish-after-2.png" class="fragment"/>
<img src="assets/publish-after-3.png" class="fragment"/>
<img src="assets/publish-after-4.png" class="fragment"/>
<img src="assets/publish-after-0.png" />
</div>
</section>
<section>
<h2>What if something goes wrong?</h2>
<ul>
<li class="fragment">Is this approach resilent?</li>
<li class="fragment">What if:
<ul>
<li class="fragment">The service goes down?</li>
<li class="fragment">The database goes down?</li>
<li class="fragment">Kafka goes down?</li>
<li class="fragment">The network goes down?</li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Naive approach</h2>
<div class="image-fragments">
<img src="assets/publish-after-5.png" class="fragment"/>
<img src="assets/publish-after-6.png" class="fragment"/>
<img src="assets/publish-after-4.png" />
</div>
</section>
<section>
<img src="assets/dino-rent.png" />
</section>
</section>
<section>
<section>
<h2>Another solution?</h2>
<div class="image-fragments">
<img src="assets/commit-after-1.png" class="fragment"/>
<img src="assets/commit-after-2.png" class="fragment"/>
<img src="assets/commit-after-3.png" class="fragment"/>
<img src="assets/commit-after-4.png" class="fragment"/>
<img src="assets/commit-after-5.png" class="fragment"/>
<img src="assets/commit-after-6.png" class="fragment"/>
<img src="assets/commit-after-0.png" />
</div>
</section>
<section>
<h2>Two generals problem</h2>
<img src="assets/2-generals.png" />
</section>
<section>
<h2>Two generals problem</h2>
<ul>
<li class="fragment">It is proven to be unsolveable</li>
</ul>
</section>
<section>
<h2>Two-phase commit</h2>
<ul>
<li class="fragment">Can't we just use two-phase commit?
<ul>
<li class="fragment">No.</li>
<li class="fragment">Only reduces the window for failure to cause a problem</li>
<li class="fragment">The window is largest when failure is most likely</li>
<li class="fragment">Coordination comes at high cost</li>
</ul>
</li>
</ul>
</section>
</section>
<section>
<section>
<h2>Too hard?</h2>
<ul>
<li class="fragment">Maybe it's all too hard</li>
<li class="fragment">Is inconsistency really that bad?</li>
</ul>
</section>
<section>
<h2>An easier way?</h2>
<ul>
<li class="fragment">We can't solve the 2 generals problem</li>
<li class="fragment">What if come up with a different plan of attack?</li>
</ul>
</section>
</section>
<section>
<section>
<h2>Event sourcing</h2>
<ul>
<li class="fragment">Don't store the current state</li>
<li class="fragment">Store the events that occurred</li>
<li class="fragment">Compute the state from the events</li>
</ul>
</section>
<section>
<h2>Event sourcing</h2>
<div class="image-fragments">
<img src="assets/es-append-1.png" class="fragment"/>
<img src="assets/es-append-2.png" class="fragment"/>
<img src="assets/es-append-3.png" class="fragment"/>
<img src="assets/es-append-4.png" class="fragment"/>
<img src="assets/es-append-5.png" class="fragment"/>
<img src="assets/es-append-0.png"/>
</div>
</section>
<section>
<h2>Event sourcing</h2>
<div class="image-fragments">
<img src="assets/es-publish-1.png" class="fragment"/>
<img src="assets/es-publish-2.png" class="fragment"/>
<img src="assets/es-publish-3.png" class="fragment"/>
<img src="assets/es-publish-4.png" class="fragment"/>
<img src="assets/es-publish-5.png" class="fragment"/>
<img src="assets/es-publish-0.png"/>
</div>
</section>
<section>
<h2>Event sourcing</h2>
<ul>
<li>Advantages:
<ul>
<li class="fragment">Fact centric approach</li>
<li class="fragment">Self healing when problems occur</li>
<li class="fragment">Built in audit log</li>
<li class="fragment">Compute the state of the system at any time</li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Event sourcing</h2>
<ul>
<li>Details:
<ul>
<li class="fragment">How is consistency addressed?</li>
<li class="fragment">Is replaying events expensive?</li>
<li class="fragment">How to query data?</li>
</ul>
</li>
</ul>
</section>
</section>
<section>
<section>
<h2>Summary</h2>
<ul>
<li class="fragment">CRUD is not an ideal fit for distributed systems</li>
<li class="fragment">Event sourcing is an ideal fit for distributed systems</li>
<li class="fragment">Event sourcing brings a host of other advantages</li>
</ul>
</section>
<section>
<h2>Next steps</h2>
<p><a href="http://lagomframework.com">https://www.lagomframework.com</a></p>
<p><a href="https://github.com/jroper/crud-to-es">https://github.com/jroper/crud-to-es</a></p>
</section>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
var sections = document.getElementsByTagName('section');
for (var i = 0; i < sections.length; i++) {
var slide = sections[i];
if (!(slide.getAttribute('data-background') ||
slide.getAttribute('data-background-video') ||
slide.getAttribute('data-background-iframe'))) {
slide.setAttribute('data-background', 'assets/lagom-hero.png');
}
}
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
history: true,
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
],
keyboard: {
86: "togglePause"
}
});
</script>
</body>
</html>