Your SlideShare is downloading. ×
Cassandra
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Cassandra

4,049
views

Published on

Published in: Technology

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,049
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
66
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Cassandra
    Jahangir Mohammed
    md.jahangir27@gmail.com
  • 2. What is Cassandra?
    Distributed data store
    O(1) DHT
    Column-oriented
    Dynamo + Big Table
  • 3. Why not RDBMS?
    Many-to-many relationships -> Joins -> Denormalization -> Multiple copies of data or redundancy
    Rigid schema
    Vertical scaling is easier than horizontal
    ACID, Distributed transaction, Two-phase commit
    Slower writes
  • 4. CAP Theorem
    Consistency – All clients will read the same data at same time.
    Availability – Service always up and running.
    Partition tolerance – System on whole operates despite network issues.
  • 5.
  • 6. Features
    Proven
    Rich data model
    Scalable
    Distributed & Decentralized
    Cross datacenter support
    High performance writes/reads
    No SPOF
    Schema free
    Tunable consistency
  • 7. Limitations
    No ACID transactions(if needed)
    Eventually consistent(Tunable consistency, trade-off with performance)
  • 8. ARCHITECTURE
    Ring
    Each node – unique token
    Tokens range from 0 to 2**127
    Keys MD5 hash to determine node
  • 9. RING
    h(key1)
    0
    1
    N=3
    B
    h(key2)
    A
    C
    F
    E
    D
    1/2
    9
  • 10. ARCHITECTURE
    P2P:
    All nodes are identical
    No “master” node
    Gossip:
    Protocol for intra-ring communication
    Each node have state information about other nodes
    Anti-entropy & Read Repair:
    Replica synchronization mechanism
    Occurs during major compaction
    Uses Merkle trees
  • 11. READ REPAIR
    Client
    Result
    Query
    Cassandra Cluster
    Read repair if digests differ
    Closest replica
    Result
    Replica A
    Digest Query
    Digest Response
    Digest Response
    Replica B
    Replica C
  • 12. WRITE PATH
    Commit log: Responsible for all writes
    Memtable: In-memory data structure, written after commit log.
    SSTable:
    Immutable table
    Memtable flushed to disk
  • 13. WRITE PATH
    Key (CF1 , CF2 , CF3)
    Memtable ( CF1)
    Commit Log
    Binary serialized
    Key ( CF1 , CF2 , CF3 )
    Memtable ( CF2)
    FLUSH
    Memtable ( CF2)
    Data file on disk
    <Key name><Size of key Data><Index of columns/supercolumns>< Serialized column family>
    ---
    ---
    ---
    ---
    <Key name><Size of key Data><Index of columns/supercolumns>< Serialized column family>
    Dedicated Disk
  • 16. READ PATH
  • 17. ARCHITECTURE
    Bloom filter:
    Performance booster
    Fast, nondeterministic algorithms
    In memory
    Used during read operation
    Tombstones:
    Deletion marker
    Soft delete
    Marker older than a set time, GC’ed
  • 18. HINTED HANDOFF & COMPACTION
    Hinted Handoff:
    Node responsible down
    Coordinator creates hint
    Compaction:
    Merge SSTables.
    Keys merged
    Columns combined
    Tombstones discarded
    New index created
  • 19. PARTITIONER
    Decides where row key(data) finds place in ring.
    Random Partitioner:
    MD5 hash
    Spreads keys evenly
    Inefficient range queries
    Order-Preserving Partitioner:
    Rows sorted
  • 20. DATA MODEL
    Keyspace:
    Like Database.
    Container for CFs.
    Column Family:
    Like Table(But, not exactly a relational database table).
    Container of rows.
    Row:
    Sorted collection of columns.
    Column:
    Basic unit of data structure.
    Triplet of name, value and timestamp
  • 21. DATA MODEL
    Super Column:
    Special column.
    Sorted associative array of columns.
    Map of maps.
    Only one level deep.
    Super Column Family:
    Container of rows having super columns.
    4-D DHT = Standard CF:
    [Keyspace][ColumnFamily][Key][Column].
    5-D DHT = Super CF:
    [Keyspace][ColumnFamily][Key][SuperColumn][SubColumn].
  • 22. REPLICATION & CONSISTENCY
    Replication: No. of copies of data in the system.
    Consistency level: No. of replicas to respond.
  • 23. WRITE
  • 24. READ
  • 25. REPLICA PLACEMENT STRATEGY
    Simple Strategy:
    Rack-Unaware
    Fast
    Single D.C.
  • 26. SIMPLE STRATEGY
  • 27. OLD NTS
    Rack-aware
    Same D.C.
  • 28. NTS
    Rack-aware
    D.C. aware
  • 29. IMAGE REFERENCES
    Nathan Hurst’s Blog
    http://2.bp.blogspot.com/_YGilJHLjrrI/TJy3K0wshLI/AAAAAAAAAOI/ogAvf8Ckq3k/s1600/cassandra-ring2.png
    Sigmod presentation: Avinash et. al, Facebook
    Datastax
    http://answers.oreilly.com/topic/2408-replica-placement-strategies-when-using-cassandra/
  • 30. QUESTIONS?