/
slides.html
498 lines (431 loc) · 17.7 KB
/
slides.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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
<!DOCTYPE html>
<html>
<head>
<title>Recommendation Engines with Redis and Ruby</title>
<meta charset='utf-8' />
<meta content='width=1024, user-scalable=no' name='viewport' />
<!-- deck.js's core css -->
<link href="deck.js/core/deck.core.css" rel="stylesheet" type="text/css"/>
<!-- deck.js extension CSS files -->
<link href="deck.js/extensions/codemirror/deck.codemirror.css" rel="stylesheet" type="text/css"/>
<link href="deck.js/extensions/goto/deck.goto.css" rel="stylesheet" type="text/css"/>
<link href="deck.js/extensions/hash/deck.hash.css" rel="stylesheet" type="text/css"/>
<link href="deck.js/extensions/menu/deck.menu.css" rel="stylesheet" type="text/css"/>
<link href="deck.js/extensions/navigation/deck.navigation.css" rel="stylesheet" type="text/css"/>
<link href="deck.js/extensions/scale/deck.scale.css" rel="stylesheet" type="text/css"/>
<link href="deck.js/extensions/status/deck.status.css" rel="stylesheet" type="text/css"/>
<!-- all css in the css dir: Keydown CSS, your custom CSS, and themes from deck.js -->
<link href="css/keydown.css" rel="stylesheet" type="text/css"/>
<link href="css/default.css" rel="stylesheet" type="text/css"/>
<link href="css/horizontal-slide.css" rel="stylesheet" type="text/css"/>
<link href="css/rerr.css" rel="stylesheet" type="text/css"/>
<link href="css/swiss.css" rel="stylesheet" type="text/css"/>
<!-- Modernizr (provided for legacy browsers) -->
<script src="deck.js/support/modernizr.custom.js" type="text/javascript"></script>
</head>
<body class='deck-container keydown'>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Recommendation Engines</h1>
<h1>with Redis and Ruby</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='middle slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Evan Light</h1>
<h2><strong>Code Janitor</strong></h2>
<h2><a href="http://twitter.com/elight">@elight</a></h2>
<h2><a href="mailto:evan.light@tripledogdare.net">evan.light@tripledogdare.net</a></h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='full-background middle slide stuff_i_do'>
<div class='spacer top'></div>
<div class='content'>
</div>
<div class='spacer bottom'></div>
</section>
<section class='full-background kyck slide'>
<div class='spacer top'></div>
<div class='content'>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>So a recommendation engine...</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>... based on the user's interests...</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>... and social proof</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='full-background no_idea slide'>
<div class='spacer top'></div>
<div class='content'>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Exciting!</h1>
<h1>So let's begin!</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>The domain</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='full-background slide top-left user-tag'>
<div class='spacer top'></div>
<div class='content'>
<h1>Given something like...</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='domain full-background slide top-left'>
<div class='spacer top'></div>
<div class='content'>
<h1>... and this...</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='full-background scored-user-posts slide top-right'>
<div class='spacer top'></div>
<div class='content'>
<h1>... we want <em>this</em>!</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Trendingness</h1>
<h2>"Objective" ranking</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Constraints</h1>
<h2>Near real-time</h2>
<h2>Effective even w/ small data sets</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Goal</h1>
<h2>Calculate scalar User interest</h2>
<h2>for Tags</h2>
<h2>on a per event basis</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>User event driven</h1>
<h2>Liking/Favoriting</h2>
<h2>Posting</h2>
<h2>Commenting</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h2>Offload processing of events to queue</h2>
<h2><strong>ActiveRecord::Observer feed into Resque</strong></h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='bottom-left slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Engine design</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='calculator_workflow full-background slide'>
<div class='spacer top'></div>
<div class='content'>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1><em>Calculator</em></h1>
<h2>Pop an event off Resque</h2>
<h2>"Magic" happens!</h2>
<h2>Persists Post scores</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>"Magic"</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1><em>Trendingness Calculator</em></h1>
<h2><strong>Input</strong>: The event</h2>
<h2>(Re)compute Post's trendingness score</h2>
<h2><strong>Output</strong>: The trendingness score for the Post</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h2><em>Trendingness Calculator</em> does not persist its output</h2>
<h2>Nor any other <em>Foo Calculator</em></h2>
<h2><strong>TDD made this painfully (literally) obvious</strong></h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Tangent: On persistence</h1>
<h2>Caller responsible for persistence</h2>
<h2>Trendingness stored as key-value pairs</h2>
<h2>Incrementing trendingness score trivially fast</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>On persistence (cont'd)</h1>
<h2>Abstracted Redis dependencies into <em>RedisStore</em></h2>
<h2>Any class duck typing <em>RedisStore</em> could provide persistence</h2>
<h2><em>Foo Calculators</em> only depend on a single persistence interface</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1><em>User Interest Calculator</em></h1>
<h2><strong>Input</strong>: The event</h2>
<h2>For originating User:</h2>
<h2><strong>Output</strong>: User's updated interests per Tag</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1><em>Post Score Calculator</em></h1>
<h2><strong>Input</strong>: The event plus User's interests per Tag</h2>
<h2>Locate Posts related to these Tags</h2>
<h2>Locate Users interested in these Tags</h2>
<h4>O(n<sup>2</sup>) == <em>slow!</em></h4>
<h2><strong>Output</strong>: new Post scores per interested User</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='calculator_workflow full-background slide top-left'>
<div class='spacer top'></div>
<div class='content'>
<h1>What is this?</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='full-background series_of_queues slide'>
<div class='spacer top'></div>
<div class='content'>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Performance "optimizations"</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h2>Expected RDBMS to be under heavy load</h2>
<h2><u><em>Prematurely</em></u> optimized to reduce DB queries</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h2>Cache interesting primary keys in Redis Sets</h2>
<h2>Reduces need for expensive database queries</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h2>For example</h2>
<h3>User's IDs interested in a particular Tag</h3>
<h3>Post IDs related to a particular Tag</h3>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h2>Break up <em>Calculator</em></h2>
<h2>Wrap each <em>Foo Calculator</em> in a Resque worker</h2>
<h2>Each <em>Foo Calculator</em> becomes Resque worker</h2>
<h2>Allows <em>Foo Calculator</em> to scale independently</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Ideal?</h1>
<h2>Not really</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Ideal enough?</h1>
<h2>Customer was happy!</h2>
<h2>It's still in production!</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Emergent behavior</h1>
<h2>Everything is "taggable" in app</h2>
<h2>Most AR object lifecycle queued as events</h2>
<h2>Engine scored <strong>every</strong> Tag relationship...</h2>
<h2>... including how interested I am in other people!</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Side business as dating site? ;-)</h1>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Coulda woulda shoulda</h1>
<h2>Statistical methods</h2>
<h2>Perhaps stored Post scores per User differently</h2>
<h3>Redis Hash of User ID -> Post ID -> Score</h3>
<h2>Redis pruner for non key-values</h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Even more coulda woulda shoulda</h1>
<h2>Less chattiness with Redis</h2>
<h3>(Redis Lua scripting)</h3>
<h2>Runtime faster than Ruby</h2>
<h2><img src="images/troll.jpg"/></h2>
</div>
<div class='spacer bottom'></div>
</section>
<section class='middle slide'>
<div class='spacer top'></div>
<div class='content'>
<h1>Evan Light</h1>
<h2><strong>Code Janitor</strong></h2>
<h2><a href="http://twitter.com/elight">@elight</a></h2>
<h2><a href="mailto:evan.light@tripledogdare.net">evan.light@tripledogdare.net</a></h2>
</div>
<div class='spacer bottom'></div>
</section>
<!-- deck.js navigation extension -->
<a class='deck-prev-link' href='#' title='Previous'>←</a>
<a class='deck-next-link' href='#' title='Next'>→</a>
<!-- deck.js hash extension -->
<a class='deck-permalink' href='.' title='Permalink to this slide'>#</a>
<!-- deck.js status extension -->
<p class='deck-status'>
<span class='deck-status-current'></span>
/
<span class='deck-status-total'></span>
</p>
<!-- jQuery & deck.js -->
<script src="deck.js/support/jquery.1.6.4.min.js" type="text/javascript"></script>
<script src="deck.js/core/deck.core.js" type="text/javascript"></script>
<!-- deck.js extension JS files -->
<script src="deck.js/extensions/codemirror/codemirror.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/deck.codemirror.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/clike/clike.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/clojure/clojure.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/coffeescript/coffeescript.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/css/css.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/diff/diff.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/haskell/haskell.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/htmlmixed/htmlmixed.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/javascript/javascript.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/lua/lua.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/php/php.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/plsql/plsql.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/python/python.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/r/r.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/rst/rst.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/ruby/ruby.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/scheme/scheme.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/smalltalk/smalltalk.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/sparql/sparql.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/stex/stex.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/velocity/velocity.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/xml/xml.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/xmlpure/xmlpure.js" type="text/javascript"></script>
<script src="deck.js/extensions/codemirror/mode/yaml/yaml.js" type="text/javascript"></script>
<script src="deck.js/extensions/goto/deck.goto.js" type="text/javascript"></script>
<script src="deck.js/extensions/hash/deck.hash.js" type="text/javascript"></script>
<script src="deck.js/extensions/menu/deck.menu.js" type="text/javascript"></script>
<script src="deck.js/extensions/navigation/deck.navigation.js" type="text/javascript"></script>
<script src="deck.js/extensions/scale/deck.scale.js" type="text/javascript"></script>
<script src="deck.js/extensions/status/deck.status.js" type="text/javascript"></script>
<!-- your custom JS here, including call to initialize deck.js-codemirror -->
<script src="js/rerr.js" type="text/javascript"></script>
<!-- Initialize the deck. -->
<script type='text/javascript'>
$(function() { $.deck('.slide'); });
</script>
</body>
</html>