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

Similar documents
Distributed Systems 16. Distributed File Systems II

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

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

Distributed File Systems II

The Google File System

CA485 Ray Walshe Google File System

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

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

Distributed Filesystem

CLOUD-SCALE FILE SYSTEMS

CSE 124: Networked Services Lecture-16

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

CSE 124: Networked Services Fall 2009 Lecture-19

The Google File System. Alexandru Costan

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

The Google File System

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

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

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

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

The Google File System

GFS Overview. Design goals/priorities Design for big-data workloads Huge files, mostly appends, concurrency, huge bandwidth Design for failures

Recap. CSE 486/586 Distributed Systems Google Chubby Lock Service. Recap: First Requirement. Recap: Second Requirement. Recap: Strengthening P2

The Google File System (GFS)

Google File System. By Dinesh Amatya

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

The Google File System

Recap. CSE 486/586 Distributed Systems Google Chubby Lock Service. Paxos Phase 2. Paxos Phase 1. Google Chubby. Paxos Phase 3 C 1

The Google File System

GFS: The Google File System. Dr. Yingwu Zhu

MapReduce. U of Toronto, 2014

The Google File System

HDFS Architecture Guide

7680: Distributed Systems

The Google File System

CS November 2017

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

Distributed System. Gang Wu. Spring,2018

BigData and Map Reduce VITMAC03

NPTEL Course Jan K. Gopinath Indian Institute of Science

CS /15/16. Paul Krzyzanowski 1. Question 1. Distributed Systems 2016 Exam 2 Review. Question 3. Question 2. Question 5.

Google File System. Arun Sundaram Operating Systems

DISTRIBUTED SYSTEMS [COMP9243] Lecture 9b: Distributed File Systems INTRODUCTION. Transparency: Flexibility: Slide 1. Slide 3.

GFS: The Google File System

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

CS435 Introduction to Big Data FALL 2018 Colorado State University. 11/7/2018 Week 12-B Sangmi Lee Pallickara. FAQs

Distributed Systems. GFS / HDFS / Spanner

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

A BigData Tour HDFS, Ceph and MapReduce

Google File System 2

Google is Really Different.

Distributed Systems. Lec 10: Distributed File Systems GFS. Slide acks: Sanjay Ghemawat, Howard Gobioff, and Shun-Tak Leung

Hadoop and HDFS Overview. Madhu Ankam

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

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

The Google File System

HDFS: Hadoop Distributed File System. Sector: Distributed Storage System

goals monitoring, fault tolerance, auto-recovery (thousands of low-cost machines) handle appends efficiently (no random writes & sequential reads)

CS 138: Google. CS 138 XVI 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

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

CS November 2018

Google File System, Replication. Amin Vahdat CSE 123b May 23, 2006

Map-Reduce. Marco Mura 2010 March, 31th

UNIT-IV HDFS. Ms. Selva Mary. G

CS 138: Google. CS 138 XVII 1 Copyright 2016 Thomas W. Doeppner. All rights reserved.

4/9/2018 Week 13-A Sangmi Lee Pallickara. CS435 Introduction to Big Data Spring 2018 Colorado State University. FAQs. Architecture of GFS

BigTable. Chubby. BigTable. Chubby. Why Chubby? How to do consensus as a service

Outline. INF3190:Distributed Systems - Examples. Last week: Definitions Transparencies Challenges&pitfalls Architecturalstyles

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

Exam 2 Review. October 29, Paul Krzyzanowski 1

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

Lecture XIII: Replication-II

Distributed Systems. Hajussüsteemid MTAT Distributed File Systems. (slides: adopted from Meelis Roos DS12 course) 1/25

Hadoop Distributed File System(HDFS)

Bigtable: A Distributed Storage System for Structured Data By Fay Chang, et al. OSDI Presented by Xiang Gao

Today CSCI Coda. Naming: Volumes. Coda GFS PAST. Instructor: Abhishek Chandra. Main Goals: Volume is a subtree in the naming space

Google Disk Farm. Early days

Introduction to Cloud Computing

MI-PDB, MIE-PDB: Advanced Database Systems

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

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

Dept. Of Computer Science, Colorado State University

GFS. CS6450: Distributed Systems Lecture 5. Ryan Stutsman

Abstract. 1. Introduction. 2. Design and Implementation Master Chunkserver

Chapter 5. The MapReduce Programming Model and Implementation

Distributed File Systems

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

Distributed File Systems (Chapter 14, M. Satyanarayanan) CS 249 Kamal Singh

