-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcyclone.html
834 lines (750 loc) · 34.4 KB
/
cyclone.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
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
<!doctype html>
<!--
Google HTML5 slide template
Authors: Luke Mahé (code)
Marcin Wichary (code and design)
Dominic Mazzoni (browser compatibility)
Charles Chen (ChromeVox support)
URL: http://code.google.com/p/html5slides/
-->
<!--
slides.fm
Authors: Marek Ventur <[email protected]>
Sam Smith <[email protected]>
URL: http://github.com/marekventur/slides.fm
-->
<html>
<head>
<meta charset="utf-8">
<title>cyclone</title>
<!-- <script type="text/javascript" src="./javascripts/slides.js"></script> -->
<script type="text/javascript" src="http://html5slides.googlecode.com/svn/trunk/slides.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://hackdaynode.last.fm/lfmc.js"></script>
<script>
function eliminate_images(x)
{
if (x instanceof Array) {
for (var y = 0; y < x.length; y++) {
x[y] = eliminate_images(x[y]);
}
}
else if (x instanceof Object) {
if (x.image) {
x.image = null;
}
else {
for (y in x) {
x[y] = eliminate_images(x[y]);
}
}
}
return x;
}
function run_feed(obj, queue_type, query)
{
var feed = new lfmc_Feed('').setType(queue_type);
feed.query = JSON.parse(query);
feed.onData(function (data) {
for (var k in data) {
if (data[k] instanceof Array && data[k].length > 6) {
data[k] = data[k].slice(0,6);
}
data[k] = eliminate_images(data[k]);
}
$('#'+obj).text(JSON.stringify(data, null, 2));
// prettyPrint();
}).run();
};
</script>
<style>
/*
.slides article {
background: white url(http://cdn.lst.fm/flatness/join/lastfmlogo.png) 730px 560px no-repeat;
}
*/
.jsonquery {
margin-top: 5px;
margin-bottom: 10px;
}
.jsonoutput {
margin-top: 5px;
margin-bottom: 10px;
font-size: 12px;
line-height: 13px;
}
.network {
font-size: 12px;
line-height: 15px;
}
.networkaa {
margin: 0px;
margin-top: 20px;
margin-bottom: -20px;
font-size: 11px;
line-height: 11px;
color: black;
}
.small {
font-size: 20px;
line-height: 25px;
margin-left: 40px;
margin-top: 10px;
margin-bottom: 15px;
}
.usersmall {
font-size: 18px;
line-height: 35px;
margin-left: -4px;
margin-top: 10px;
margin-bottom: 15px;
}
.userimg {
display: inline-block;
margin: 0em;
margin-right: 10px;
padding: 0em 0em;
vertical-align: middle;
border-radius: 6px;
box-shadow: 0 0 8px Black;
height: 34;
width: 34;
}
ul.smaller {
padding-top: 10px;
font-size: 20px;
line-height: 20px;
letter-spacing: 0;
}
a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}
a:active {text-decoration:underline;}
</style>
<body style="display: none;">
<section class="slides layout-regular">
<article>
<h1>cyclone</h1>
<p>
Marcus Holland-Moritz
</p>
</article>
<article>
<h3>cyclone — realtime feeds for now playing data (1)</h3>
<p>
<i>cyclone</i> aggregates data from our now-playing API and
provides feeds that will update in real time.
</p>
<p>
It can answer questions like the following... continuously:
</p>
<ul class="build">
<li>
What are the top tracks in the United Kingdom?
<div id="top-tracks-uk" class="small"></div>
<script>
new lfmc_TopFeed('track')
.setType('scrobbles')
.setSize(5)
.filterByCountry('GB')
.onData(function(list) {
var e = $('#top-tracks-uk');
e.empty();
for (var i = 0; i < list.length; i++)
{
var track = list[i];
e.append('<div><b>' + (i+1).toString() + '. ' + track.track.artist.name + ': ' + track.track.title + '</b></div>');
}
})
.run();
</script>
</li>
<li>
What's the most-listened-to track world wide right now?
<div id="top-track-ww" class="small"></div>
<script>
new lfmc_TopFeed('track')
.setType('nowplaying')
.setSize(1)
.onData(function(list) {
var e = $('#top-track-ww');
e.empty();
for (var i = 0; i < list.length; i++)
{
var track = list[i];
e.append('<div><b>' + track.track.artist.name + ': ' + track.track.title + '</b> <i>(' + track.count.toString() + ' listeners)</i></div>');
}
})
.run();
</script>
</li>
<li>
What's the top indie artist in the US in the last hour?
<div id="top-indie-us" class="small"></div>
<script>
new lfmc_TopFeed('artist')
.setType('scrobbles')
.setSize(1)
.filterByCountry('US')
.filterByTag('Indie')
.onData(function(list) {
var e = $('#top-indie-us');
e.empty();
for (var i = 0; i < list.length; i++)
{
var artist = list[i];
e.append('<div><b>' + artist.artist.name + '</b> <i>(' + artist.count.toString() + ' scrobbles)</i></div>');
}
})
.run();
</script>
</li>
</ul>
</article>
<article>
<h3>cyclone — realtime feeds for now playing data (2)</h3>
<ul class="build">
<li>
Which countries are listening to Coldplay the most?
<div id="top-coldplay" class="small"></div>
<script>
new lfmc_TopFeed('country')
.setType('scrobbles')
.setSize(4)
.filterByArtist('Coldplay')
.onData(function(list) {
var e = $('#top-coldplay');
e.empty();
for (var i = 0; i < list.length; i++)
{
var country = list[i];
e.append('<div><b>' + (i+1).toString() + '. ' + country.country.fullname + '</b> <i>(' + country.count.toString() + ' scrobbles)</i></div>');
}
})
.run();
</script>
</li>
<li>
Who's listening to the Beastie Boys right now?
<div id="user-beastie" class="usersmall"></div>
<script>
new lfmc_RecentFeed('user')
.setType('nowplaying')
.setSize(4)
.addExtraField('track')
.addExtraField('application')
.filterByArtist('Beastie Boys')
.onData(function(list) {
var e = $('#user-beastie');
e.empty();
for (var i = 0; i < list.length; i++)
{
var user = list[i];
var img = user.user.image && user.user.image.smallsquare && user.user.image.smallsquare.url
? user.user.image.smallsquare.url
: 'http://cdn.last.fm/flatness/catalogue/noimage/2/default_user_small.png';
e.append('<div><b><img class="userimg" src="' + img + '"> ' + user.user.name + '</b> <i>listens to <b>' + user.track.title + '</b> on <b>' + user.application + '</b></i></div>');
}
})
.run();
</script>
</li>
<li>
What are all my friends currently listening to?
<div id="user-friends" class="usersmall"></div>
<script>
new lfmc_RecentFeed('user')
.setType('nowplaying')
.setSize(4)
.addExtraField('track')
.filterByFriends('JoshWoodward')
.onData(function(list) {
var e = $('#user-friends');
e.empty();
for (var i = 0; i < list.length; i++)
{
var user = list[i];
var img = user.user.image && user.user.image.smallsquare && user.user.image.smallsquare.url
? user.user.image.smallsquare.url
: 'http://cdn.last.fm/flatness/catalogue/noimage/2/default_user_small.png';
e.append('<div><b><img class="userimg" src="' + img + '"> ' + user.user.name + '</b> <i>listens to <b>' + user.track.title + '</b> by <b>' + user.track.artist.name + '</b></i></div>');
}
})
.run();
</script>
</li>
</ul>
</article>
<article>
<h3>cyclone — realtime feeds for now playing data (3)</h3>
<ul class="build">
<li>
Which countries are *really* listening to Coldplay the most?
<div id="top-rel-coldplay" class="small"></div>
<script>
var feed = new lfmc_Feed('').setType('scrobbles');
feed.query = { "feed": {
"type": "top",
"relative": true,
"size": 5,
"field": "country"
},
"filter": [{"field": "artist", "value": "Coldplay"}]
};
feed.onData(function(data) {
var e = $('#top-rel-coldplay');
e.empty();
// e.append('<div>' + JSON.stringify(data, null, 2) + '</div>');
list = data.top;
for (var i = 0; i < list.length; i++)
{
var item = list[i];
e.append('<div><b>' + (i+1).toString() + '. <a href=' + item[0].url + '>' + item[0].fullname + '</a></b> <i>(' + (100.0*item[1]/item[2]).toFixed(2) + '% of users)</i></div>');
}
})
.run();
</script>
</li>
<li>
Which countries have the largest fraction of women listening to rock music?
<div id="top-rel-rock-women" class="small"></div>
<script>
var feed = new lfmc_Feed('').setType('scrobbles');
feed.query = { "feed": {
"type": "top",
"relative": true,
"size": 5,
"field": "country"
},
"filter": {
"main": [{"field":"tag", "value":"rock"}, {"field":"sex", "value":"female"}],
"reference": [{"field":"sex", "value":"female"}]
}
};
feed.onData(function(data) {
var e = $('#top-rel-rock-women');
e.empty();
// e.append('<div>' + JSON.stringify(data, null, 2) + '</div>');
list = data.top;
for (var i = 0; i < list.length; i++)
{
var item = list[i];
e.append('<div><b>' + (i+1).toString() + '. <a href=' + item[0].url + '>' + item[0].fullname + '</a></b> <i>(' + (100.0*item[1]/item[2]).toFixed(2) + '% of women listen to rock music)</i></div>');
}
})
.run();
</script>
</li>
</ul>
</article>
<article>
<h3>cyclone — design goals</h3>
<ul class="nobuild">
<li>handle tens of thousands of feeds in parallel</li>
<li>minimal delay when accepting connections</li>
<li>fast initial response</li>
<li>configurable multi-threading</li>
</ul>
</article>
<article>
<h3>cyclone — queries</h3>
<ul class="nobuild">
<li><i>cyclone</i> doesn't have its own query language</li>
<li>queries are written in JSON</li>
<li>each feed is described by a JSON object containing:
<ul class="nobuild">
<li>a <b>feed specification</b>, containing the feed type and any options
that apply for the feed</li>
<li>an optional <b>filter specification</b></li>
<li>for some feed types, the filter specification is mandatory
(though that is configurable)</li>
</ul>
</li>
</ul>
</article>
<article>
<h3>cyclone — events</h3>
<ul class="nobuild">
<li>
cyclone <i>events</i> are generated when a user starts
listening to a new track or scrobbles a track or an
active event times out</li>
<li>
events are either <i><b>add</b></i> or <i><b>remove</b></i></li>
</ul>
</article>
<article>
<h3>cyclone — event fields</h3>
<ul class="nobuild">
<li>
events carry the following fields:
<ul class="nobuild smaller">
<li><b>user</b>: user id</li>
<li><b>artist</b>: artist id of playing track</li>
<li><b>track</b>: track id of playing track</li>
<li><b>album</b>: album id of playing track</li>
<li><b>country</b>: country id of user</li>
<li><b>age</b>: age of user</li>
<li><b>sex</b>: sex of user</li>
<li><b>tag</b>: top tag of artist ("genre")</li>
<li><b>length</b>: length of track in seconds</li>
<li><b>playing_since</b>: timestamp of track start time</li>
<li><b>api_key</b>: API key of application</li>
<li><b>application</b>: application name</li>
</ul>
</li>
<li>
new fields are extremely easy to add</li>
</ul>
</article>
<article>
<h3>cyclone — queues</h3>
<ul class="nobuild">
<li>
a cyclone queue keeps track of all active events</li>
<li>
there are two different types of queue currently supported by cyclone</li>
<li>
the <i><b>expiry set</b></i> queue expires items after an individual
lifetime; it is used for the <i>nowplaying</i> instance of cyclone</li>
<li>
the <i><b>fifo</b></i> queue expires items after a constant lifetime;
it is used for the <i>scrobbles</i> instance of cyclone</li>
</ul>
</article>
<article>
<h3>cyclone — feeds: count</h3>
<p>
<code>count</code> feeds are the most basic feeds and simply count
the number of active events
<blockquote>
<small><i>Count the number of all now playing tracks:</i></small>
<pre class="jsonquery">{"feed":{"type":"count"}}</pre>
<pre class="jsonoutput noprettyprint" id="count-feed-demo"></pre>
<script>
run_feed('count-feed-demo', 'nowplaying', '{"feed":{"type":"count"}}');
</script>
</blockquote>
<blockquote>
<small><i>Count the number of all tracks scrobbled with the last hour:</i></small>
<pre class="jsonquery">{"feed":{"type":"count"}}</pre>
<pre class="jsonoutput noprettyprint" id="count-feed-demo-scrobbles"></pre>
<script>
run_feed('count-feed-demo-scrobbles', 'scrobbles', '{"feed":{"type":"count"}}');
</script>
</blockquote>
</p>
</article>
<article>
<h3>cyclone — feeds: top</h3>
<p>
<code>top</code> feeds provide charts of a certain field
<blockquote>
<small><i>Top 3 genres world wide:</i></small>
<pre class="jsonquery">{"feed":{"type":"top","size":3,"field":"tag"}}</pre>
<pre class="jsonoutput noprettyprint" id="top-feed-demo"></pre>
<script>
run_feed('top-feed-demo', 'nowplaying', '{"feed":{"type":"top","size":3,"field":"tag"}}');
</script>
</blockquote>
</p>
</article>
<article>
<h3>cyclone — feeds: set</h3>
<p>
<code>set</code> feeds aggregate items of a certain field
<blockquote>
<small><i>(black metal) artists currently being played (limited to 6):</i></small>
<pre class="jsonquery">{"feed":{"type":"set","field":"artist"}}</pre>
<pre class="jsonoutput noprettyprint" id="set-feed-demo"></pre>
<script>
run_feed('set-feed-demo', 'nowplaying', '{"feed":{"type":"set","field":"artist"},"filter":[{"field":"tag","value":"black metal"}]}');
</script>
</blockquote>
</p>
</article>
<article>
<h3>cyclone — feeds: recent (1)</h3>
<p>
<code>recent</code> feeds keep track of the most recent events for a
certain field
<blockquote>
<small><i>The 2 most recent users to play a (jazz) track along with the
track id and the application they're using:</i></small>
<pre class="jsonquery">{"feed":{"type":"recent","size":2,"field":"user",
"extra_fields":["track","application"]}}</pre>
</blockquote>
</p>
</article>
<article>
<h3>cyclone — feeds: recent (2)</h3>
<p>
<blockquote>
<pre class="jsonoutput noprettyprint" id="recent-feed-demo"></pre>
<script>
run_feed('recent-feed-demo', 'nowplaying', '{"feed":{"type":"recent","size":2,"field":"user","extra_fields":["track","application"]},"filter":[{"field":"tag","value":"Jazz"}]}');
</script>
</blockquote>
</p>
</article>
<article>
<h3>cyclone — filters</h3>
<ul class="nobuild">
<li>both <i><b>and</b></i> and <i><b>or</b></i> operations are supported</li>
<li>though <i><b>or</b></i> operations are limited to the same type</li>
<li><i><b>and</b></i> operations are implemented by <i>chaining</i>:
<pre class="jsonquery">{"feed":{"type":"count"},"filter":[{"field":"tag",
"value":13},{"field":"country","value":228}]}</pre>
</li>
<li><i><b>or</b></i> operations are implemented by <i>set filters</i>:
<pre class="jsonquery">{"feed":{"type":"count"},"filter":[{"field":"application",
"value":["Grooveshark","Grooveshark Scrobbler"]}]}</pre>
</li>
<li>chains are limited to 5 filters (configurable)</li>
<li>set filters are unlimited (and work nicely with 10,000 values)</li>
</ul>
</article>
<article>
<h3>cyclone — feeds: relative top</h3>
<p>
<blockquote>
<small><i>Top 3 countries with the most "rock" women:</i></small>
<pre class="jsonquery">{"feed":{"type":"top","relative":true,"size":3,"field":
"country"},"filter":{"main":[{"field":"tag","value":
"rock"},{"field":"sex","value":"female"}],"reference":
[{"field":"sex","value":"female"}]}}
</pre>
<pre class="jsonoutput noprettyprint" id="top-rel-feed-demo"></pre>
<script>
run_feed('top-rel-feed-demo', 'scrobbles', '{"feed":{"type":"top","relative":true,"size":3,"field":"country"},"filter":{"main":[{"field":"tag","value":"rock"},{"field":"sex","value":"female"}],"reference":[{"field":"sex","value":"female"}]}}');
</script>
</blockquote>
</p>
</article>
<article>
<h3>cyclone — filter network</h3>
<ul class="nobuild">
<li>automatically managed filter network to process events and update feeds</li>
<li>nodes are inserted and removed on demand</li>
<li><i><b>feed</b></i> nodes form the leaves of the filter network tree</li>
<li><i><b>aggregator</b></i> nodes sit right in front of the feed nodes</li>
<li><i><b>distributor</b></i> nodes are used to filter events</li>
<li>the <i><b>network root</b></i> node is a special kind of distributor node</li>
<li>events are sourced from a data structure specialised for handling items that have a lifetime</li>
</ul>
</article>
<article>
<h3>cyclone — filter network: example network</h3>
<pre class="networkaa noprettyprint">
+---------+
| network |
+-+-------+
|
| The network's subscriber set holds at most one aggregator and one distributor per event field.
|
| +-------------------+
+--->| aggregator | aggregates all events
| +-------------------+
|
| +-------------------+
+--->| distributor<tag> | distributes by looking at the "tag" field
| +-+-----------------+
| | +----------------------+
| +--[ 123 ]--> (1, 2) (1) --->| aggregator | aggregates events with tags 123, 107 or 12
| | +----------------------+
| +--[ 107 ]--> (1)
| | +----------------------+
| +--[ 12 ]---> (1, 2) (2) --->| distributor<country> | distributes by looking at the "country" field
| | +-+--------------------+
| +--[ 77 ]---> (2) | +----------------------+
| | +--[ 23 ]---> (1) (1) --->| aggregator |
| +--[ 956 ]--> (2) | +----------------------+
| | +--[ 47 ]---> (1) aggregates events with tags 123, 12,
| +--[ 13 ]---> (3) 77 or 956 and countries 23 or 47
| +----------------------+
| (3) --->| distributor<user> | distributes by looking at the "user" field
| +-+--------------------+
| | +----------------------+
| +--[ 123 ]--> (1) (1) --->| aggregator |
| +----------------------+
| aggregates events with tag 13 and
| user 123
|
| +-------------------+
+--->| distributor<user> | distributes by looking at the "user" field
+-+-----------------+
| +----------------------+
+--[ 123 ]--> (1) (1) --->| aggregator | aggregates events with user 123
+----------------------+
^ ^ ^
| | |
| | `---- these are the actual nodes referenced by the distributor node
| |
| `---- these are the subscriber sets, i.e. all the nodes subscribed to this particular
| value; a node may be subscribed to multiple values, which means it'll be in
| more than one subscriber set
|
`---- the values are the keys in the distributor's subscribers map
</pre>
<p align="right"><small>* ascii art ftw</small></p>
</article>
<article>
<h3>cyclone — filter network: feed nodes</h3>
<ul class="nobuild">
<li>
receives batches of event updates from an aggregator node
</li>
<li>
multiple streams can be connected to a feed
</li>
<li>
initial update on connect
</li>
<li>
subsequent updates on change
</li>
</ul>
</article>
<article>
<h3>cyclone — filter network: aggregator nodes</h3>
<ul class="nobuild">
<li>
receives single event updates from another network node
</li>
<li>
multiple feeds with the same filter path will reuse the same aggregator
</li>
<li>
for efficiency, only pointers to event updates will actually be aggregated
</li>
<li>
forwarding event batches is done in a configurable number of worker threads
</li>
</ul>
</article>
<article>
<h3>cyclone — filter network: distributor nodes</h3>
<ul class="nobuild">
<li>
receives a single event update from another network node
</li>
<li>
looks at the field it has been specialised for
(e.g. a user id or an api key string)
</li>
<li>
forwards an event to all subscribed nodes on match or
otherwise drops the event
</li>
<li>
use a dense hash map internally, which makes event
distribution extremely fast even if millions of different
values have been subscribed to
</li>
</ul>
</article>
<article>
<h3>cyclone — filter network: field policies</h3>
<ul class="nobuild">
<li>nodes are implemented as templates</li>
<li>distributor and feed nodes make use of policy
classes that describe each event field</li>
<li>the node implementations have absolutely no knowledge
about the kind of events they are processing</li>
<li>adding a new event field is as simple as writing
a policy class for that field</li>
</ul>
</article>
<article>
<h3>cyclone — filter network: example network dump</h3>
<pre class="network noprettyprint">network @ 0xb37cc0
map_distributor(country) @ 0xc97650
[229]
map_distributor(tag) @ 0x7fe5a4380f20
[111]
aggregator @ 0x7fe5a40b6780
feed::top(artist:1) @ 0x7fe5a437abf0
top_set(4/4) -> [80/256,32/128,11/32,1/32], 124 items
[228]
aggregator @ 0xb7b510
feed::top(track:5) @ 0xba27c0
top_set(2/2) -> [1247/4096,12/32], 1259 items
aggregator @ 0x7fe59c121000
feed::top(tag:3) @ 0xb5ddd0
top_set(10/16) -> [378/1024,127/512,79/256,53/128,33/128,36/128,27/128,19/64,4/32,4/32], 760 items
feed::count @ 0x7fe59c071040
feed::top(track:1) @ 0x7fe5a0270770
top_set(4/4) -> [13338/65536,662/2048,28/64,1/32], 14029 items
map_distributor(tag) @ 0x7fe59c025150
[13]
aggregator @ 0x7fe59c0b1db0
feed::set(artist) @ 0x7fe5a008b690
[27]
aggregator @ 0xba1100
feed::recent(user:2) @ 0xb9d3c0
map_distributor(artist) @ 0x7fe5a001d880
[121]
aggregator @ 0x7fe59c05ad80
feed::recent(user:4) @ 0x7fe59c05d320
[1177]
aggregator @ 0x7fe5a00264e0
feed::top(country:4) @ 0x7fe5a006afc0
top_set(4/4) -> [11/32,2/32,2/32,0/32], 15 items
map_distributor(user) @ 0x7fe5a40dadb0
[6043, 6865, 7923, <+8653>]
aggregator @ 0x7fe5a4285be0
feed::recent(user:4) @ 0x7fe5a40db400</pre>
</article>
<article>
<h3>cyclone — bootstrapping feeds</h3>
<ul class="nobuild">
<li>
feeds need to be <i>bootstrapped</i>, i.e. all active events
need to be filtered and pushed to the feed
</li>
<li>
there can easily be more than a million active events, so
bootstrapping is quite expensive
</li>
<li>
both queue implementations use <i>bloom filters</i> to keep
track of all event properties so that whole chunks of events
can be ignored when filtering
</li>
<li>
each feed may implement an optimised bootstrapping method,
e.g. a <code>count</code> feed doesn't have to look at each
individual event but can directly use the number of events
</li>
</ul>
</article>
<article>
<h3>cyclone — current performance (1)</h3>
<ul class="nobuild">
<li>Given about 500 input events per second (this is the current
number of scrobbles per second at peak time), continuously
updating 100,000 feeds of the currently listened to tracks
of 100,000 users' friends (a total of almost 3 million users)
uses about one percent of the CPU resources of a 16 core machine.</li>
<li>Typical feed setup time (i.e. the time from receiving the query
to sending the first feed update) is less than 10 milliseconds.</li>
</ul>
</article>
<article>
<h3>cyclone — current performance (2)</h3>
<p>Depending on the feed type and the amount of feed data, about
1,000 to 2,000 new feeds can be created per second (using 16 threads
for feed setup). This includes:</p>
<ul class="nobuild">
<li>parsing the query</li>
<li>filtering all active events (likely more than 1,000,000 at peak time for a one hour fifo) to bootstrap the feed</li>
<li>adding the feed node to the network (thereby creating all required distributor and aggregator nodes)</li>
<li>sending out an initial feed update</li>
</ul>
</article>
<article>
<h1 align="center">Questions?</h1>
</article>
</section>
</body>
</html>