Distributed File System

Slides:



Advertisements
Similar presentations
Serverless Network File Systems. Network File Systems Allow sharing among independent file systems in a transparent manner Mounting a remote directory.
Advertisements

From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 12: Distributed.
CS6223: Distributed Systems Distributed File Systems.
CS-550: Distributed File Systems [SiS]1 Resource Management in Distributed Systems: Distributed File Systems.
Distributed File Systems
Slides for Chapter 8: Distributed File Systems
Other File Systems: LFS and NFS. 2 Log-Structured File Systems The trend: CPUs are faster, RAM & caches are bigger –So, a lot of reads do not require.
1 Reliable Distributed Systems Stateless and Stateful Client- Server Systems.
NFS. The Sun Network File System (NFS) An implementation and a specification of a software system for accessing remote files across LANs. The implementation.
DESIGN AND IMPLEMENTATION OF THE SUN NETWORK FILESYSTEM R. Sandberg, D. Goldberg S. Kleinman, D. Walsh, R. Lyon Sun Microsystems.
Distributed File Systems Concepts & Overview. Goals and Criteria Goal: present to a user a coherent, efficient, and manageable system for long-term data.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Distributed File Systems Steve Ko Computer Sciences and Engineering University at Buffalo.
1 The Google File System Reporter: You-Wei Zhang.
Networked File System CS Introduction to Operating Systems.
Distributed Systems. Interprocess Communication (IPC) Processes are either independent or cooperating – Threads provide a gray area – Cooperating processes.
Distributed File Systems
Distributed system Distributed File System Nguyen Huu Tuong Vinh Huynh Thi Thu Thuy Dang Trang Tri.
What is a Distributed File System?? Allows transparent access to remote files over a network. Examples: Network File System (NFS) by Sun Microsystems.
1 Chap8 Distributed File Systems  Background knowledge  8.1Introduction –8.1.1 Characteristics of File systems –8.1.2 Distributed file system requirements.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Exercises for Chapter 12: Distributed.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers Distribuerede.
DISTRIBUTED FILE SYSTEMS Pages - all 1. Topics  Introduction  File Service Architecture  DFS: Case Studies  Case Study: Sun NFS  Case Study: The.
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
Lecture 27-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) December 3, 2013 Lecture 27 Distributed File Systems.
DISTRIBUTED FILE SYSTEM 1 DISTRIBUTED FILE SYSTEMS.
Lecture 27-1 Lecture 28-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2012 Indranil Gupta (Indy) December 6, 2012 Lecture.
GLOBAL EDGE SOFTWERE LTD1 R EMOTE F ILE S HARING - Ardhanareesh Aradhyamath.
1 Reliable Distributed Systems Stateless and Stateful Client- Server Systems.
COT 4600 Operating Systems Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:00-4:00 PM.
1 Distribuerede systemer og sikkerhed – 4. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley.
Distributed File Systems Group A5 Amit Sharma Dhaval Sanghvi Ali Abbas.
Distributed File Systems Questions answered in this lecture: Why are distributed file systems useful? What is difficult about distributed file systems?
Distributed Systems Coulouris 5’th Ed Distributed Systems Distributed File Systems Understand a Generic Distributed File System Understand.
Distributed File System. Outline Basic Concepts Current project Hadoop Distributed File System Future work Reference.
Chapter Five Distributed file systems. 2 Contents Distributed file system design Distributed file system implementation Trends in distributed file systems.
DISTRIBUTED FILE SYSTEM- ENHANCEMENT AND FURTHER DEVELOPMENT BY:- PALLAWI(10BIT0033)
1 Reliable Distributed Systems Stateless and Stateful Client- Server Systems Based on K. Birman’s of Cornell, Dusseu’s of Wisconsin.
Chapter 12: File System Implementation
Distributed Systems Course Distributed File Systems
Distributed File Systems (DFS)
Lecture 25: Distributed File Systems
File System Implementation
Lecture 25: Distributed File Systems
NFS and AFS Adapted from slides by Ed Lazowska, Hank Levy, Andrea and Remzi Arpaci-Dussea, Michael Swift.
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Slides for Chapter 8: Distributed File Systems
Distributed File Systems
Multiple Processor Systems
Distributed File Systems
CSE 451: Operating Systems Winter Module 22 Distributed File Systems
Distributed File Systems
Distributed File Systems
Distributed Systems Course Distributed File Systems
Exercises for Chapter 8: Distributed File Systems
CSE 451: Operating Systems Spring Module 21 Distributed File Systems
DESIGN AND IMPLEMENTATION OF THE SUN NETWORK FILESYSTEM
Distributed File Systems
Lecture 25: Distributed File Systems
Distributed file system
Distributed File Systems
Multiple Processor and Distributed Systems
CSE 451: Operating Systems Winter Module 22 Distributed File Systems
Chapter 15: File System Internals
Today: Distributed File Systems
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Distributed File Systems
Distributed File Systems
Lecture 4: File-System Interface
Distributed File Systems
Introduction to Operating Systems
Presentation transcript:

