Distributed FilealSystem and GFS/HDFS
cloud_computing
1. DFS
1. Architecture:
- Client-Server : NFS (remote access model & upload/download model)
- Cluster-based : GFS (Mater-slave model, striping files for parallel access)
- HDT-based(symetric): Ivy
2. Attibutes List:
- Process
- Communication
- Naming
- Synchornization
- Consistency and Replication
- Fault Tolerance
- Security
3. Attributes Detail
3.1 Process:
3.1.1 Stateless:
Simplicity(no need to enter a recovery phase if server crashed), but no gurantee to exeute request from;
3.1.2 Stateful:
widely used, achieve file lock, authentication, effective caches in WAN
3.2 Communication:
3.2.1 RPC (Remote Process Call)
NFS v3, NFS v4 difference: compound precedure. (lookup, open, read requests in a single PRC)
3.2.2 RPC2
- a. support for side effect: can communicate with using an application-specific protocol
- b. suport for multicasting: no need for sequential order for invalidate file, can be parallel sending
3.3 Naming
3.3.1 In NFS:
- complete transparent access to remote file system as maintained by server
- only explicity exported subdirectories can be mounted remotely
- path name depend on mount points
- Server can itself mount directories that are exported by other servers, but not allow to export those directories to its own clients
- Client have to explicitly mount such a directory from the server that maintains it.
3.3.2 Name resolution: refer to the process of mapping a name to an object or multiple objects
3.3.3 Mount:
When to mount remote file system?
Boot time
+ Consistent view of FS
- May do unnecessary work
- Takes longer to boot
On explicit command by user
+ Give user control
- Require user to know & do things
Automount
+ “Subdirectories magically appear”
- “Subdirectories magically appear”
Automounting: Automount daemon always involved in every file operation!
Symbolic link
File Handle is a reference to file within a file system
3.3.4 Construct Global Name Space
- Similar to mount points, but deals with different file systems in WAN
- Explicitly separates resolution from file access
- Location service (per file system) handles mapping from name to location
- Advantage: decoupling the naming of files from their actual location
3.4 Symchronization
3.4.1 Semantics of file sharing
On a single processor, when a read follows a write, the value returned by the read is the value just written.
In a distributed system with caching: there is only one file server and clients do not cache files, obsolete values may be returned.
- Unix Semantics: every operation on file is instantly to all processes
- Session Semantics: not visible util the file is closed
- Immutable files: cannot update but append(create) or delete
- Transactions: all change is atomic
3.4.2 File Locking:
Lock manager for stateless
3.4.3 Sharing Files in Coda:
3.5 Consistency and Replication
3.5.1 Client-side caching
each client can have a memory cache that contains data previously read from the server
file data, attributes, file handles, directories
Open delegation:
- Server delegate the opening of file to a client that requiested write permission.
- Server must can do callback to the client, when another client on different machine needs to obtain access right to the file.
3.5.2 Server-side replication
less common: file shariing is relativly rare; often only reading data; high degree of replication may lead to R/W ratio.
Two clients with a different Accessible Volume Storage Group (AVSG) for the same replicated file.
Coda takes optimistic approach for partition, uses Coda Version Vector (CVV) to resolve.
3.5.3 Replication in Peer-to-peer System
3.6 Fault Tolerance
3.6.1 Byzantine Failure
Client builds a quorum certificate from at least 2K replies from 3K others, with total order: (operation, view, number) of request
3.6.2 Fault Tolerance
Assumption: nodes fail independently with probability p
Replication (r extra copies) – can survive r failures:
Prob(accessible) = 1 - p^(r+1)
Storage increase = r+1 times more storage
Erasure Correction Coding (n,m) – can survive r=n-m failures:
Σ pn-i (1-p)i
Storage increase = n/m times more storage
3.7 Security
3.7.1 In NFS: RPC server stub(secure RPC)
2 HDFS
1 Basic Feature:
- 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
2 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.
3 Data Characterics
- 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.
4. Architecture
4.1 Summary:
- 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.
4.2 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.
4.3 Name Node
- 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 File System Image 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.
4.4 Data Node
- 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:
- When the filesystem starts up it generates a list of all HDFS blocks and send this report to Namenode: Blockreport.
4.5 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.
4.6 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.
4.7 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.
4.8 Robustness
4.8.1 Objectives
- Primary objective of HDFS is to store data reliably in the presence of failures.
- Three common failures are:
- Namenode failure
- Datanode failure
- Network partition
4.8.2 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.
4.8.3 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.
4.8.4 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.
3 GFS
1 Assumption of GFS Design
- Inexpensive components that often fail
- Large files
- Large streaming reads and small random reads
- Large sequential writes
- Multiple users append to the same file
- High bandwidth is more important than low latency.
2 Architecture
2.1 Chunks
File -> chunks -> location of chunks (replicas)
2.2 Master server
- Single master
- Keep metadata
- accept requests on metadata
- Most management activities
Simplify design
Single point-of-failure
Limited number of files
Meta data kept in memory
Metadata:
Metadata is stored in memory
Namespaces
Directory -> physical location
Files -> chunks -> chunk locations
Chunk locations
Not stored by master, sent by chunk servers
Operation log
Master Operation:
All namespace operations
Name lookup
Create/remove directories/files, etc
Manage chunk replicas
Placement decision
Create new chunks & replicas
Balance load across all chunkservers
Garbage claim
Rebalancing
Redistribute replicas periodically
Better disk utilization
Load balancing
2.3 Chunk servers
Multiple
Keep chunks of data
Accept requests on chunk data
Large chunk size: e.g., 64M
Advantages
Reduce client-master traffic
Reduce network overhead – less network interactions
Chunk index is smaller
Disadvantages
Not favor small files
hot spots
2.4 Fault Tolerance
High availability
Fast recovery
Chunk replication
Master replication: inactive backup
Data integrity
Checksumming
Incremental update checksum to improve performance
A chunk is split into 64K-byte blocks
Update checksum after adding a block