14
Log* with C* Naveen and Shesh

Log* with Cassandra

Embed Size (px)

Citation preview

Page 1: Log* with Cassandra

Log* with C*Naveen and Shesh

Page 2: Log* with Cassandra

Use Case

Page 3: Log* with Cassandra

Entity based approach• Select from orders where state=‘Dirty’

OrderID State others

x ‘Dirty’ ..

y ‘Synchronized’ ..

Z ‘Completed’ ..

Page 4: Log* with Cassandra

What we tried• Partition Key:‘Status’, Clustering Key: ’Order Id’• Status Change was Delete and an insert.• tombstones

Page 5: Log* with Cassandra

tombstones• t0(’dirty’) , t1(’synch’), t2(‘dirty’),…. tn

• n tombstones for the same record.• They stay for 10 days• Queries pick them even if the current state is not ‘dirty’

Page 6: Log* with Cassandra

Queues with C*

Page 7: Log* with Cassandra

Queue vs Log

Queue

Page 8: Log* with Cassandra

Log

Lo Log

Offset

Page 9: Log* with Cassandra

Log• Append only• Totally-ordered• Append-at-end(order of occurrence = order of insert)• e.g. change log, application log, kafka

Page 10: Log* with Cassandra

ComparisonSQL based Query Cassandra Based Query Cassandra Based Log

Complexity O(# of dirty orders) O(# of times dirtied in the last 10 days)

O(1)

Page 11: Log* with Cassandra

Log Log*

inserts No-intermediate Intermediate

lookup offset key

query getNext Key, getNext*, Range query,

Key vs offset distinction yes no

getNext implementation native simulated

Page 12: Log* with Cassandra

Architecture at LinkedIn

Page 13: Log* with Cassandra

Checkout

Soft Declined

Log

Completed Order Log

Dirty Order Log

Payment

OMS

Schedulers

WCS

Page 14: Log* with Cassandra

C*

Log* getNext, get(Key), getRange()

Scheduler(consumer)Checkout(producer) put(time, event)

getNext