The Chubby lock service for loosely- coupled distributed systems

GFS-python: A Simplified GFS Implementation in Python

CS60021: Scalable Data Mining. Sourangshu Bhattacharya

NPTEL Course Jan K. Gopinath Indian Institute of Science

Parallel Programming Principle and Practice. Lecture 10 Big Data Processing with MapReduce

DISTRIBUTED FILE SYSTEMS CARSTEN WEINHOLD

Lecture 11 Hadoop & Spark

Distributed Computation Models

CS370 Operating Systems

9/26/2017 Sangmi Lee Pallickara Week 6- A. CS535 Big Data Fall 2017 Colorado State University

The Google File System GFS

Google Cluster Computing Faculty Training Workshop

Transcription:

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

Google Chubby ( Apache Zookeeper) 2

Chubby Distributed lock service + simple fault-tolerant file system Interfaces File access Event notification File locking Chubby is used to: Manage coarse-grained, long-term locks (hours or days, not < sec) get/release/check lock identified with a name Store small amounts of data associated with a name E.g., system configuration info, identification of primary coordinators Elect masters Design priority: availability rather than performance 3

Chubby Deployment Client library + a Chubby cell (5 replica servers) Client app Client app Chubby Library Chubby Library Chubby Chubby Chubby Memory cache Persistent database Paxos (consensus protocol) Chubby Elected master Client app Chubby Library Chubby Chubby Chubby Cell cell 4

Chubby Master Chubby has at most one master All requests from the client go to the master All other nodes (replicas) must agree on who the master is Paxos consensus protocol used to elect a master Master gets a lease time Re-run master selection after lease time expires to extend the lease or if the master fails When a Chubby node receives a proposal for a new master It will accept it only if the old master s lease expired 5

Simple User-level API for Chubby User-level RPC interface Not implemented under VFS Programs must access chubby via an API Look up Chubby nodes via DNS Ask any Chubby node for the master node File system interface (names, content, and locks) 6

Chubby: File System Interface /ls/cell/rest/of/name /ls: lock service (common to all Chubby names) cell: resolved to a set of servers in a Chubby cell via DNS lookup /rest/of/name: interpreted within the cell Each file has Name Data Access control list Lock No modification, access times naming looks sort of like AFS No seek or partial reads/writes; no symbolic links; no moves 7

Chubby: API open() close() GetContentsAndStat() SetContents(), SetACL() Set mode: read, write & lock, change ACL, event list, lock-delay, create Read file contents & metadata Write file contents or ACL Delete() Acquire(), TryAcquire(), Release() GetSequencer() SetSequencer() CheckSequencer() Lock operations Sequence # for a lock Associate a sequencer with a file handle Check if sequencer is valid 8

Chubby: Locks Every file & directory can act as a reader-writer lock Either one client can hold an exclusive (writer) lock Or multiple clients can hold reader locks Locks are advisory If a client releases a lock, the lock is immediately available If a client fails, the lock will be unavailable for a lock-delay period (typically 1 minute) 9

Using Locks for Leader Election Using Chubby locks makes leader election easy No need for user servers to participate in a consensus protocol the programmer doesn't need to figure out Paxos (or Raft) Chubby provides the fault tolerance Participant tries to acquire a lock If it gets it, then it s the master for whatever service it's providing! Example: electing a master & using it to write to a file server Participant gets a lock, becomes master (for its service, not Chubby) Gets a lock sequence count In each RPC to a server, send the sequence count to the server During request processing, a server will reject old (delayed) packets if (sequence_count < current_sequence_count) reject request /* it must be from a delayed packet */ 10

Events Clients may subscribe to events: File content modifications Child node added/removed/modified Chubby master failed over File handle & its lock became invalid Lock acquired Conflicting lock request from another client 11

Chubby client caching & master replication At the client Data cached in memory by chubby clients Cache is maintained by a Chubby lease, which can be invalidated All clients write through to the Chubby master At the master Writes are propagated via Paxos consensus to all Chubby replicas Data updated in total order replicas remain synchronized The master replies to a client after the writes reach a majority of replicas Cache invalidations Master keeps a list of what each client may be caching Invalidations sent by master and are acknowledged by client File is then cacheable again Chubby database is backed up to GFS every few hours 12

Parallel File Systems 13

Client-server file systems Central servers Point of congestion, single point of failure Alleviate somewhat with replication and client caching E.g., Coda, oplocks Limited replication can lead to congestion Separate set of machines to administer File data is still centralized A file server stores all data from a file not split across servers Even if replication is in place, a client downloads all data for a file from one server 14

