Data Intensive Computing

Similar documents
Hadoop File System S L I D E S M O D I F I E D F R O M P R E S E N T A T I O N B Y B. R A M A M U R T H Y 11/15/2017

HDFS Architecture Guide

Cloud Computing and Hadoop Distributed File System. UCSB CS170, Spring 2018

Distributed Systems 16. Distributed File Systems II

HDFS Architecture. Gregory Kesden, CSE-291 (Storage Systems) Fall 2017

Distributed Filesystem

A BigData Tour HDFS, Ceph and MapReduce

18-hdfs-gfs.txt Thu Oct 27 10:05: Notes on Parallel File Systems: HDFS & GFS , Fall 2011 Carnegie Mellon University Randal E.

The Google File System. Alexandru Costan

MI-PDB, MIE-PDB: Advanced Database Systems

Distributed File Systems II

18-hdfs-gfs.txt Thu Nov 01 09:53: Notes on Parallel File Systems: HDFS & GFS , Fall 2012 Carnegie Mellon University Randal E.

CLOUD-SCALE FILE SYSTEMS

The Google File System

Hadoop and HDFS Overview. Madhu Ankam

7680: Distributed Systems

CPSC 426/526. Cloud Computing. Ennan Zhai. Computer Science Department Yale University

Map-Reduce. Marco Mura 2010 March, 31th

The Google File System

Design patterns for HPC: an introduction. Paolo Ciancarini Department of Informatics University of Bologna

TITLE: PRE-REQUISITE THEORY. 1. Introduction to Hadoop. 2. Cluster. Implement sort algorithm and run it using HADOOP

CA485 Ray Walshe Google File System

Distributed Systems. 15. Distributed File Systems. Paul Krzyzanowski. Rutgers University. Fall 2017

CS /30/17. Paul Krzyzanowski 1. Google Chubby ( Apache Zookeeper) Distributed Systems. Chubby. Chubby Deployment.

MapReduce. U of Toronto, 2014

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective

CSE 124: Networked Services Fall 2009 Lecture-19

BigData and Map Reduce VITMAC03

Distributed Systems. 15. Distributed File Systems. Paul Krzyzanowski. Rutgers University. Fall 2016

CS370 Operating Systems

The Google File System

CSE 124: Networked Services Lecture-16

Authors : Sanjay Ghemawat, Howard Gobioff, Shun-Tak Leung Presentation by: Vijay Kumar Chalasani

The Google File System

Introduction to Hadoop. Owen O Malley Yahoo!, Grid Team

Introduction to MapReduce

CS60021: Scalable Data Mining. Sourangshu Bhattacharya

The Google File System

Google File System (GFS) and Hadoop Distributed File System (HDFS)

CS6030 Cloud Computing. Acknowledgements. Today s Topics. Intro to Cloud Computing 10/20/15. Ajay Gupta, WMU-CS. WiSe Lab

Georgia Institute of Technology ECE6102 4/20/2009 David Colvin, Jimmy Vuong

The Google File System

Hadoop/MapReduce Computing Paradigm

Google File System. By Dinesh Amatya

Google File System. Sanjay Ghemawat, Howard Gobioff, and Shun-Tak Leung Google fall DIP Heerak lim, Donghun Koo

Google File System and BigTable. and tiny bits of HDFS (Hadoop File System) and Chubby. Not in textbook; additional information

The Google File System

CS370 Operating Systems

NPTEL Course Jan K. Gopinath Indian Institute of Science

UNIT-IV HDFS. Ms. Selva Mary. G

PLATFORM AND SOFTWARE AS A SERVICE THE MAPREDUCE PROGRAMMING MODEL AND IMPLEMENTATIONS

The Google File System (GFS)

A brief history on Hadoop

Distributed System. Gang Wu. Spring,2018

Data Clustering on the Parallel Hadoop MapReduce Model. Dimitrios Verraros

