Skip to main content

Apache Crunch: Laying the pipelines for the Hadoop refinery

Apache Crunch recently graduated from an incubator to an ASF top level project. Let’s take a better look at this Java library which aims to make writing, testing and running MapReduce pipelines easy.

Real world problems require a chain of Map, Shuffle, Reduce, Combine phases sequenced in parallel or one after the another. This chain of MapReduce phases for processing can be simply termed as a MapReduce pipeline. To coordinate this pipeline as well as provide data and implementation abstraction, Apache Crunch provides a library for Hadoop programmers. Hadoop, as we know, has often been compared to be a Data refinery and it makes sort of literal analogous extension for Crunch to fit in the role of pipeline for the Hadoop data refinery.

At the core of Apache Crunch is a data model which consists of classes like PCollection<T> and PTable<K,V> representing distributed, immutable collection of objects. Further, it has a defined set of operators which support primitive operations for parallel processing, grouping, sorting etc.
(hover over elements below to view description)

Data ModelOperators
Pipeline
DoFn
MRPipeline
CombineFn
MemPipeline
FilterFn
PCollection
Joins
PTable
Cartesian
PGroupTable
Sort
Source
Secondary Sort
Target
PObject
Emitter
BloomFilters
PType


For instance, to implement the common Word Count example, an Apache Crunch program would have the following steps:

  1. Create a Pipeline object
  2. Read input (e.g. text file) into a PCollection
  3. Execute various functions on input data
    e.g.
     
    PTable<String, Long> counts =
      lines.parallelDo(extractWord,
        Writables.strings())
            .count();
    Or
    PCollection<String> words = lines.parallelDo(new DoFn<String, String>() {
    public void process(String line, Emitter<String> emitter) {
            for (String word : line.split("\\s+")) {
              emitter.emit(word);
            }
          }
        }, Writables.strings());

     PTable<String, Long> counts = words.count();

  1. Persist the output collection and execute the pipeline


Beyond Pig and Hive, there are a couple of competing tools which have emerged in this space including Cascading, Scalding, Cascalog, Scoobi, Spark.  Apache Crunch, however like its parent FlumeJava, uses a multiple serializable type(MST) model instead of single serializable type(SST) model. MST is claimed by Crunch team to provide compile time verification, easy writing of user defined functions and support jobs using complex data types. Further, its is claimed to be a “better fit for data sets that do not naturally fit into the Tuple model, such as images, time series, audio files and seismograms”.

Crunch's MST serialization model currently has two different implementations, one based on Writables and the other based on Avro records. It has been acknowledged based on independent benchmarking that Avro implementation is much faster than Writables and should be preferred implementation for Crunch to gain performance advantage. Now that Crunch has matured out as top level project, we hope to see more committers and contributors beyond the currently pro-active pool. There is still some more usability journey for the product to cover like better documentation, easy tutorials, and manageable code. However, all these would be routine release activities as it registers its presence as part of commercial distributions as well. Meanwhile, welcome the new graduate. Cheers.

Comments

Popular posts from this blog

Beyond NSA, the intelligence community has a big technology footprint

While all through the past few days the focus has been on NSA activities, the discussion has often veered around the technologies and products used by NSA. At the same time, a side discussion topic has been the larger technical ecosystem of intelligence units. CIA has been one of the more prolific users of Information Technology by its own admission. To that extent, CIA spinned off a venture capital firm In-Q-Tel in 1999 to invest in focused sector companies. Per Helen Coster of Fortune Magazine, In-Q-Tel (IQT) has been named “after the gadget-toting James Bond character Q”.
In-Q-Tel states on its website that “We design our strategic investments to accelerate product development and delivery for this ready-soon innovation, and specifically to help companies add capabilities needed by our customers in the Intelligence Community”. To that effect, it has made over 200 investments in early stage companies for propping up products. Being a not-for-profit group, unlike Private Venture capi…

Data deduplication tactics with HDFS and MapReduce

As the amount of data continues to grow exponentially, there has been increased focus on stored data reduction methods. Data compression, single instance store and data deduplication are among the common techniques employed for stored data reduction.
Deduplication often refers to elimination of redundant subfiles (also known as chunks, blocks, or extents). Unlike compression, data is not changed and eliminates storage capacity for identical data. Data deduplication offers significant advantage in terms of reduction in storage, network bandwidth and promises increased scalability.
From a simplistic use case perspective, we can see application in removing duplicates in Call Detail Record (CDR) for a Telecom carrier. Similarly, we may apply the technique to optimize on network traffic carrying the same data packets.
Some of the common methods for data deduplication in storage architecture include hashing, binary comparison and delta differencing. In this post, we focus on how MapReduce and…

Top Big Data Influencers of 2015

2015 was an exciting year for big data and hadoop ecosystem. We saw hadoop becoming an essential part of data management strategy of almost all major enterprise organizations. There is cut throat competition among IT vendors now to help realize the vision of data hub, data lake and data warehouse with Hadoop and Spark.
As part of its annual assessment of big data and hadoop ecosystem, HadoopSphere publishes a list of top big data influencers each year. The list is derived based on a scientific methodology which involves assessing various parameters in each category of influencers. HadoopSphere Top Big Data Influencers list reflects the people, products, organizations and portals that exercised the most influence on big data and ecosystem in a particular year. The influencers have been listed in the following categories:

AnalystsSocial MediaOnline MediaProductsTechiesCoachThought LeadersClick here to read the methodology used.

Analysts:Doug HenschenIt might have been hard to miss Doug…