Google File System (GFS) ( Apache Hadoop Distributed File System) 16

GFS Goals Scalable distributed file system Designed for large data-intensive applications Fault-tolerant; runs on commodity hardware Delivers high performance to a large number of clients 17

Design Assumptions Assumptions for conventional file systems don t work E.g., most files are small, lots have short lifetimes Component failures are the norm, not an exception File system = thousands of storage machines Some % not working at any given time Files are huge. Multi-TB files are the norm It doesn t make sense to work with billions of nkb-sized files I/O operations and block size choices are also affected 18

Design Assumptions File access: Most files are appended, not overwritten Random writes within a file are almost never done Once created, files are mostly read; often sequentially Workload is mostly: Reads: large streaming reads, small random reads these dominate Large appends Hundreds of processes may append to a file concurrently FS will store a modest number of files for its scale approx. a few million Designing the FS API with the design of apps benefits the system Apps can handle a relaxed consistency model 19

Basic Design Idea "Normal" file systems Store data & metadata on the same storage device Example: Linux directories are just files that contain lists of names & inodes inodes are data structures placed in well-defined areas of the disk that contain information about the file Lists of block numbers containing file data are allocated from the same set of data blocks used for file data Parallel file systems: separate data and metadata Metadata = information about the file Includes name, access permissions, timestamps, size, location of data blocks Data = actual file contents 20

Basic Design Idea Use separate servers to store metadata Metadata includes lists of (server, block_number) sets that hold file data We need more bandwidth for data access than metadata access Metadata is small; file data can be huge Use large logical blocks Most "normal" file systems are optimized for small files A block size is often 4KB Expect huge files, so use huge blocks List of blocks that makes up a file becomes easier to manage Replicate data Expect some servers to be down Store data on multiple servers 21

File System Interface GFS does not have a standard OS-level API No POSIX API No kernel/vfs implementation User-level API for accessing files GFS servers are implemented in user space using native Linux FS Files organized hierarchically in directories Operations Basic operations Create, delete, open, close, read, write Additional operations Snapshot: create a copy of a file or directory tree at low cost Append: allow multiple clients to append atomically without locking 22

GFS Master & Chunkservers GFS cluster Multiple chunkservers Data storage: fixed-size chunks Chunks replicated on several systems One master Stores file system metadata (names, attributes) Maps files to chunks Thousands of chunkservers chunkserver chunkserver chunkserver master chunkserver chunkserver chunkserver 23

GFS Master & Chunkservers GFS cluster directories & inodes metadata data blocks data chunkserver chunkserver chunkserver master chunkserver chunkserver chunkserver 24

GFS Files file A file is made of 64 MB chunks that are replicated for fault tolerance Chunks live on chunkservers chunkserver chunkserver chunkserver chunkserver master Checkpoint image Operation log In-memory FS metadata The master manages the file system namespace: names and name {chunk list} 25

Core Part of Google Cluster Environment Google Cluster Environment Core services: GFS + cluster scheduling system Typically 100s to 1000s of active jobs 200+ clusters, many with 1000s of machines Pools of 1000s of clients 4+ PB filesystems, 40 GB/s read/write loads Bring the computation close to the data Job 1 Job 2 Job n Job 1 Job 2 Job n GFS Master File system master Chunk Server Scheduling Slave Chunk Server Scheduling Slave Scheduling Master Job scheduler Linux Commodity HW Linux Commodity HW Chubby Lock Service Lease (lock) manager for mutex Machine 1 Machine n 26

Chunks and Chunkservers Chunk size = 64 MB (default) Chunkserver stores a 32-bit checksum with each chunk In memory & logged to disk: allows it to detect data corruption Chunk Handle: identifies a chunk Globally unique 64-bit number Assigned by the master when the chunk is created Chunkservers store chunks on local disks as Linux files Each chunk is replicated on multiple chunkservers Three replicas (different levels can be specified) Popular files may need more replicas to avoid hotspots 27

Master Maintains all file system metadata Namespace Access control info Filename to chunks mappings Current locations of chunks Manages Chunk leases (locks) Garbage collection (freeing unused chunks) Chunk migration (copying/moving chunks) Master replicates its data for fault tolerance Periodically communicates with all chunkservers Via heartbeat messages To get state and send commands 28

