Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributed File SystemsCS-4513 D-term 20081 Distributed File Systems (and related topics) CS-4513 Distributed Computing Systems (Slides include materials.

Similar presentations


Presentation on theme: "Distributed File SystemsCS-4513 D-term 20081 Distributed File Systems (and related topics) CS-4513 Distributed Computing Systems (Slides include materials."— Presentation transcript:

1 Distributed File SystemsCS-4513 D-term 20081 Distributed File Systems (and related topics) CS-4513 Distributed Computing Systems (Slides include materials from Operating System Concepts, 7 th ed., by Silbershatz, Galvin, & Gagne, Distributed Systems: Principles & Paradigms, 2 nd ed. By Tanenbaum and Van Steen, and Modern Operating Systems, 2 nd ed., by Tanenbaum)

2 Distributed File SystemsCS-4513 D-term 20082 Distributed Files Systems (DFS) A special case of distributed system Allows multi-computer systems to share files –Even when no other IPC or RPC is needed Sharing devices –Special case of sharing files E.g., –NFS (Sun’s Network File System) –Windows NT, 2000, XP –Andrew File System (AFS) & others …

3 Distributed File SystemsCS-4513 D-term 20083 Distributed File Systems (continued) One of most common uses of distributed computing Goal: provide common view of centralized file system, but distributed implementation. –Ability to open & update any file on any machine on network –All of synchronization issues and capabilities of shared local files

4 Distributed File SystemsCS-4513 D-term 20084 Naming of Distributed Files Naming – mapping between logical and physical objects. A transparent DFS hides the location where in the network the file is stored. Location transparency – file name does not reveal the file’s physical storage location. –File name denotes a specific, hidden, set of physical disk blocks. –Convenient way to share data. –Could expose correspondence between component units and machines. Location independence – file name does not need to be changed when the file’s physical storage location changes. –Better file abstraction. –Promotes sharing the storage space itself. –Separates the naming hierarchy from the storage-devices hierarchy.

5 Distributed File SystemsCS-4513 D-term 20085 DFS – Three Naming Schemes 1.Mount remote directories to local directories, giving the appearance of a coherent local directory tree Mounted remote directories can be accessed transparently. Unix/Linux with NFS; Windows with mapped drives 2.Files named by combination of host name and local name; Guarantees a unique system-wide name Windows Network Places, Apollo Domain 3.Total integration of component file systems. A single global name structure spans all the files in the system. If a server is unavailable, some arbitrary set of directories on different machines also becomes unavailable.

6 Distributed File SystemsCS-4513 D-term 20086 Mounting Remote Directories (NFS)

7 Distributed File SystemsCS-4513 D-term 20087 Mounting Remote Directories (continued) Note:– names of files are not unique As represented by path names E.g., Server sees : /users/steen/mbox Client A sees: /remote/vu/mbox Client B sees: /work/me/mbox Consequence:– Cannot pass file “names” around haphazardly

8 Distributed File SystemsCS-4513 D-term 20088 Mounting Remote Directories in NFS More later …

9 Distributed File SystemsCS-4513 D-term 20089 DFS – File Access Performance Reduce network traffic by retaining recently accessed disk blocks in local cache Repeated accesses to the same information can be handled locally. –All accesses are performed on the cached copy. If needed data not already cached, copy of data brought from the server to the local cache. –Copies of parts of file may be scattered in different caches. Cache-consistency problem – keeping the cached copies consistent with the master file. –Especially on write operations

10 Distributed File SystemsCS-4513 D-term 200810 DFS – File Caches In client memory –Performance speed up; faster access –Good when local usage is transient –Enables diskless workstations On client disk –Good when local usage dominates (e.g., AFS) –Caches larger files –Helps protect clients from server crashes

11 Distributed File SystemsCS-4513 D-term 200811 DFS –Cache Update Policies When does the client update the master file? –I.e. when is cached data written from the cache to the file? Write-through – write data through to disk ASAP –I.e., following write() or put(), same as on local disks. –Reliable, but poor performance. Delayed-write – cache and then written to the server later. –Write operations complete quickly; some data may be overwritten in cache, saving needless network I/O. –Poor reliability unwritten data may be lost when client machine crashes Inconsistent data –Variation – scan cache at regular intervals and flush dirty blocks.

12 Distributed File SystemsCS-4513 D-term 200812 DFS – File Consistency Is locally cached copy of the data consistent with the master copy? Client-initiated approach –Client initiates a validity check with server. –Server verifies local data with the master copy E.g., time stamps, etc. Server-initiated approach –Server records (parts of) files cached in each client. –When server detects a potential inconsistency, it reacts

13 Distributed File SystemsCS-4513 D-term 200813 DFS – Remote Service vs. Caching Remote Service – all file actions implemented by server. –RPC functions –Use for small memory diskless machines –Particularly applicable if large amount of write activity Cached System –Many “remote” accesses handled efficiently by the local cache Most served as fast as local ones. –Servers contacted only occasionally Reduces server load and network traffic. Enhances potential for scalability. –Reduces total network overhead

14 Distributed File SystemsCS-4513 D-term 200814 State of Service and Client How much state does the service maintain about its clients Stateless Stateful

15 Distributed File SystemsCS-4513 D-term 200815 DFS – File Server Semantics Stateless Service –Avoids state information in server by making each request self-contained. –Each request identifies the file and position in the file. –No need to establish and terminate a connection by open and close operations. –Poor support for locking or synchronization among concurrent accesses

16 Distributed File SystemsCS-4513 D-term 200816 DFS – File Server Semantics (continued) Stateful Service –Client opens a file (as in Unix & Windows). –Server fetches information about file from disk, stores in server memory, Returns to client a connection identifier unique to client and open file. Identifier used for subsequent accesses until session ends. –Server must reclaim space used by no longer active clients. –Increased performance; fewer disk accesses. –Server retains knowledge about file E.g., read ahead next blocks for sequential access E.g., file locking for managing writes –Windows

17 Distributed File SystemsCS-4513 D-term 200817 DFS –Server Semantics Comparison Failure Recovery: Stateful server loses all volatile state in a crash. –Restore state by recovery protocol based on a dialog with clients. –Server needs to be aware of crashed client processes orphan detection and elimination. Failure Recovery: Stateless server failure and recovery are almost unnoticeable. –Newly restarted server responds to self-contained requests without difficulty.

18 Distributed File SystemsCS-4513 D-term 200818 DFS –Server Semantics Comparison (continued) … Penalties for using the robust stateless service: – –longer request messages –slower request processing Some environments require stateful service. –Server-initiated cache validation cannot provide stateless service. –File locking (one writer, many readers).

19 Distributed File SystemsCS-4513 D-term 200819 DFS – Replication Replicas of the same file reside on failure-independent machines. Improves availability and can shorten service time. Naming scheme maps a replicated file name to a particular replica. –Existence of replicas should be invisible to higher levels. –Replicas must be distinguished from one another by different lower-level names. Updates –Replicas of a file denote the same logical entity –Update to any replica must be reflected on all other replicas.

20 Distributed File SystemsCS-4513 D-term 200820 Example Distributed File Systems NFS – Sun’s Network File System (ver. 3) Tanenbaum & van Steen, Chapter 11 NFS – Sun’s Network File System (ver. 4) Tanenbaum & van Steen, Chapter 11 AFS – the Andrew File System See Silbershatz §17.6

21 Distributed File SystemsCS-4513 D-term 200821 NFS Sun Network File System (NFS) has become de facto standard for distributed UNIX file access. NFS runs over LAN –even WAN (slowly) Any system may be both a client and server Basic idea: –Remote directory is mounted onto local directory –Remote directory may contain mounted directories within

22 Distributed File SystemsCS-4513 D-term 200822 Mounting Remote Directories (NFS)

23 Distributed File SystemsCS-4513 D-term 200823 Nested Mounting (NFS)

24 Distributed File SystemsCS-4513 D-term 200824 NFS Implementation NFS

25 Distributed File SystemsCS-4513 D-term 200825 NFS Operations (RPC functions) Lookup –Fundamental NFS operation –Takes pathname, returns file handle File Handle –Unique identifier of file within server –Persistent; never reused –Storable, but opaque to client 64 bytes in NFS v3; 128 bytes in NFS v4 Most other operations take file handle as argument

26 Distributed File SystemsCS-4513 D-term 200826 Other NFS Operations (version 3) read, write link, symlink mknod, mkdir rename, rmdir readdir, readlink getattr, setattr create, remove Conspicuously absent –open, close

27 Distributed File SystemsCS-4513 D-term 200827 NFS v3 — A Stateless Service Server retains no knowledge of client Server crashes invisible to client All hard work done on client side Every operation provides file handle Server caching Performance only Based on recent usage Client caching Client checks validity of caches files Client responsible for writing out caches …

28 Distributed File SystemsCS-4513 D-term 200828 NFS v3 — A Stateless Service (continued) … No locking! No synchronization! Unix file semantics not guaranteed E.g., read after write Session semantics not even guaranteed E.g., open after close

29 Distributed File SystemsCS-4513 D-term 200829 NFS v3 — A Stateless Service (continued) Solution: global lock manager Separate from NFS Typical locking operations Lock – acquire lock (non-blocking) Lockt – test a lock Locku – unlock a lock Renew – renew lease on a lock

30 Distributed File SystemsCS-4513 D-term 200830 NFS Implementation Remote procedure calls for all operations –Implemented in Sun ONC –XDR is interface definition language Network communication is client-initiated –RPC based on UDP (non-reliable protocol) –Response to remote procedure call is de facto acknowledgement Lost requests are simply re-transmitted –As many times as necessary to get a response!

31 Distributed File SystemsCS-4513 D-term 200831 NFS – Caching On client open(), client asks server if its cached attribute blocks are up to date. Once file is open, different client processes can write it and get inconsistent data. Modified data is flushed back to the server every 30 seconds.

32 Distributed File SystemsCS-4513 D-term 200832 NFS Failure Recovery Server crashes are transparent to client Each client request contains all information Server can re-fetch from disk if not in its caches Client retransmits request if interrupted by crash –(i.e., no response) Client crashes are transparent to server Server maintains no record of which client(s) have cached files.

33 Distributed File SystemsCS-4513 D-term 200833 Summary NFS That was version 3 of NFS Stateless file system High performance, simple protocol Based on UDP Everything has changed in NFS version 4 First published in 2000 Clarifications published in 2003 Almost complete rewrite of NFS

34 Distributed File SystemsCS-4513 D-term 200834 NFS Version 4 Stateful file service Based on TCP – reliable transport protocol More ways to access server Compound requests I.e., multiple RPC calls in same packet More emphasis on security Mount protocol integrated with rest of NFS protocol

35 Distributed File SystemsCS-4513 D-term 200835 NFS Version 4

36 Distributed File SystemsCS-4513 D-term 200836 NFS Version 4 (continued) Additional RPC operations –Long list for managing files, caches, validating versions, etc. –Also security, permissions, etc. Also –Open() and close(). –With a server crash, some information may have to be recovered See –Silbershatz, p. 653 –http://www.tcpipguide.com/free/t_TCPIPNetworkFileSystemNFS. htmhttp://www.tcpipguide.com/free/t_TCPIPNetworkFileSystemNFS. htm

37 Distributed File SystemsCS-4513 D-term 200837 Questions?

38 Distributed File SystemsCS-4513 D-term 200838 Andrew File System (AFS) Completely different kind of file system Developed at CMU to support all student computing. Consists of workstation clients and dedicated file server machines.

39 Distributed File SystemsCS-4513 D-term 200839 Andrew File System (AFS) Stateful Single name space –File has the same names everywhere in the world. Lots of local file caching –On workstation disks –For long periods of time –Originally whole files, now 64K file chunks. Good for distant operation because of local disk caching

40 Distributed File SystemsCS-4513 D-term 200840 AFS Need for scaling led to reduction of client-server message traffic. –Once a file is cached, all operations are performed locally. –On close, if the file is modified, it is replaced on the server. The client assumes that its cache is up to date! Server knows about all cached copies of file –Callback messages from the server saying otherwise. …

41 Distributed File SystemsCS-4513 D-term 200841 AFS On file open() –If client has received a callback for file, it must fetch new copy –Otherwise it uses its locally-cached copy. Server crashes –Transparent to client if file is locally cached –Server must contact clients to find state of files See Silbershatz §17.6

42 Distributed File SystemsCS-4513 D-term 200842 Distributed File Systems — Summary Performance is always an issue –Tradeoff between performance and the semantics of file operations (especially for shared files). Caching of file blocks is crucial in any file system, distributed or otherwise. –As memories get larger, most read requests can be serviced out of file buffer cache (local memory). –Maintaining coherency of those caches is a crucial design issue. Current research addressing disconnected file operation for mobile computers.

43 Distributed File SystemsCS-4513 D-term 200843 Reading Assignment Silbershatz, Chapter 17 or Tanenbaum, Modern Operating Systems –§8.3 and §10.6.4 or Tanenbaum & van Steen, Chapter 11

44 Distributed File SystemsCS-4513 D-term 200844 Questions?

45 Distributed File SystemsCS-4513 D-term 200845 New Topic

46 Distributed File SystemsCS-4513 D-term 200846 Incomplete Operations Problem – how to protect against disk write operations that don’t finish –Power or CPU failure in the middle of a block –Related series of writes interrupted before all are completed Examples: –Database update of charge and credit –RAID 1, 4, 5 failure between redundant writes

47 Distributed File SystemsCS-4513 D-term 200847 Solution (part 1) – Stable Storage Write everything twice to separate disks Be sure 1 st write does not invalidate previous 2 nd copy RAID 1 is okay; RAID 4/5 not okay! Read blocks back to validate; then report completion Reading both copies If 1 st copy okay, use it – i.e., newest value If 2 nd copy different or bad, update it with 1 st copy If 1 st copy is bad; update it with 2 nd copy – i.e., old value

48 Distributed File SystemsCS-4513 D-term 200848 Stable Storage (continued) Crash recovery Scan disks, compare corresponding blocks If one is bad, replace with good one If both good but different, replace 2 nd with 1 st copy Result:– If 1 st block is good, it contains latest value If not, 2 nd block still contains previous value An abstraction of an atomic disk write of a single block Uninterruptible by power failure, etc.

49 Distributed File SystemsCS-4513 D-term 200849 What about more complex disk operations? E.g., File create operation involves Allocating free blocks Constructing and writing i-node –Possibly multiple i-node blocks Reading and updating directory Update Free list and store back onto disk What if system crashes with the sequence only partly completed? Answer: inconsistent data structures on disk

50 Distributed File SystemsCS-4513 D-term 200850 Solution (Part 2) – Log-Structured File System Make changes to cached copies in memory Collect together all changed blocks Including i-nodes and directory blocks Write to log file (aka journal file) A circular buffer on disk Fast, contiguous write Update log file pointer in stable storage Offline: Play back log file to actually update directories, i-nodes, free list, etc. Update playback pointer in stable storage

51 Distributed File SystemsCS-4513 D-term 200851 Transaction Data Base Systems Similar techniques –Every transaction is recorded in log before recording on disk –Stable storage techniques for managing log pointers –One log exist is confirmed, disk can be updated in place –After crash, replay log to redo disk operations

52 Distributed File SystemsCS-4513 D-term 200852 Journaling File Systems Linux ext3 file system Windows NTFS

53 Distributed File SystemsCS-4513 D-term 200853 Berkeley LFS — a slight variation Everything is written to log i-nodes point to updated blocks in log i-node cache in memory updated whenever i-node is written Cleaner daemon follows behind to compact log Advantages: –LFS is always consistent –LFS performance Much better than Unix file system for small writes At least as good for reads and large writes Tanenbaum, §6.3.8, pp. 428-430 Rosenblum & Ousterhout, Log-structured File System (pdf)Rosenblum & Ousterhout, Log-structured File System (pdf) Note: not same as Linux LFS (large file system)

54 Distributed File SystemsCS-4513 D-term 200854 Example i-node modified blocks a b c Before old i-node old blocks a b c log a b c new blocks new i-node After

55 Distributed File SystemsCS-4513 D-term 200855 Questions?


Download ppt "Distributed File SystemsCS-4513 D-term 20081 Distributed File Systems (and related topics) CS-4513 Distributed Computing Systems (Slides include materials."

Similar presentations


Ads by Google