CS 345A Data Mining. MapReduce

HDFS: Hadoop Distributed File System. CIS 612 Sunnie Chung

Yuval Carmel Tel-Aviv University "Advanced Topics in Storage Systems" - Spring 2013

The Hadoop Distributed File System Konstantin Shvachko Hairong Kuang Sanjay Radia Robert Chansler

Konstantin Shvachko, Hairong Kuang, Sanjay Radia, Robert Chansler Yahoo! Sunnyvale, California USA {Shv, Hairong, SRadia,

Map Reduce. Yerevan.

HADOOP FRAMEWORK FOR BIG DATA

The Google File System

Clustering Lecture 8: MapReduce

Dept. Of Computer Science, Colorado State University

Lecture 11 Hadoop & Spark

Big Data Analytics. Izabela Moise, Evangelos Pournaras, Dirk Helbing

MapReduce, Hadoop and Spark. Bompotas Agorakis

Google File System. Arun Sundaram Operating Systems

Hadoop محبوبه دادخواه کارگاه ساالنه آزمایشگاه فناوری وب زمستان 1391

! Design constraints. " Component failures are the norm. " Files are huge by traditional standards. ! POSIX-like

CLIENT DATA NODE NAME NODE

Introduction to MapReduce. Instructor: Dr. Weikuan Yu Computer Sci. & Software Eng.

Cloud Programming. Programming Environment Oct 29, 2015 Osamu Tatebe

GFS: The Google File System. Dr. Yingwu Zhu

ΕΠΛ 602:Foundations of Internet Technologies. Cloud Computing

CISC 7610 Lecture 2b The beginnings of NoSQL

Performance Enhancement of Data Processing using Multiple Intelligent Cache in Hadoop

Hadoop Distributed File System(HDFS)

Cloudera Exam CCA-410 Cloudera Certified Administrator for Apache Hadoop (CCAH) Version: 7.5 [ Total Questions: 97 ]

Distributed File Systems

Cloud Computing at Yahoo! Thomas Kwan Director, Research Operations Yahoo! Labs

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective

Chapter 5. The MapReduce Programming Model and Implementation

Map Reduce Group Meeting

Systems Infrastructure for Data Science. Web Science Group Uni Freiburg WS 2013/14

GFS: The Google File System

Google Disk Farm. Early days

Analytics in the cloud

BIG DATA & HDFS. Anuradha Bhatia, Big Data & HDFS, NoSQL 1

Topics. Big Data Analytics What is and Why Hadoop? Comparison to other technologies Hadoop architecture Hadoop ecosystem Hadoop usage examples

Staggeringly Large Filesystems

Introduction to MapReduce

DEFINING BIG-DATA B. Ramamurthy

Introduction to Cloud Computing

STATS Data Analysis using Python. Lecture 7: the MapReduce framework Some slides adapted from C. Budak and R. Burns

Distributed Computation Models

MapReduce Spark. Some slides are adapted from those of Jeff Dean and Matei Zaharia

Flat Datacenter Storage. Edmund B. Nightingale, Jeremy Elson, et al. 6.S897

What is the maximum file size you have dealt so far? Movies/Files/Streaming video that you have used? What have you observed?

Transcription:

Data Intensive Computing B. Ramamurthy This work is Partially Supported by NSF DUE Grant#: 0737243, 0920335 1

Topics for discussion Problem Space: explosion of data Solution space: emergence of multi core, virtualization, cloud computing Inability of traditional file system to handle data deluge Emerging systems: Google File System (GFS) Salient features of GFS The Big data Computing Model MapReduce Programming Model (Algorithm) Hadoop Distributed File System (Data Structure) Cloud Computing and its Relevance to Big data and Dataintensive computing (next class) 2

Data Computation Continuum Machine learning; financial engineering; human genome project; Sloan Digital Sky survey; Compute intensive Ex: computation of digits of PI http://bellard.org/pi/pi2700e9/pipcrecord.pdf Data intensive Ex: analyzing web pages & index them 3

More dimensions Other variables: Communication Bandwidth,? Compute scale PFLOPS TFLOPS GFLOPS MFLOPS Realtime Systems Payroll Massively Multiplayer Online game (MMOG) Digital Signal Processing Weblog Mining Business Analytics K M G T P E Data scale 4

Top Ten Largest Databases Top ten largest databases (2007) 7000 6000 5000 4000 3000 Terabytes 2000 1000 0 LOC CIA Amazon YOUTube ChoicePt Sprint Google AT&T NERSC Climate Ref: http://www.businessintelligencelowdown.com/2007/02/top_10_largest_.html 02/28/09 5 5

Solution Processing Granularity Data size: small Pipelined Instruction level Concurrent Thread level Service Object level Indexed File level Mega Block level Virtual System Level Data size: large 6

Traditional Storage Solutions Off system/online storage/ secondary memory File system abstraction Offline/ tertiary memory RAID: Redundant Array of Inexpensive Disks NAS: Network Accessible Storage SAN: Storage area networks 7

Database and Database Management System Data source Transactional Data base server Relational db or similar foundation Tables, rows, result set, SQL ODBC: open data base connectivity Very successful business model: Oracle, DB2, MySQL, and others Persistence models: EJB, DAO, ADO (look up the abbreviation in any of enterprise model documentation you are working with) 8

Distributed file system(dfs) A dedicated server manages the files for an compute environment For example, nickelback,cse.buffalo.edu is your file server and that is why we did not want you to run your user applications on this machine. DFS addresses various transparencies: location transparency, sharing, performance etc. Single largest file is approximately few terabytes with typical page size of 4 8K. What is the page table size for the largest file? Ex: 16T/8K = ~8G 9

Emerging Systems 10

On to Google File Internet introduced a new challenge in the form web logs, web crawler s data: large scale peta scale But observe that this type of data has an uniquely different characteristic than your transactional or the order data on amazon.com: write once ; HIPPA protected healthcare and patient information; Historical financial data; Any historical data Google exploited this characteristics in its Google file system: S. Ghemavat 11

Data Characteristics Streaming data access Applications need streaming access to data Batch processing rather than interactive user access. Large data sets and files: gigabytes to terabytes size High aggregate data bandwidth Scale to hundreds of nodes in a cluster Tens of millions of files in a single instance Write once read many: a file once created, written and closed need not be changed this assumption simplifies coherency WORM inspired a new programming model called the MapReduce programming model 12

The Big data Computing System 13

The Context: Big data Man on the moon with 32KB (1969); my laptop had 2GB RAM (2009) Google collects 270PB data in a month (2007), 20000PB a day (2008) 2010 census data is expected to be a huge gold mine of information Data mining huge amounts of data collected in a wide range of domains from astronomy to healthcare has become essential for planning and performance. We are in a knowledge economy. Data is an important asset to any organization Discovery of knowledge; Enabling discovery; annotation of data Complex computational models No single environment is good enough: need elastic, on demand capacities We are looking at newer programming models, and Supporting algorithms and data structures. NSF refers to this area as data intensive computing and industry calls it bigdata and cloud computing 14

Goals Of this Discussion To provide a simple introduction to: The big data computing : An important advancement that has a potential to impact significantly the CS and undergraduate curriculum. A programming model called MapReduce for processing big data A supporting file system called Hadoop Distributed File System (HDFS) To encourage students to explore ways to infuse relevant concepts of this emerging area into their application development 15

The Outline Introduction to MapReduce From CS Foundation to MapReduce MapReduce programming model Demo of MapReduce on Virtualized hardware Hadoop Distributed File System Demo (Internet access needed) Our experience with the framework Summary References 16

MAPREDUCE Bina Ramamurthy 4/13/2010 2010 17

What is MapReduce? MapReduce is a programming model Google has used successfully is processing its big data sets (~ 20000 peta bytes per day) Users specify the computation in terms of a map and a reduce function, Underlying runtime system automatically parallelizes the computation across large scale clusters of machines, and Underlying system also handles machine failures, efficient communications, and performance issues. Reference: Dean, J. and Ghemawat, S. 2008. MapReduce: simplified data processing on large clusters. Communication of ACM 51, 1 (Jan. 2008), 107 113. 18

From CS Foundations to MapReduce Consider a large data collection: {web, weed, green, sun, moon, land, part, web, green, } Problem: Count the occurrences of the different words in the collection. Lets design a solution for this problem; We will start from scratch We will add and relax constraints We will do incremental design, improving the solution for performance and scalability 19

Word Counter and Result Table {web, weed, green, sun, moon, land, part, web, green, } web 2 weed 1 Data collection Main WordCounter green 2 sun 1 moon 1 land 1 part 1 parse( ) count( ) DataCollection ResultTable 20

Multiple Instances of Word Counter web 2 weed 1 Data collection green 2 sun 1 moon 1 land 1 part 1 Observe: Multi-thread Lock on shared data 21

Improve Word Counter for Performance Main N o No need for lock web 2 Data collection weed 1 green 2 sun 1 moon 1 1..* Parser Thread 1..* Counter land 1 part 1 DataCollection WordList ResultTable Separate counters KEY web weed green sun moon land part web green. VALUE 22

Peta scale Data Main web 2 weed 1 green 2 Data collection 1..* Parser Thread 1..* Counter sun 1 moon 1 land 1 part 1 DataCollection WordList ResultTable KEY web weed green sun moon land part web green. VALUE 23

Addressing the Scale Issue Single machine cannot serve all the data: you need a distributed special (file) system Large number of commodity hardware disks: say, 1000 disks 1TB each Issue: With Mean time between failures (MTBF) or failure rate of 1/1000, then at least 1 of the above 1000 disks would be down at a given time. Thus failure is norm and not an exception. File system has to be fault tolerant: replication, checksum Data transfer bandwidth is critical (location of data) Critical aspects: fault tolerance + replication + load balancing, monitoring Exploit parallelism afforded by splitting parsing and counting Provision and locate computing at data locations 24

Peta scale Data Main web 2 weed 1 green 2 Data collection 1..* Parser Thread 1..* Counter sun 1 moon 1 land 1 part 1 DataCollection WordList ResultTable KEY web weed green sun moon land part web green. VALUE 25

Data collection Peta Scale Data is Commonly Distributed Data collection Main web 2 weed 1 green 2 Data collection Data collection 1..* Parser Thread 1..* Counter sun 1 moon 1 land 1 part 1 Data collection DataCollection WordList ResultTable Issue: managing the large scale data KEY web weed green sun moon land part web green. VALUE 26

Data collection Write Once Read Many (WORM) data Data collection Main web 2 weed 1 green 2 Data collection Data collection 1..* Parser Thread 1..* Counter sun 1 moon 1 land 1 part 1 Data collection DataCollection WordList ResultTable KEY web weed green sun moon land part web green. VALUE 27

Data collection WORM Data is Amenable to Parallelism Data collection Main Data collection Data collection 1..* Parser Thread 1..* Counter 1. Data with WORM characteristics : yields to parallel processing; 2. Data without dependencies: yields to out of order processing Data collection DataCollection WordList ResultTable 28

Divide and Conquer: Provision Computing at Data Location Data collection One node 1..* Parser DataCollection Main Thread WordList 1..* Counter ResultTable For our example, #1: Schedule parallel parse tasks #2: Schedule parallel count tasks This is a particular solution; Lets generalize it: Main Data collection 1..* Parser Thread 1..* Counter Our parse is a mapping operation: MAP: input <key, value> pairs DataCollection WordList ResultTable Data collection 1..* Parser DataCollection Main Thread WordList 1..* Counter ResultTable Our count is a reduce operation: REDUCE: <key, value> pairs reduced Map/Reduce originated from Lisp But have different meaning here Data collection DataCollection 1..* Parser Main Thread WordList 1..* Counter ResultTable Runtime adds distribution + fault tolerance + replication + monitoring + load balancing to your base application! 29

Mapper and Reducer MapReduceTask Mapper Reducer YourMapper Parser YourReducer Counter Remember: MapReduce is simplified processing for larger data sets: MapReduce Version of WordCount Source code 30

Map Operation MAP: Input data <key, value> pair Data Collection: split1 Data Collection: split 2 Data Collection: split n Split the data to Supply multiple processors Map Map web 1 weed 1 green 1 web 1 sun 1 weed 1 moon 1 green 1 land 1 web sun 1 1 part 1 weed moon 1 1 web 1 green land 1 web 1 1 green 1 sun part 1 weed 1 1 web 1 1 moon web 1 green 1 1 weedkey 1 VALUE land green 1 sun 1 1 green 1 part 1 moon 1 1 sun 1 web KEY 1 land VALUE 1 moon 1 green 1 part 1 land 1 1 web 1 part 1 KEY VALUE green 1 web 1 1 green 1 KEY VALUE 1 KEY VALUE 31

Reduce Operation MAP: Input data <key, value> pair REDUCE: <key, value> pair <result> Data Collection: split1 Split the data to Supply multiple processors Map Reduce Data Collection: split 2 Map Reduce Data Collection: split n Map Reduce 32

Large scale data splits Map <key, 1> Reducers (say, Count) Parse hash Count P-0000, count1 Parse hash Parse hash Count P-0001, count2 Parse hash Count P-0002,count3 33

MapReduce Example in my operating systems class Cat split map combine reduce part0 split map combine reduce part1 Bat Dog split map combine reduce part2 Other Words (size: TByte) split map 34

MAPREDUCE PROGRAMMING MODEL Bina Ramamurthy 4/13/2010 2010 35

MapReduce programming model Determine if the problem is parallelizable and solvable using MapReduce (ex: Is the data WORM?, large data set). Design and implement solution as Mapper classes and Reducer class. Compile the source code with hadoop core. Package the code as jar executable. Configure the application (job) as to the number of mappers and reducers (tasks), input and output streams Load the data (or use it on previously available data) Launch the job and monitor. Study the result. Detailed steps. 36

MapReduce Characteristics Very large scale data: peta, exa bytes Write once and read many data: allows for parallelism without mutexes Map and Reduce are the main operations: simple code There are other supporting operations such as combine and partition (out of the scope of this talk). All the map should be completed before reduce operation starts. Map and reduce operations are typically performed by the same physical processor. Number of map tasks and reduce tasks are configurable. Operations are provisioned near the data. Commodity hardware and storage. Runtime takes care of splitting and moving data for operations. Special distributed file system. Example: Hadoop Distributed File System and Hadoop Runtime. 37

Classes of problems mapreducable Benchmark for comparing: Jim Gray s challenge on dataintensive computing. Ex: Sort Google uses it (we think) for wordcount, adwords, pagerank, indexing data. Simple algorithms such as grep, text indexing, reverse indexing Bayesian classification: data mining domain Facebook uses it for various operations: demographics Financial services use it for analytics Astronomy: Gaussian analysis for locating extra terrestrial objects. Expected to play a critical role in semantic web and web3.0 38

HADOOP Bina Ramamurthy 4/13/2010 2010 39

What is Hadoop? At Google MapReduce operation are run on a special file system called Google File System (GFS) that is highly optimized for this purpose. GFS is not open source. Doug Cutting and Yahoo! reverse engineered the GFS and called it Hadoop Distributed File System (HDFS). The software framework that supports HDFS, MapReduce and other related entities is called the project Hadoop or simply Hadoop. This is open source and distributed by Apache. 40

Reference The Hadoop Distributed File System: Architecture and Design by Apache Foundation Inc. 41

Basic Features: HDFS Highly fault tolerant High throughput Suitable for applications with large data sets Streaming access to file system data Can be built out of commodity hardware 42

Fault tolerance Failure is the norm rather than exception A HDFS instance may consist of thousands of server machines, each storing part of the file system s data. Since we have huge number of components and that each component has non trivial probability of failure means that there is always some component that is non functional. Detection of faults and quick, automatic recovery from them is a core architectural goal of HDFS. 43

Data Characteristics Streaming data access Applications need streaming access to data Batch processing rather than interactive user access. Large data sets and files: gigabytes to terabytes size High aggregate data bandwidth Scale to hundreds of nodes in a cluster Tens of millions of files in a single instance Write once read many: a file once created, written and closed need not be changed this assumption simplifies coherency A map reduce application or web crawler application fits perfectly with this model. 44

ARCHITECTURE 4/13/2010 45 Bina Ramamurthy 2010

Namenode and Datanodes Master/slave architecture HDFS cluster consists of a single Namenode, a master server that manages the file system namespace and regulates access to files by clients. There are a number of DataNodes usually one per node in a cluster. The DataNodes manage storage attached to the nodes that they run on. HDFS exposes a file system namespace and allows user data to be stored in files. A file is split into one or more blocks and set of blocks are stored in DataNodes. DataNodes: serves read, write requests, performs block creation, deletion, and replication upon instruction from Namenode. 46

HDFS Architecture Metadata ops Namenode Metadata(Name, replicas..) (/home/foo/data,6... Client Read Datanodes Block ops Datanodes replication B Blocks Rack1 Write Rack2 Client 47

Hadoop Distributed File System HDFS Server Master node HDFS Client Application Local file system Block size: 2K Name Nodes Block size: 128M Replicated 48

File system Namespace Hierarchical file system with directories and files Create, remove, move, rename etc. Namenode maintains the file system Any meta information changes to the file system recorded by the Namenode. An application can specify the number of replicas of the file needed: replication factor of the file. This information is stored in the Namenode. 49

Data Replication HDFS is designed to store very large files across machines in a large cluster. Each file is a sequence of blocks. All blocks in the file except the last are of the same size. Blocks are replicated for fault tolerance. Block size and replicas are configurable per file. The Namenode receives a Heartbeat and a BlockReport from each DataNode in the cluster. BlockReport contains all the blocks on a Datanode. 50

Replica Placement The placement of the replicas is critical to HDFS reliability and performance. Optimizing replica placement distinguishes HDFS from other distributed file systems. Rack aware replica placement: Goal: improve reliability, availability and network bandwidth utilization Research topic Many racks, communication between racks are through switches. Network bandwidth between machines on the same rack is greater than those in different racks. Namenode determines the rack id for each DataNode. Replicas are typically placed on unique racks Simple but non optimal Writes are expensive Replication factor is 3 Another research topic? Replicas are placed: one on a node in a local rack, one on a different node in the local rack and one on a node in a different rack. 1/3 of the replica on a node, 2/3 on a rack and 1/3 distributed evenly across remaining racks. 51

Replica Selection Replica selection for READ operation: HDFS tries to minimize the bandwidth consumption and latency. If there is a replica on the Reader node then that is preferred. HDFS cluster may span multiple data centers: replica in the local data center is preferred over the remote one. 52

Hadoop Distributed File System HDFS Server Master node blockmap HDFS Client Application heartbeat Local file system Block size: 2K Name Nodes Block size: 128M Replicated 53

Safemode Startup On startup Namenode enters Safemode. Replication of data blocks do not occur in Safemode. Each DataNode checks in with Heartbeat and BlockReport. Namenode verifies that each block has acceptable number of replicas After a configurable percentage of safely replicated blocks check in with the Namenode, Namenode exits Safemode. It then makes the list of blocks that need to be replicated. Namenode then proceeds to replicate these blocks to other Datanodes. 54

Filesystem Metadata The HDFS namespace is stored by Namenode. Namenode uses a transaction log called the EditLog to record every change that occurs to the filesystem meta data. For example, creating a new file. Change replication factor of a file EditLog is stored in the Namenode s local filesystem Entire filesystem namespace including mapping of blocks to files and file system properties is stored in a file FsImage. Stored in Namenode s local filesystem. 55

Namenode Keeps image of entire file system namespace and file Blockmap in memory. 4GB of local RAM is sufficient to support the above data structures that represent the huge number of files and directories. When the Namenode starts up it gets the FsImage and Editlog from its local file system, update FsImage with EditLog information and then stores a copy of the FsImage on the filesytstem as a checkpoint. Periodic checkpointing is done. So that the system can recover back to the last checkpointed state in case of a crash. 56

Datanode A Datanode stores data in files in its local file system. Datanode has no knowledge about HDFS filesystem It stores each block of HDFS data in a separate file. Datanode does not create all files in the same directory. It uses heuristics to determine optimal number of files per directory and creates directories appropriately: Research issue? When the filesystem starts up it generates a list of all HDFS blocks and send this report to Namenode: Blockreport. 57

PROTOCOL 4/13/2010 58 Bina Ramamurthy 2010

The Communication Protocol All HDFS communication protocols are layered on top of the TCP/IP protocol A client establishes a connection to a configurable TCP port on the Namenode machine. It talks ClientProtocol with the Namenode. The Datanodes talk to the Namenode using Datanode protocol. RPC abstraction wraps both ClientProtocol and Datanode protocol. Namenode is simply a server and never initiates a request; it only responds to RPC requests issued by DataNodes or clients. 59

ROBUSTNESS 4/13/2010 60 Bina Ramamurthy 2010

Objectives Primary objective of HDFS is to store data reliably in the presence of failures. Three common failures are: Namenode failure, Datanode failure and network partition. 61

DataNode failure and heartbeat A network partition can cause a subset of Datanodes to lose connectivity with the Namenode. Namenode detects this condition by the absence of a Heartbeat message. Namenode marks Datanodes without Hearbeat and does not send any IO requests to them. Any data registered to the failed Datanode is not available to the HDFS. Also the death of a Datanode may cause replication factor of some of the blocks to fall below their specified value. 62

Re replication The necessity for re replication may arise due to: A Datanode may become unavailable, A replica may become corrupted, A hard disk on a Datanode may fail, or The replication factor on the block may be increased. 63

Cluster Rebalancing HDFS architecture is compatible with data rebalancing schemes. A scheme might move data from one Datanode to another if the free space on a Datanode falls below a certain threshold. In the event of a sudden high demand for a particular file, a scheme might dynamically create additional replicas and rebalance other data in the cluster. These types of data rebalancing are not yet implemented. 64

Data Integrity Consider a situation: a block of data fetched from Datanode arrives corrupted. This corruption may occur because of faults in a storage device, network faults, or buggy software. A HDFS client creates the checksum of every block of its file and stores it in hidden files in the HDFS namespace. When a clients retrieves the contents of file, it verifies that the corresponding checksums match. If does not match, the client can retrieve the block from a replica. 65

Metadata Disk Failure FsImage and EditLog are central data structures of HDFS. A corruption of these files can cause a HDFS instance to be nonfunctional. For this reason, a Namenode can be configured to maintain multiple copies of the FsImage and EditLog. Multiple copies of the FsImage and EditLog files are updated synchronously. Meta data is not data intensive. The Namenode could be single point failure: automatic failover is NOT supported! Another research topic. 66

DATA ORGANIZATION 4/13/2010 67 Bina Ramamurthy 2010

Data Blocks HDFS support write once read many with reads at streaming speeds. A typical block size is 64MB (or even 128 MB). A file is chopped into 64MB chunks and stored. 68

Staging A client request to create a file does not reach Namenode immediately. HDFS client caches the data into a temporary file. When the data reached a HDFS block size the client contacts the Namenode. Namenode inserts the filename into its hierarchy and allocates a data block for it. The Namenode responds to the client with the identity of the Datanode and the destination of the replicas (Datanodes) for the block. Then the client flushes it from its local memory. 69

Staging (contd.) The client sends a message that the file is closed. Namenode proceeds to commit the file for creation operation into the persistent store. If the Namenode dies before file is closed, the file is lost. This client side caching is required to avoid network congestion; also it has precedence is AFS (Andrew file system). 70

Replication Pipelining When the client receives response from Namenode, it flushes its block in small pieces (4K) to the first replica, that in turn copies it to the next replica and so on. Thus data is pipelined from Datanode to the next. 71

API (ACCESSIBILITY) Bina Ramamurthy 4/13/2010 2010 72

Application Programming Interface HDFS provides Java API for application to use. Python access is also used in many applications. A C language wrapper for Java API is also available. A HTTP browser can be used to browse the files of a HDFS instance. 73

FS Shell, Admin and Browser Interface HDFS organizes its data in files and directories. It provides a command line interface called the FS shell that lets the user interact with data in the HDFS. The syntax of the commands is similar to bash and csh. Example: to create a directory /foodir /bin/hadoop dfs mkdir /foodir There is also DFSAdmin interface available Browser interface is also available to view the namespace. 74

Space Reclamation When a file is deleted by a client, HDFS renames file to a file in be the /trash directory for a configurable amount of time. A client can request for an undelete in this allowed time. After the specified time the file is deleted and the space is reclaimed. When the replication factor is reduced, the Namenode selects excess replicas that can be deleted. Next heartbeat(?) transfers this information to the Datanode that clears the blocks for use. 75

Cloud Computing Complex computational models Large scale data Extraordinary resource needs Software as a service SaaS (Web services, Turbi Tax online tax filer) Platform as a service PaaS (Storage, bandwidth, compute cycles, machine as service: amazon EC2) Infrastructure as a service IaaS (Storage, CPUs, etc.: MS Azure) Enabling technology: Virtualization 76

Summary (1) We discussed the features of the Hadoop File System, a peta scale file system to handle bigdata sets. What discussed: Architecture, Protocol, API, etc. Missing element: Implementation The Hadoop file system (internals) An implementation of an instance of the HDFS (for use by applications such as web crawlers). KOSMIX file system (KFS) called cloudstore is a 4/13/2010 C++ implementation Bina Ramamurthy of GFS workalike. 2010 77

Summary (2) We introduced MapReduce programming model for processing large scale data We discussed the supporting Hadoop Distributed File System The concepts were illustrated using a simple example Relationship to Cloud Computing 78

Demo VMware simulated Hadoop and MapReduce demo Remote access to NEXOS system at my Buffalo office (broke?) 5 node HDFS running HDFS on Ubuntu 8.04 1 name node and 5 data nodes Each is an old commodity PC with 512 MB RAM, 120GB 160GB external memory Zeus (namenode), datanodes: hermes, dionysus, aphrodite, athena, theos CSE department s infrastructure (Dr. Chaudhary s) Amazon Elastic Cloud Computing (EC2) 79

References 1. Apache Hadoop Tutorial: http://hadoop.apache.org http://hadoop.apache.org/core/docs/current/mapred_tutorial.html 2. Dean, J. and Ghemawat, S. 2008. MapReduce: simplified data processing on large clusters. Communication of ACM 51, 1 (Jan. 2008), 107 113. 3. Cloudera Videos by Aaron Kimball: http://www.cloudera.com/hadoop training basic 4. http://www.cse.buffalo.edu/faculty/bina/mapreduce.html 80