Distributed File System Chapter 12 Slides based on Coulouris Instructor material, Bina’s notes; Client/server material based on K.Birman’s of Cornell, Dusseu’s of Wisconsin

Storage Models Manual file system – paper ledgers Centralized file system Distributed file system Decentralized file system CSE4/587 B. Ramamurthy 2/5/2019

Computing Evolution Single-core Multi-core Cluster Grid of clusters Data size: small Single-core, single processor Single-core, multi-processor Single-core Multi-core, single processor Multi-core, multi-processor Multi-core Cluster of processors (single or multi-core) with shared memory Cluster of processors with distributed memory Cluster Grid of clusters Embarrassingly parallel processing MapReduce, distributed file system Cloud computing: google, box, aws S3 Pipelined Instruction level Concurrent Thread level Service Object level Indexed File level Mega Block level Virtual System Level Data size: large CSE4/587 B. Ramamurthy 2/5/2019

Traditional Storage Solutions Off system/online storage/ secondary memory File system abstraction/ Databases Offline/ tertiary memory/ DFS RAID: Redundant Array of Inexpensive Disks NAS: Network Accessible Storage SAN: Storage area networks cse4/587 2/5/2019

What is a DFS? A DFS enables programs to store and access remote files /storage exactly as they do local ones. The performance and reliability of such access should be comparable to that for files stored locally. Recent advances in higher bandwidth connectivity of switched local networks and disk organization have lead high performance and highly scalable file systems. Functional requirements: open, close, read, write, access control, directory organization, .. Non-functional requirements: scalable, fault-tolerant, secure, cse4/587 2/5/2019

File system modules Best practice #1: When designing systems think in terms of modules of functionality. Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012

File attribute record structure File length Creation timestamp Read timestamp Write timestamp Attribute timestamp Reference count Owner File type Access control list Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012

UNIX file system operations filedes = open(name, mode) filedes = creat(name, mode) Opens an existing file with the given name. Creates a new file with the given name. Both operations deliver a file descriptor referencing the open file. The mode is read, write or both. status = close(filedes) Closes the open file filedes. count = read(filedes, buffer, n) count = write(filedes, buffer, n) Transfers n bytes from the file referenced by filedes to buffer. Transfers n bytes to the file referenced by filedes from buffer. Both operations deliver the number of bytes actually transferred and advance the read-write pointer. pos = lseek(filedes, offset, whence) Moves the read-write pointer to offset (relative or absolute, depending on whence). status = unlink(name) Removes the file name from the directory structure. If the file has no other names, it is deleted. status = link(name1, name2) Adds a new name (name2) for a file (name1). status = stat(name, buffer) Gets the file attributes for file name into buffer.

Distributed File System Requirements Many of the requirements of distributed services were lessons learned from distributed file service. First needs were: access transparency and location transparency. Later on, performance, scalability, concurrency control, fault tolerance and security requirements emerged and were met in the later phases of DFS development. Distributed file system is implemented using client/server model.

Transparency Access transparency: Client programs should be unaware of the distribution of files. Location transparency: Client program should see a uniform namespace. Files should be able to be relocated without changing their path name. Symbolic links Cygwin is an example of unix like interface to Windows; it uses symbolic links extensively. castor> ln -s dir link castor> ls link file1 file2 file3 file4 castor> ls -l link lrwxrwxrwx 1 user 7 Jan 11 23:27 link -> dir .

Transparency Mobility transparency: Neither client programs nor system admin program tables in the client nodes should be changed when files are moved either automatically or by the system admin. Performance transparency: Client programs should continue to perform well on load within a specified range. Scaling transparency: increase in size of storage and network size should be transparent

Other Requirements Concurrent file updates is protected (record locking). File replication to allow performance. Hardware and operating system heterogeneity. Fault tolerance Consistency : Unix uses on-copy update semantics. This may be difficult to achieve in DFS. Security Efficiency

General File Service Architecture The responsibilities of a DFS are typically distributed among three modules: Client module which emulates the conventional file system interface Server modules(2) which perform operations for clients on directories and on files. Most importantly this architecture enables stateless implementation of the server modules. Our approach to design of distributed system: architecture, API, protocols, implementation

File service architecture model Client computer Server computer Application program Client module Flat file service Directory service Best Practice#2: An architecture model.. To discuss your design; clearly articulates the client/server aspect.

