42

Why is using HBase a better choice than using Cassandra with Hadoop?

Can anyone please give a detailed explanation on this?

Thanks

0

1 Answer 1

78

I don't think either is better than the others, it's not just one or the other. These are very different systems, each with their strengths and weaknesses, so it really depends on your use cases. They can definitely be used in complement of one another in the same infrastructure.

To explain the difference better I'd like to borrow a picture from Cassandra: the Definitive Guide, where they go over the CAP theorem. What they say is basically for any distributed system, you have to find a balance between consistency, availability and partition tolerance, and you can only realistically satisfy 2 of these properties. From that you can see that:

  • Cassandra satisfies the Availability and Partition Tolerance properties.
  • HBase satisfied the Consistency and Partition Tolerance properties.

CAP

When it comes to Hadoop, HBase is built on top of HDFS, which makes it pretty convenient to use if you already have a Hadoop stack. It is also supported by Cloudera, which is a standard enterprise distribution for Hadoop.

But Cassandra also has more integration with Hadoop, namely Datastax Brisk which is gaining popularity. You can also now natively stream data from the output of a Hadoop job into a Cassandra cluster using some Cassandra-provided output format (BulkOutputFormat for example), we are no longer to the point where Cassandra was just a standalone project.

In my experience, I've found that Cassandra is awesome for random reads, and not so much for scans

To put a little color to the picture, I've been using both at my job in the same infrastructure, and HBase has a very different purpose than Cassandra. I've used Cassandra mostly for real-time very fast lookups, while I've used HBase more for heavy ETL batch jobs with lower latency requirements.

This is a question that would truly be worthy of a blog post, so instead of going on and on I'd like to point you to an article which sums up a lot of the keys differences between the 2 systems. Bottom line is, there is no superior solution IMHO, and you should really think about your use cases to see which system is better suited.

3
  • How can MySql have availability in your diagram? How is availability defined? It doesn't have sense to me, I think that you have to choose between C or A, not any 2. codahale.com/you-cant-sacrifice-partition-tolerance Commented Feb 20, 2013 at 4:02
  • 1
    @user1944408 Of course in every system there is a sense of compromise, this is simply to illustrate the sliding dependencies. You can't get 100% of one property while retaining 100% of another property, you have to make some trade-offs. Your article makes the assumption of partition tolerance, so of course you can't have both consistency and availability with this assumption. As taken from the same book, the systems on the CA line can be for example 2-phase commits for distributed transactions, so the system would block when a network partition occurs. Commented Feb 20, 2013 at 4:28
  • 2
    That means that they are not available when partition occurs, right? But that is the same with HBase as well so it would mean that HBase is CA. I think that databases can be CP or AP but not CA. Which property of CA database is not contained in CP database? Can you give me an example? If a partition happens what is the difference between HBase and sharded MySql? Commented Feb 20, 2013 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.