Skip to main content

Apache Hadoop (HDFS + MapReduce)

At a glance
  • Problem solved: store and process volumes larger than one machine, on fault-tolerant commodity hardware, without depending on a vendor.
  • Era: code moved out of Nutch on February 3, 2006, first release (0.1.0) on April 2, 2006, Apache top-level project on January 16, 2008, version 1.0 in January 2012.
  • Created by: Doug Cutting and Mike Cafarella (Nutch project), then a Yahoo! team that wrote 80% of the core.
  • Category: distributed storage + compute.

Historical context​

In the early 2000s, Doug Cutting and Mike Cafarella were building Nutch, an open source web search engine. Cutting recalls that this system, meant to process billions of pages, was "difficult to develop and operate". They had only five machines, many manual steps and no built-in reliability: losing a machine meant losing data (InformationWeek [S]).

Google's papers on GFS and MapReduce (2003 and 2004) changed the game. Cutting and Cafarella reimplemented a distributed file system and a MapReduce engine inside Nutch; by 2005 this version was "limping on 20-to-40 computer clusters", Cafarella at the University of Washington and Cutting at the Internet Archive.

Cutting joined Yahoo! in January 2006, and on February 3, 2006 the storage and compute code moved out of Nutch into a new project, Hadoop, named after his son's stuffed elephant. With "a dozen or so Yahoo! engineers and access to thousands of their computers", the project moved fast. According to Yahoo!'s HDFS paper (2010), the company had been investigating MapReduce on a distributed file system since 2004, and by the end of 2006 it had a 300-node development cluster.

Then came a fast ramp-up. By 2007 Hadoop could reliably process petabytes; Facebook, Twitter and LinkedIn adopted it in turn, and projects were built on top of it: Pig, Hive, HBase. Hadoop became an Apache top-level project in January 2008, won the terabyte sort benchmark the same year, and Cloudera was founded in August 2008 to commercialize it (InformationWeek [S]). In 2010 Yahoo! ran 25,000 Hadoop servers and 25 PB of data. In 2012 version 1.0 shipped, "six years in the making".

Key idea​

Spread data and compute over a cluster of ordinary machines, and move the computation to the data rather than the other way around. Cutting sums it up in one sentence: "Local drives are faster than networks", it is "mostly physics and economics" (InformationWeek [S]). Reliability does not come from the hardware (no RAID) but from software: every block exists in several copies, and any task can be rerun elsewhere.

How it works​

HDFS (Hadoop Distributed File System), modeled on GFS:

  • A NameNode holds the namespace (tree, permissions) and the block to DataNodes map, entirely in RAM. It writes a journal and checkpoints to disk.
  • DataNodes store blocks as local files. Files are split into large blocks (typically 128 MB at Yahoo! in 2010), each replicated three times by default.
  • To read, the client asks the NameNode where the blocks are, then reads from the closest DataNode. To write, it pushes data in a pipeline through three DataNodes nominated by the NameNode.
  • Each DataNode sends a heartbeat every 3 seconds; after 10 minutes without news, the NameNode declares it out of service and has its replicas recreated elsewhere.

MapReduce, the reimplementation of Google's model in Java: in Hadoop 1, a central JobTracker splits the job into map and reduce tasks, handed to TaskTrackers (one per node, with fixed map and reduce slots) as close as possible to the HDFS blocks; map outputs are sorted and sent to the reducers (shuffle); a failed task is rerun. The official tutorial runs word count like this:

bin/hadoop fs -ls /user/joe/wordcount/input/
bin/hadoop jar wc.jar WordCount /user/joe/wordcount/input /user/joe/wordcount/output
bin/hadoop fs -cat /user/joe/wordcount/output/part-r-00000

Major evolutions.

  • Hadoop 2: resource management moves out of MapReduce and becomes YARN (2.2.0, October 2013), opening the cluster to Spark, Tez and other engines.
  • High availability: "Prior to Hadoop 2.0.0, the NameNode was a single point of failure". Automatic failover relies on a ZooKeeper quorum and a ZKFailoverController process.
  • Hadoop 3.0.0 (December 2017): 6,242 issues fixed since 2.7.0.

