際際滷

際際滷Share a Scribd company logo
CASSANDRA 
FOR ALL 
THE THINGS 
@iconara
CASSANDRA 
FOR ALL 
THE THINGS 
@iconara
THEO 
Chief Architect at Burt 
@iconara
THEO 
Cassandra MVP and original author of the DataStax Ruby driver 
@iconara
CASSANDRA 
FOR ALL 
THE THINGS* 
@iconara
CASSANDRA 
FOR ALL 
THE THINGS* 
* where it makes sense 
@iconara
CASSANDRA 
FTW 
@iconara
BIG TABLE 
partitions as sorted maps 
@iconara
DYNAMO 
availability and simple ops 
@iconara
LOGS AS STORAGE 
optimized for writes 
@iconara
CASSANDRA 
FTW 
@iconara
CONVERSION 
TRACKING 
$ $ $ $ $ 
@iconara
ATTRIBUTION 
@iconara 
$
ATTRIBUTION 
90s 5s 
@iconara 
30s 
$
visitor ID 
timestamp timestamp timestamp 
event event event
visitor ID 
visitor ID 
timestamp timestamp timestamp 
event event event 
timestamp timestamp timestamp 
event event event 
visitor ID 
visitor ID 
timestamp timestamp timestamp 
event event event 
timestamp timestamp timestamp 
event event event 
visitor ID 
timestamp timestamp timestamp 
event event event
1/10,000 
@iconara
TTL 
automatic windowing 
@iconara
ANALYTICS 
precomputed cubes 
@iconara
SELECT 
category, 
author, 
device_type, 
COUNT(*) AS pageviews, 
AVG(duration) AS duration 
FROM pageviews 
GROUP BY 1, 2, 3 
@iconara
SELECT 
category, 
author, 
device_type, 
COUNT(*) AS pageviews, 
AVG(duration) AS duration 
FROM pageviews 
GROUP BY 1, 2, 3 
@iconara
SELECT 
category, 
author, 
device_type, 
COUNT(*) AS pageviews, 
AVG(duration) AS duration 
FROM pageviews 
GROUP BY 1, 2, 3 
@iconara
date + cube 
slice + time slice + time slice + time 
metrics metrics metrics
sports, Sue, tablet 
date + cube 
slice + time slice + time slice + time 
metrics metrics metrics 
category, author, device type
date + cube 
slice + time slice + time slice + time 
metrics metrics metrics 
{pageviews: 234, duration: 2451.45}
COUNTERS 
at 2M increments per second theyre not cost-effective  
@iconara
WIDE ROWS FAIL 
cardinality kills 
@iconara
sports, Sue, tablet 
date + cube 
slice + time slice + time slice + time 
metrics metrics metrics
Cassandra for all the Things
remember when we 
thought this was a problem?
date + 
cube + 
shard 
slice + time slice + time slice + time 
metrics metrics metrics 
H(slice) mod 12
TIME SERIES 
@iconara
cube + 
slice + metric 
time time time 
value value value 
cube 
slice slice slice
NARROW ROWS 
@iconara
cube + slice + 
epoch + metric 
time + version time + version time + version 
value value value 
cube + epoch 
slice slice slice 
time/1000
NARROW ROWS 
enables parallel reads 
@iconara
SELECT 
category, 
device_type, 
COUNT(*) AS pageviews, 
AVG(duration) AS duration 
FROM pageviews 
WHERE category = sports 
GROUP BY 1, 2, 3
category + 
device type 
culture + 
computer 
culture + 
tablet 
news + 
computer 
news + 
tablet 
news + 
mobile 
sports + 
computer 
sports + 
tablet 
sports + 
mobile
supports wildcard on device type 
category + 
device type 
culture + 
computer 
culture + 
tablet 
news + 
computer 
news + 
tablet 
news + 
mobile 
sports + 
computer 
sports + 
tablet 
sports + 
mobile 
device type + 
category 
computer + 
culture 
computer + 
news 
computer + 
sports 
mobile + 
news 
mobile + 
sports 
tablet + 
culture 
tablet + 
news 
tablet + 
sports 
supports wildcard on category
TRANSIENT STATE 
  
@iconara
session ID 
timestamp timestamp timestamp 
data data data 
shard 
session ID session ID session ID 
H(session ID) mod 360
WIDE ROWS FAIL 
(again) 
@iconara
shard 9 
NFNJ0U NFNJ13 NFNJ0Y NFNJ1L NFNJ16 NFNJ0U NFNJ1C NFNJ20 NFNJ0U NFNJ2L NFNJ2S NFNJ2D NFNJ2U NFNJ1X NFNJ4C NFNJ1O NFNJ1A NFNJ29
session ID 
timestamp timestamp timestamp 
data data data 
shard 
session ID session ID session ID
session ID 
timestamp timestamp timestamp 
data data data 
shard + slot 
session ID session ID session ID
session ID 
timestamp timestamp timestamp 
data data data 
shard + slot 
session ID session ID session ID 
day-of-year mod 30
shard 9 
slot 1    
shard 9 
slot 3 
NFNJ6Z NFNJ73 NFNJ7B NFNJ72 NFNJ7N NFNJ74 NFNJ6Z NFNJ8C NFNJ7N NFNJ88 NFNJ83 NFNJ94 NFNJ8Z NFNJ7P NFNJA3       
shard 9 
slot 2 
NFNJ58 NFNJ5H NFNJ5C NFNJ5E NFNJ68 NFNJ6H NFNJ68 NFNJ5M NFNJ64 NFNJ6H NFNJ6C NFNJ5U NFNJ5K NFNJ84 NFNJ7Y NFNJ62 NFNJ70 NFNJ74 NFNJ6Q
AND MORE 
@iconara
GRAPHS 
@iconara
TRACES 
@iconara
KEY/VALUE 
@iconara
CASSANDRA 
FOR ALL 
THE THINGS 
@iconara
@iconara 
burtcorp.com 
architecturalatrocities.com

More Related Content

Cassandra for all the Things