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

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…

5 online tools in data visualization playground

While building up an analytics dashboard, one of the major decision points is regarding the type of charts and graphs that would provide better insight into the data. To avoid a lot of re-work later, it makes sense to try the various chart options during the requirement and design phase. It is probably a well known myth that existing tool options in any product can serve all the user requirements with just minor configuration changes. We all know and realize that code needs to be written to serve each customer’s individual needs.
To that effect, here are 5 tools that could empower your technical and business teams to decide on visualization options during the requirement phase. Listed below are online tools for you to add data and use as playground.
1)      Many Eyes: Many Eyes is a data visualization experiment by IBM Researchandthe IBM Cognos software group. This tool provides option to upload data sets and create visualizations including Scatter Plot, Tree Map, Tag/Word cloud and ge…

Pricing models for Hadoop products

A look at the various pricing models adopted by the vendors in the Hadoop ecosystem. While the pricing models are evolving in this rapid and dynamic market, listed below are some of the major variations utilized by companies in the sphere.
1) Per Node:Among the most common model, the node based pricing mechanism utilizes customized rules for determining pricing per node. This may be as straight forward as pricing per name node and data node or could have complex variants of pricing based on number of core processors utilized by the nodes in the cluster or per user license in case of applications.
2) Per TB:The data based pricing mechanism charges customer for license cost per TB of data. This model usually accounts non replicated data for computation of cost.
3) Subscription Support cost only:In this model, the vendor prefers to give away software for free but charges the customer for subscription support on a specified number of nodes. The support timings and level of support further …