By the numbers​

FigureContextSource
20 to 40 machinesSize of the "Google-inspired" Nutch clusters in 2005Cutting, 2016
300 nodesYahoo!'s Hadoop development cluster at the end of 2006HDFS paper, 2010
209 secondsTerabyte sort on 910 nodes, 2008 recordYahoo!, sortbenchmark
25,000 servers, 25 PBYahoo!'s Hadoop fleet in early 2010 (largest cluster: 3,500)HDFS paper, 2010
60 million filesOn a 3,500-node cluster, 63 million blocks (2010)HDFS paper, 2010
0.8% per month, 2 minutesNodes lost each month, and time to recreate their 54,000 replicas (2010)HDFS paper, 2010
More than 42,000 nodesLargest known Hadoop environment, at Yahoo! (January 2012)ASF 1.0 announcement
6,242 issuesFixed in the 3.0.0 series since 2.7.0 (December 2017)3.0.0 release

Milestones​

  • 2004-2005: Cutting and Cafarella reimplement GFS and MapReduce in Nutch, which runs on 20 to 40 machines in 2005.
  • February 3, 2006: the code leaves Nutch and becomes Hadoop (January 28, 2006 is the anniversary date used by the press [S]).
  • March 2006: first Hadoop research cluster at Yahoo! (InformationWeek [S]).
  • April 2, 2006: release 0.1.0, "the first Hadoop release".
  • January 16, 2008: the ASF board creates the Apache Hadoop top-level project, with Owen O'Malley as Vice President.
  • 2008: terabyte sort record (3.48 minutes); Cloudera founded in August (InformationWeek [S]).
  • January 4, 2012: Hadoop 1.0 (Kerberos, WebHDFS, HBase support).
  • October 15, 2013: Hadoop 2.2.0, the GA release of Hadoop 2.x with YARN.
  • December 13, 2017: Hadoop 3.0.0.

Did you know?​

  • "Hadoop" is the name of Doug Cutting's son's stuffed elephant.
  • Yahoo! wrote 80% of the Hadoop core (HDFS and MapReduce) according to its own 2010 paper, which also states that HBase came from Powerset, Hive from Facebook, and Pig and ZooKeeper from Yahoo!.
  • Yahoo!'s flagship application was the Web Map, an index of the web: 75 hours of compute, 500 TB of intermediate data and 300 TB of output.
  • The first Apache Hadoop project committee (2008) already included Jim Kellerman and Michael Stack, two future pillars of HBase.

Strengths and limitations​

StrengthsLimitations
Scales on commodity hardware (tens of thousands of nodes)MapReduce writes to disk at every step (slow)
Fault tolerance through replication and re-executionLow-level Java programming, not ergonomic
Open source, vendor independentSingle NameNode: metadata bounded by its RAM, single point of failure before Hadoop 2
Foundation of the whole ecosystem (Hive, HBase, Spark on YARN)Poor fit for iterative and interactive work

What came next​

  • Hive to query HDFS data in SQL.
  • HBase for real-time random access on top of HDFS.
  • ZooKeeper for coordination (including NameNode high availability).
  • YARN to separate resource management from MapReduce.
  • Spark to speed things up with in-memory compute; Impala and Trino for interactive SQL.
  • Columnar formats (Parquet, ORC) then table formats (Iceberg) on top of the files.

Sources​

To do
  • Read Cutting's post on the Cloudera site itself (timed out, read via a relay).
  • Replace with primary sources: the initial five machines, Yahoo!'s first cluster in March 2006, Cloudera's founding in August 2008 (InformationWeek only).
  • Date and source the start of the Nutch project itself.
  • Find a primary source for Yahoo!'s Search Webmap announcement (2008) and the exact date of the TeraSort record.