Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cassandra Hands On (XKE March 2013)

Cassandra Hands On (XKE March 2013)

Support slides to present Cassandra and explain how it works under the hood.
Then link to Hands On.

Guillaume Balaine

March 06, 2013
Tweet

Other Decks in Programming

Transcript

  1. ★ The Column • Name : Any type, up to

    64 kb • Value : Anything, up to 2 Gb • Timestamp : A 64 bit Integer • TTL : Time To Live (optional) • A special type : Counter 2 Data Structures Wednesday, March 6, 13
  2. ★ Rows • Just an ordered map of columns •

    Has a key that can be any type • Has a token for its key • Column orders are defined by comparators • Static and Wide Rows 3 Data Structures Wednesday, March 6, 13
  3. ★ Column Family • A definition of rows : •

    Key and Default Validation Class • Comparator • A column family is made to answer a query • Made for denormalized data • Made to avoid joins and table scans 4 Data Structures Wednesday, March 6, 13
  4. ★ Keyspace • A grouping of ColumnFamilies • With a

    ReplicationStrategy • With a ReplicationFactor ★ Cluster • Nodes in a token ring • Can span datacenters • Can have Virtual nodes since 1.2 5 Data Structures Wednesday, March 6, 13
  5. ★ Thrift CLI (cassandra-cli) • Originally made to access with

    different clients • Commands are binaries • Con : too static, verbose ★ CQL (cqlsh -2 and -3) • High level query language • Made to look like SQL • CQL 2 is kind of a beta for CQL 3 6 Query Cassandra Wednesday, March 6, 13
  6. ★ Partitioners ★ Primary indexes • Basically a row key

    index ★ Secondary indexes • A hashtable represented by a ColumnFamily • Good for small number of values ★ Wide Row index • Just like plain old indexes, but must be maintained ★ Composite Column Indexes • These are actually inverted indexes 7 Indexing Wednesday, March 6, 13
  7. ★ Writes are very fast ★ Batch operations in 1.2

    ★ Commit log • Written there first if defined, for failure tolerance ★ Memtable • Writes in memory, considered successful • Flushes to SSTable ★ SSTable • Compacts data by a factor of 10 when compacted • Contains all writes for a row 8 Writing Wednesday, March 6, 13
  8. ★ Query by ... • Column names • Column range

    • Key range ★ Read Repair ★ Bloom filter 9 Read Wednesday, March 6, 13
  9. ★ Deletes just leave a tumbstone • Can you guess

    why ? 10 Deletes Wednesday, March 6, 13
  10. ★ Consistency can be configured • For reads • For

    writes ★ Cassandra is a BASE database ★ Achieve linear performance with eventual consistency 11 Consistency Wednesday, March 6, 13
  11. ★ Consistency can be configured • For reads • For

    writes ★ Cassandra is a BASE database ★ Achieve linear performance with eventual consistency 11 Consistency The CAP Theroem Consistency Partition Tolerance Availability Wednesday, March 6, 13
  12. ★ Key cache ★ Row cache • Loads the entire

    row • LRU Cache • Available space configured per node 12 Caching Wednesday, March 6, 13
  13. ★ Ops Center : free monitoring tool ★ Hadoop integration

    • Hive • Pig ★ Solar integration • Writes solar indexes in sstables 13 Datastax Stack Wednesday, March 6, 13