Client Interaction Model GFS client code linked into each app No OS-level API you have to use a library Interacts with master for metadata-related operations Interacts directly with chunkservers for file data All reads & writes go directly to chunkservers Master is not a point of congestion Neither clients nor chunkservers cache data Except for the caching by the OS system buffer cache Clients cache metadata E.g., location of a file s chunks 29

One master = simplified design All metadata stored in master s memory Super-fast access Namespaces and name-to-chunk_list maps Stored in memory Also persist in an operation log on the disk Replicated onto remote machines for backup Operation log similar to a journal All operations are logged Periodic checkpoints (stored in a B-tree) to avoid playing back entire log Master does not store chunk locations persistently This is queried from all the chunkservers: avoids consistency problems 30

Why Large Chunks? Default chunk size = 64MB (compare to Linux ext4 block sizes: typically 4 KB and up to 1 MB) Reduces need for frequent communication with master to get chunk location info Clients can easily cache info to refer to all data of large files Cached data has timeouts to reduce possibility of reading stale data Large chunk makes it feasible to keep a TCP connection open to a chunkserver for an extended time Master stores <64 bytes of metadata for each 64MB chunk 31

Reading Files 1. Contact the master 2. Get file s metadata: list chunk handles 3. Get the location of each of the chunk handles Multiple replicated chunkservers per chunk 4. Contact any available chunkserver for chunk data 32

Writing to files Less frequent than reading Master grants a chunk lease to one of the replicas This replica will be the primary replica chunkserver Primary can request lease extensions, if needed Master increases the chunk version number and informs replicas 33

Writing to files: two phases Phase 1: Send data Deliver data but don t write to the file A client is given a list of replicas Identifying the primary and secondaries Client writes to the closest replica chunkserver Replica forwards the data to another replica chunkserver That chunkserver forwards to another replica chunkserver Chunkservers store this data in a cache client chunkserver 1 chunkserver 2 chunkserver 3 34

Writing to files: two phases Phase 2: Write data Add it to the file (commit) Client waits for replicas to acknowledge receiving the data Send a write request to the primary, identifying the data that was sent The primary is responsible for serialization of writes Assigns consecutive serial numbers to all writes that it received Applies writes in serial-number order and forwards write requests in order to secondaries Once all acknowledgements have been received, the primary acknowledges the client client primary chunkserver chunkserver 2 chunkserver 3 35

Writing to files Data Flow (phase 1) is different from Control Flow (phase 2) Data Flow (upload): : Client to chunkserver to chunkserver to chunkserver Order does not matter Control Flow (write): Client to primary; primary to all secondaries Locking used; Order maintained Chunk version numbers are used to detect if any replica has stale data (was not updated because it was down) 36

Namespace No per-directory data structure like most file systems E.g., directory file contains names of all files in the directory No aliases (hard or symbolic links) Namespace is a single lookup table Maps pathnames to metadata 37

HDFS: Hadoop Distributed File System Primary storage system for Hadoop applications Hadoop Software library framework that allows for the distributed processing of large data sets across clusters of computers Hadoop includes: MapReduce : software framework for distributed processing of large data sets on compute clusters. Avro : A data serialization system. Cassandra : A scalable multi-master database with no single points of failure. Chukwa : A data collection system for managing large distributed systems. HBase : A scalable, distributed database that supports structured data storage for large tables. Hive : A data warehouse infrastructure that provides data summarization and ad hoc querying. Mahout : A Scalable machine learning and data mining library. Pig : A high-level data-flow language and execution framework for parallel computation. ZooKeeper : A high-performance coordination service for distributed applications. 38

HDFS Design Goals & Assumptions HDFS is an open source (Apache) implementation inspired by GFS design Similar goals and same basic design as GFS Run on commodity hardware Highly fault tolerant High throughput Designed for large data sets OK to relax some POSIX requirements Large scale deployments But Instance of HDFS may comprise 1000s of servers Each server stores part of the file system s data No support for concurrent appends 39

HDFS Design Goals & Assumptions Write-once, read-many file access model A file s contents will not change Simplifies data coherency Suitable for web crawlers and MapReduce applications 40

HDFS Architecture Written in Java Master/Slave architecture Single NameNode Master server responsible for the namespace & access control Multiple DataNodes Responsible for managing storage attached to its node A file is split into one or more blocks Typical block size = 128 MB (vs. 64 MB for GFS) Blocks are stored in a set of DataNodes 41

GFS file A file is made of 64 MB chunks that are replicated for fault tolerance Chunks live on chunkservers chunkserver chunkserver chunkserver chunkserver master Checkpoint image Operation log In-memory FS metadata The master manages the file system namespace 42