Flat file service Interface Read(FileId, i, n) -> Data — throws BadPosition If 1 ≤ i ≤ Length(File): Reads a sequence of up to n items from a file starting at item i and returns it in Data. Write(FileId, i, Data) If 1 ≤ i ≤ Length(File)+1: Writes a sequence of Data to a file, starting at item i, extending the file if necessary. Create() -> FileId Creates a new file of length 0 and delivers a UFID for it. Delete(FileId) Removes the file from the file store. GetAttributes(FileId) -> Attr Returns the file attributes for the file. SetAttributes(FileId, Attr) Sets the file attributes (only those attributes that are not shaded in ). Primary operations are reading and writing. What’s missing? How about Open and Close?

Directory service Interface Lookup(Dir, Name) -> FileId — throws NotFound Locates the text name in the directory and returns the relevant UFID. If Name is not in the directory, throws an exception. AddName(Dir, Name, File) NameDuplicate If Name is not in the directory, adds (Name, File) to the directory and updates the file’s attribute record. If Name is already in the directory: throws an exception. UnName(Dir, Name) If Name is in the directory: the entry containing Name is removed from the directory. If Name is not in the directory: throws an exception. GetNames(Dir, Pattern) -> NameSeq Returns all the text names in the directory that match the regular expression Pattern. Primary purpose is to provide a service for translation text names to UFIDs.

Network File System The Network File System (NFS) was developed to allow machines to mount a disk partition on a remote machine as if it were on a local hard drive. This allows for fast, seamless sharing of files across a network.

NFS architecture UNIX kernel protocol Client computer Server computer system calls Local Remote UNIX file system NFS client server Application program Virtual file system Other file system Best Practice #3: Symmetry in design; you have a client as well as a server module for the VFS/DFS.

NFS server operations (simplified) – 1 lookup(dirfh, name) -> fh, attr Returns file handle and attributes for the file name in the directory dirfh. create(dirfh, name, attr) -> newfh, attr Creates a new file name in directory dirfh with attributes attr and returns the new file handle and attributes. remove(dirfh, name) status Removes file name from directory dirfh. getattr(fh) -> attr Returns file attributes of file fh. (Similar to the UNIX stat system call.) setattr(fh, attr) -> attr Sets the attributes (mode, user id, group id, size, access time and modify time of a file). Setting the size to 0 truncates the file. read(fh, offset, count) -> attr, data Returns up to count bytes of data from a file starting at offset. Also returns the latest attributes of the file. write(fh, offset, count, data) -> attr Writes count bytes of data to a file starting at offset. Returns the attributes of the file after the write has taken place. rename(dirfh, name, todirfh, toname) -> status Changes the name of file name in directory dirfh to toname in directory to todirfh . link(newdirfh, newname, dirfh, name) Creates an entry newname in the directory newdirfh which refers to file name in the directory dirfh. Continues on next slide ...

NFS server operations (simplified) – 2 symlink(newdirfh, newname, string) -> status Creates an entry newname in the directory newdirfh of type symbolic link with the value string. The server does not interpret the string but makes a symbolic link file to hold it. readlink(fh) -> string Returns the string that is associated with the symbolic link file identified by fh. mkdir(dirfh, name, attr) -> newfh, attr Creates a new directory name with attributes attr and returns the new file handle and attributes. rmdir(dirfh, name) -> status Removes the empty directory name from the parent directory dirfh. Fails if the directory is not empty. readdir(dirfh, cookie, count) -> entries Returns up to count bytes of directory entries from the directory dirfh. Each entry contains a file name, a file handle, and an opaque pointer to the next directory entry, called a cookie. The cookie is used in subsequent readdir calls to start reading from the following entry. If the value of cookie is 0, reads from the first entry in the directory. statfs(fh) -> fsstats Returns file system information (such as block size, number of free blocks and so on) for the file system containing a file fh.

NFS Overview Remote Procedure Calls (RPC) for communication between client and server Client Implementation Provides transparent access to NFS file system UNIX contains Virtual File system layer (VFS) Vnode: interface for procedures on an individual file Translates vnode operations to NFS RPCs Server Implementation Stateless: Must not have anything only in memory Implication: All modified data written to stable storage before return control to client Servers often add NVRAM to improve performance Next slides Best Practice#4: Clearly define the functions with code examples/pseudo code

Mapping UNIX System Calls to NFS Operations Unix system call: fd = open(“/dir/foo”) Traverse pathname to get filehandle for foo dirfh = lookup(rootdirfh, “dir”); fh = lookup(dirfh, “foo”); Record mapping from fd file descriptor to fh NFS filehandle Set initial file offset to 0 for fd Return fd file descriptor Unix system call: read(fd,buffer,bytes) Get current file offset for fd Map fd to fh NFS filehandle Call data = read(fh, offset, bytes) and copy data into buffer Increment file offset by bytes Unix system call: close(fd) Free resources assocatiated with fd

