Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The myth of Cassandra


Published on

This presentation goes over some introductory concepts of the Cassandra distributed database.

Published in: Technology
  • I am not an expert with Cassandra, but looks like the author is confused between SuperColumn and ColumnFamily. Mistakes like that _will_ confuse people who are trying to get started with Cassandra.
    Are you sure you want to  Yes  No
    Your message goes here

The myth of Cassandra

  1. 1. The Myth of Cassandra<br />I’ve had it with these crazed oracles<br />NoSQL Series<br />Cameron Kilgore | @thrillgore<br />
  2. 2. Cas·san·dra[kəˈsændrə], noun<br />[Classical Greek Mythology.] A daughter of Priam and Hecuba, a prophet cursed by Apollo so that her prophecies, though true, were fated never to be believed.<br />[fml. “Apache Cassandra”] An open-source distributed, non-relational (NoSQL) database developed at Facebook, written in Java, and maintained as an Apache Software Foundation product<br />
  3. 3. What Cassandra does<br />Nonrelational associative array (key-value) data storage<br />Distributed<br />One-hop DHT (akin to Amazon Dynamo)<br />Eventually Consistent<br />Column-based storage<br />Queries faster than MySQL<br />Based on white papers and real-world use cases<br />Fault tolerant<br />Provides no single point of failure<br />Load balancing<br />
  4. 4. What Cassandra Does Not <br />Revision History<br />Relational Data<br />There’s this thing called “MySQL” that might be just up your alley<br />Provide an admin app<br />Chiton is an in-development desktop app<br /><br />Store individual data fields greater than 231-1 (2,147,483,647) bytes<br />Provide any interfaces outside of Thrift or high-level interfaces<br />
  5. 5. She who entangles companies<br />Already at use at Facebook<br />Also being used at:<br />Digg<br />Reddit<br />Twitter<br />Rackspace<br />Cisco<br />IBM<br />Cloudkick<br />OpenX<br />And more…<br />
  6. 6. Introducing Cassandra<br />Understanding the concepts of data in Cassandra, scalability<br />
  7. 7. Columns and Data<br />Data is stored in columns, each organized by keyspaces<br />Each column stores data and can be culled based on its name value, akin to an associative array<br />+name: byte[]<br />+value: byte[]<br />+timestamp: long<br />
  8. 8. Supercolumns<br />What happens when Xzibit uses Cassandra<br />Supercolumns allow you to nest n number of columns in another column<br />And in return in a key you can nest n number of supercolumns. (not shown here due to Office fail)<br />
  9. 9. Anatomy of a Column<br />Cassandra is written in Java, so we abide by the rules of its variables<br />Most of them will be bytestrings (byte[]), set in Unicode<br />+time being the only value not stored as a bytestring, instead as a long<br />Java compares the +time across other Cassandra nodes to reconcile data across nodes<br />Is NOT used for revision history<br />Each column represented by an unseen UUID<br />
  10. 10. Anatomy of a Column (cont.)<br />Columns are found by their +name value, not their UUID<br />You cannot have multiple columns of the same name (assigning one with the same name rewrites an existing one in that given keyspace)<br />
  11. 11. Accessing the Data<br />Data accessed through the Apache Incubator™ Thrift API<br />Thrift can be accessed with any programming language or application<br />High-level implementations for languages exist<br />For our demos we’re going to use the cassandra-cli client, which gives us the ability to insert/remove/edit<br />
  13. 13. Security in Cassandra<br />Cassandra does have user authentication through a SimpleAuthenticator module that is configured in conf files<br />Very rudimentary<br />Ran out of time and suitable documentation to demonstrate it<br />Cassandra is not ACID-compliant<br />
  14. 14. Load Balancing<br />Cassandra 0.6 has load balancing capabilities<br />Not automatic, must be configured per node<br />Load is shared in a token-ring fashion across the nodes in a multi-node configuration<br />Covered in the documentation for Cassandra<br />
  15. 15. Monitoring Cassandra<br />Cassandra exposes metrics as JMX data, so any JMX monitoring app should be sufficient.<br />Nagios<br />Munin<br />OpenNMS<br />Any official Oracle™ Java monitoring and administration software<br />What? I can’t be bothered to not search for the name of the software?<br />Cassandra also has software for monitoring node activity, check the docs<br />
  16. 16. Use Case Example<br />And a very simple one at that<br />
  17. 17. Product Ordering Application<br />An ordering application implemented using a SQL database could span hundreds of tables and require constant iterations over its lifespan<br />What if the attributes of these products (in this case, HVAC components) were stored in Cassandra, and we kept pricing, users, and sessions data in a RDBMS?<br />
  18. 18. Benefits to Cassandra<br />The data for these products that might need to be added won’t require new RDBMS fields – we can just add them in new columns and write our code statements to ignore them if they aren’t there<br />We aren’t limited to bottlenecks in the RDBMS if we choose to go multinode in our Cassandra setup<br />No single point of failure if we choose to go multinode<br />If we get a lot of users (unlikely), the nodes will equally distribute the load<br />Less time spent on queries<br />Depends on how effective our data is stored and the performance of our application<br />
  19. 19. Downsides to Cassandra<br />We may not have the funding needed to procure a multinode configuration<br />No guarantee that existing data that might need to be reconfigured might be changed over time to meet the demands of sales, engineering, executive, etc.<br />Data collected and given some form of relation inside the application itself, with no schema<br />Cassandra lacks a vetted security framework that could put us at risk<br />Cassandra also lacks a complete administration application<br />Chiton is barely functional as-is<br />Might not make sense when some RDBMS can scale across machines<br />
  20. 20. A (crude) data map showing our data in practice<br />
  21. 21. Cassandra and PHP<br />This is a PHP User group after all.<br />
  22. 22. Talking to Cassandra<br />Low-level framework, Thrift, is the actual client API for Cassandra<br />In PHP we have two such frameworks that work through Thrift<br />phpcassa<br />Pandra<br />Ran out of time to prepare a demo<br />There’s always another time for a demo. Stay tuned.<br />
  23. 23. Any Questions?<br />You will be baked, and there will be cake<br />