HDFS: same stuff different names file A file is made of 128 MB blocks that are replicated for fault tolerance Blocks live on DataNodes DataNode DataNode DataNode DataNode NameNode FsImage EditLog In-memory FS metadata The master manages the file system namespace 43

NameNode (= GFS master) Executes metadata operations open, close, rename Maps file blocks to DataNodes Maintains HDFS namespace Transaction log (EditLog) records every change that occurs to file system metadata Entire file system namespace + file-block mappings is stored in memory and stored in a file (FsImage) for persistence NameNode receives a periodic Heartbeat and Blockreport from each DataNode Heartbeat = I am alive message Blockreport = list of all blocks on a datanode Keep track of which DataNodes own which blocks & replication count 44

DataNode (= GFS chunkserver) Responsible for serving read/write requests Blocks are replicated for fault tolerance App can specify # replicas at creation time Can be changed later Blocks are stored in the local file system at the DataNode 45

Rack-Aware Reads & Replica Selection Client sends request to NameNode Receives list of blocks and replica DataNodes per block Client tries to read from the closest replica Prefer same rack Else same data center Location awareness is configured by the admin 46

Writes Client caches file data into a temp file When temp file one HDFS block size Client contacts NameNode NameNode inserts file name into file system hierarchy & allocates a data block Responds to client with the destination data block Client writes to the block at the corresponding DataNode When a file is closed, remaining data is transferred to a DataNode NameNode is informed that the file is closed NameNode commits file creation operation into a persistent store (log) Data writes are chained: pipelined Client writes to the first (closest) DataNode That DataNode writes the data stream to the second DataNode And so on 47

Internet-based file sync & sharing: Dropbox 48

File synchronization Client runs on desktop Uploads any changes made within a dropbox folder Huge scale 100+ million users syncing 1 billion files per day Design Small client that doesn t take a lot of resources Expect possibility of low bandwidth to user Scalable back-end architecture 99%+ of code written in Python server software migrated to Go in 2013 49

What s different about dropbox? Most web-based apps have high read to write ratios E.g., twitter, facebook, reddit, 100:1, 1000:1, or higher But with Dropbox Everyone s computer has a complete copy of their Dropbox Traffic happens only when changes occur File upload : file download ratio roughly 1:1 Huge number of uploads compared to traditional services Must abide by most ACID requirements sort of Atomic: don t share partially-modified files Consistent: Operations have to be in order and reliable Cannot delete a file in a shared folder but have others see Durable: Files cannot disappear (OK to punt on Isolated ) 50

Dropbox: architecture evolution: version 1 One server: web server, app server, mysql database, sync server Server mid 2007 0 users Clients Clients Clients Clients See http://youtu.be/pe4gwstwhmc 51

Dropbox: architecture evolution: version 2 Server ran out of disk space: moved data to Amazon S3 service (key-value store) Servers became overloaded: moved mysql DB to another machine Clients periodically polled server for changes database Server Amazon S3 Metadata: Information about files Name, attributes, chunks Files broken into 4 MB chunks Hashes stored per file Deduplication: Store only one copy among multiple clients late 2007 ~0 users Clients Clients Clients Clients See http://youtu.be/pe4gwstwhmc 52

Dropbox: architecture evolution: version 3 Move from polling to notifications: add notification server Split web server into two: Amazon-hosted server hosts file content and accepts uploads (stored as blocks) Locally-hosted server manages metadata database Amazon S3 Notification server Metaserver Blockserver early 2008 50k users Clients Clients Clients Clients See http://youtu.be/pe4gwstwhmc 53

Dropbox: architecture evolution: version 4 Add more metaservers and blockservers Blockservers do not access DB directly; they send RPCs to metaservers Add a memory cache (memcache) in front of the database to avoid scaling database memcache Amazon S3 Notification server Meta Meta Meta Meta Server Load Balancer Block Block Server Block Server Block Server Server late 2008 ~100k users Clients Clients Clients Clients See http://youtu.be/pe4gwstwhmc 54

Dropbox: architecture evolution: version 5 10s of millions of clients Clients have to connect before getting notifications Add 2-level hierarchy to notification servers: ~1 million connections/server database memcache memcache memcache Amazon S3 Notification server server server Meta Meta Meta Meta Server Load Load Load Balancer Balancer Block Block Server Block Server Block Server Server early 2012 >50M users Clients Clients Clients Clients See http://youtu.be/pe4gwstwhmc 55

The End 56