Client-side Caching Caching needed to improve performance Reads: Check local cache before going to server Writes: Only periodically write-back data to server Avoid contacting server Avoid slow communication over network Server becomes scalability bottleneck with more clients Two client caches data blocks attributes (metadata) Best Practice#5: Use caching to help performance.

Cache Consistency Problem: Consistency across multiple copies (server and multiple clients) How to keep data consistent between client and server? If file is changed on server, will client see update? Determining factor: Read policy on clients How to keep data consistent across clients? If write file on client A and read on client B, will B see update? Determining factor: Write and read policy on clients

NFS Consistency: Reads Reads: How does client keep current with server state? Attribute cache: Used to determine when file changes File open: Client checks server to see if attributes have changed If haven’t checked in past T seconds (configurable, Ex: T=3) Discard entries every N seconds (configurable, Ex: N=60) Data cache Discard all blocks of file if attributes show file has been modified Eg: Client cache has file A’s attributes and blocks 1, 2, 3 Client opens A: Client reads block 1 Client waits 70 seconds Client reads block 2 Block 3 is changed on server Client reads block 3 Client reads block 4

NFS Consistency: Writes Writes: How does client update server? Files Write-back from client cache to server every 30 seconds Also, Flush on close() Directories Synchronously write to server Example: Client X and Y have file A (blocks 1,2,3) cached Clients X and Y open file A Client X writes to blocks 1 and 2 Client Y reads block 1 30 seconds later... Client Y reads block 2 40 seconds later...

NFS Architecture Allows an arbitrary collection of clients and servers to share a common file system. In many cases all servers and clients are on the same LAN but this is not required. NFS allows every machine to be a client and server at the same time. Each NFS server exports one or more directories for access by remote clients.

NFS Protocol One of the goals of NFS is to support a heterogeneous system, with clients and servers running different operating systems on different hardware. It is essential the interface between clients and server be well defined. NFS accomplishes this goal by defining two client-server protocol: one for handling mounting and another for directory and file access. Protocol defines requests by clients and responses by servers. Best practice #6: After architecture model define a protocol or collection of general rules for operation.

Local and remote file systems accessible on an NFS client Note: The file system mounted at /usr/students in the client is actually the sub-tree located at /export/people in Server 1; the file system mounted at /usr/staff in the client is actually the sub-tree located at /nfs/users in Server 2. Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012

Mounting Client requests a directory structure to be mounted, if the path is legal the server returns file handle to the client. Or the mounting can be automatic by placing the directories to mounted in the /etc/rc: automounting.

File Access NFS supports most unix operations except open and close. This is to satisfy the “statelessness” on the server end. Server need not keep a list of open connections. (On the other hand consider your database connection… you create an object, connection is opened etc.)

Implementation After the usual system call layer, NFS specific layer Virtual File System (VFS) maintains an entry per file called vnode (virtual I-node) for every open file. Vnode indicate whether a file is local or remote. For remote files extra info is provided. For local file, file system and I-node are specified. Lets see how to use v-nodes using a mount, open, read system calls from a client application.

Vnode use To mount a remote file system, the sys admin (or /etc/rc) calls the mount program specifying the remote directory, local directory in which to be mounted, and other info. If the remote directory exist and is available for mounting, mount system call is made. Kernel constructs vnode for the remote directory and asks the NFS-client code to create a r-node (remote I-node) in its internal tables. V-node in the client VFS will point to local I-node or this r-node.

Remote File Access When a remote file is opened by the client, it locates the r-node. It then asks NFS Client to open the file. NFS file looks up the path in the remote file system and return the file handle to VFS tables. The caller (application) is given a file descriptor for the remote file. No table entries are made on the server side. Subsequent reads will invoke the remote file, and for efficiency sake the transfers are usually in large chunks (8K).

Server Side of File Access When the request message arrives at the NFS server, it is passed to the VFS layer where the file is probably identified to be a local or remote file. Usually a 8K chunk is returned. Read ahead and caching are used to improve efficiency. Cache: server side for disk accesses, client side for I-nodes and another for file data. Of course this leads to cache consistency and security problem which ties us into other topics we are discussing.

Summary Distributed file systems NFS: Popular distributed file system Important for data sharing Challenges: Fault tolerance, scalable performance, and consistency NFS: Popular distributed file system Key features: Stateless server, idempotent operations: Simplifies fault tolerance Crashed server appears as slow server to clients Client caches needed for scalable performance Rules for invalidating cache entries and flushing data to server are not straight-forward Data consistency very hard to reason about Pay attention to best practices when designing systems. We discussed at least 6 general best practices that you could use in your design of projects.