Tuesday, September 17, 2013

Tweaking Consistency with Cassandra




In the new age of the Internet, using a relational databases to handle large amounts can lead to trouble  :

"Load-balancing and failover are sometimes difficult to achieve even on a smaller scale with relational databases, especially if you don’t have the option to license a commercial database clustering option. And even if you can, there are limits to scalability. People tend to workaround these problems with master-slave database configurations, but they can be difficult to set up and manage"
Cassandra is one of the viable  NoSQL options that accounts for scalability. Moreover, for the developers that are used to working with relational databases it offers a familiar query language :
With the introduction of the Cassandra Query Language (CQL) Cassandra now supports declaring schema and typing for your data model. For the application developer, this feature brings the Cassandra data model somewhat closer to the relational (relations and tuples) model.
In relational, scalability is hindered by the amount of effort that its put towards achieving consistency. As a result, many NoSQL databases allows for a lower consistency level (i.e. eventual consistency) , with the benefit of added scalability. Cassandra even allows you to customize the consistency level:
Promoting availability over consistency became a key design tenet for many NoSQL databases. Other common design goals for NoSQL databases include high performance, horizontal scalability, simplicity and schema flexibility. These design goals were also shared by Cassandra founders, but it was also designed to be CAP-aware, meaning the developer is allowed to tune the tradeoff between consistency and latency

As far as an API to use with Cassandra for the developer, there are two good options out there:
Because Cassandra user community is still growing, it’s good to choose a client with an active user community and existing documentation. Astyanax client, developed by Netflix, currently seems to be the most widely used, production-ready and feature complete Java client for Cassandra. This client supports both Thrift and CQL 3 based APIs for accessing the data. DataStax, a company that provides commercial Cassandra offering and support, is also developing their own CQL 3 based Java driver, which recently came out of beta phase.

No comments:

Post a Comment