Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra + Solr/Hadoop/Spark - Choosing the right tools

I'm currently investigating how to store and analyze enriched time based data with up to 1000 columns per line. At the moment Cassandra together with either Solr, Hadoop or Spark offered by Datastax Enterprise seem to fulfill my requirements on the rough. But the devil is in the detail.

Out of the 1000 columns about 60 are used for real-time-like queries (web-frontend, user sends form and expect quick response). These queries are more or less GROUPBY statements where the number or occurrences are counted.

As Cassandra itself does not provide the required analytical capabilities (no GROUPBY), I'm left these alternatives:

  • Roughly query via Cassandra and filter the resultset within self-written code
  • Index the data with Solr and run facet.pivot queries
  • Use either Hadoop or Spark and run the queries

The first approach seems cumbersome and prone to errors… Solr does have some anayltic features but without multifield grouping I'm stuck with pivots. I don't know whether this is a good or performant approach though… Last but not least there are Hadoop and Spark, the prior known not to be the best for real-time queries, the later pretty new and maybe not production ready.

So which way to go? There is no one-fits-all here, but before I go one way through I'd like to get some feedback. Maybe I'm thinking to complex or my expectations are too high :S

Thanks in advance,

Arman

like image 529
Arman Avatar asked Mar 30 '14 14:03

Arman


People also ask

Is spark better than Hadoop?

Spark is much faster as it uses MLib for computations and has in-memory processing. Hadoop has a slower performance as it uses disk for storage and depends upon disk read and write operations. It has fast performance with reduced disk reading and writing operations.

Why spark is preferred over Hadoop?

Like Hadoop, Spark splits up large tasks across different nodes. However, it tends to perform faster than Hadoop and it uses random access memory (RAM) to cache and process data instead of a file system. This enables Spark to handle use cases that Hadoop cannot.

Is Spark 100 times faster than Hadoop?

Apache Spark is potentially 100 times faster than Hadoop MapReduce. Apache Spark utilizes RAM and isn't tied to Hadoop's two-stage paradigm. Apache Spark works well for smaller data sets that can all fit into a server's RAM. Hadoop is more cost-effective for processing massive data sets.

Is Hadoop faster than spark?

Spark runs 100 times faster in memory and 10 times faster on disk. The reason behind Spark being faster than Hadoop is the factor that it uses RAM for computing read and writes operations. On the other hand, Hadoop stores data in various sources and later processes it using MapReduce.


2 Answers

In a place I work now we have a similar set of tech requirements and a solution is Cassandra-Solr-Spark, exactly in that order.

So if a query can be "covered" by Cassandra indices - good, if not - it's covered by Solr. For testing & less often queries - Spark (Scala, no SparkSQL due to old version of it -- it's a bank, everything should be tested and matured, from cognac to software, argh).

Generally I agree with the solution, though sometimes I have a feeling that some client's requests should NOT be taken seriously at all, saving us from loads of weird queries :)

like image 184
aleck Avatar answered Sep 21 '22 15:09

aleck


I would recommend Spark, if you take a loot at the list of companies using it you'll such names as Amazon, eBay and Yahoo!. Also, as you noted in the comment, it's becoming a mature tool.

You've given arguments against Cassandra and Solr already, so I'll focus on explaining why Hadoop MapReduce wouldn't do as well as Spark for real-time queries.

Hadoop and MapReduce were designed to leverage hard disk under the assumption that for big data IO is negligible. As a result data are read and wrote at least twice - in map stage and in reduce stage. This allows you to recover from failures as partial result are secured but it that's not want you want when aiming for real-time queries.

Spark not only aims to fix MapReduce shortcomings, it also focuses on interactive data analysis, which is exactly what you want. This goal is achieved mainly by utilizing RAM and the results are astonishing. Spark jobs will often be 10-100 times faster than MapReduce equivalents.

The only caveat is the amount of memory you have. Most probably your data is probably going to feat in the RAM you can provide or you can rely on sampling. Usually when interactively working with data there is no real need to use MapReduce and it seems to be so in your case.

like image 38
GallantQuail Avatar answered Sep 25 '22 15:09

GallantQuail