53
@iconara CASSANDRA FOR ALL THE THINGS

Cassandra for all the Things

Embed Size (px)

Citation preview

@iconara

CASSANDRA FOR ALL

THE THINGS

@iconara

CASSANDRA FOR ALL

THE THINGS

@iconara

THEOChief Architect at Burt

@iconara

THEOCassandra 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 TABLEpartitions as sorted maps

@iconara

DYNAMOavailability and simple ops

@iconara

LOGS AS STORAGEoptimized for writes

@iconara

CASSANDRA FTW

@iconara

CONVERSION TRACKING

$ $$ $$

@iconara

ATTRIBUTION$

@iconara

ATTRIBUTION

30s

5s90s

$

visitor IDtimestamp timestamp timestamp

event event event

visitor IDtimestamp timestamp timestamp

event event event

visitor IDtimestamp timestamp timestamp

event event event

visitor IDtimestamp timestamp timestamp

event event event

visitor IDtimestamp timestamp timestamp

event event event

visitor IDtimestamp timestamp timestamp

event event event

@iconara

1/10,000

@iconara

TTLautomatic windowing

@iconara

ANALYTICSprecomputed 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

date + cubeslice + time slice + time slice + time

metrics metrics metrics

date + cubeslice + time slice + time slice + time

metrics metrics metrics

“sports”, “Sue”, “tablet”

category, author, device type

date + cubeslice + time slice + time slice + time

metrics metrics metrics

{pageviews: 234, duration: 2451.45}

@iconara

COUNTERSat 2M increments per second they’re not cost-effective×

@iconara

WIDE ROWS FAILcardinality kills

date + cubeslice + time slice + time slice + time

metrics metrics metrics

“sports”, “Sue”, “tablet”

remember when we thought this was a problem?

date + cube + shard

slice + time slice + time slice + time

metrics metrics metrics

H(slice) mod 12

@iconara

TIME SERIES

cube + slice + metric

time time time

value value value

cubeslice slice slice

@iconara

NARROW ROWS

cube + slice + epoch + metric

time + version time + version time + version

value value value

cube + epochslice slice slice

time/1000

@iconara

NARROW ROWSenables parallel reads

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

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

supports wildcard on device type

@iconara

TRANSIENT STATE➔ ➔

session IDtimestamp timestamp timestamp

data data data

shardsession ID session ID session ID

H(session ID) mod 360

@iconara

WIDE ROWS FAIL(again)

shard 9NFNJ0U NFNJ13 NFNJ0Y NFNJ1L NFNJ16 NFNJ0U NFNJ1C NFNJ20 NFNJ0U NFNJ2L NFNJ2S NFNJ2D NFNJ2U NFNJ1X NFNJ4C NFNJ1O NFNJ1A NFNJ29× × × × × × × × × × × × × × × ×

session IDtimestamp timestamp timestamp

data data data

shardsession ID session ID session ID

session IDtimestamp timestamp timestamp

data data data

shard + slotsession ID session ID session ID

session IDtimestamp timestamp timestamp

data data data

shard + slotsession ID session ID session ID

day-of-year mod 30

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× × × × × × × × × × × × × × × ×shard 9 slot 1

× × ×

@iconara

AND MORE

@iconara

GRAPHS

@iconara

TRACES

@iconara

KEY/VALUE

@iconara

CASSANDRA FOR ALL

THE THINGS

@iconara

burtcorp.comarchitecturalatrocities.com