Distributed File Systems
Definition: distributed file system (DFS) - a distributed implementation of the time-sharing model of a file system wherein multiple users share files and storage resources.
- A DFS manages a set of dispersed storage devices
- The overall storage space is composed of heterogeneous, remotely located, smaller storage spaces.
- There is usually a correspondence between constituent storage spaces and sets of files.
Distributed System Organizational Scheme
- Service - a software entity running on one or more machines.
A service provides a particular type of function to a set of possibly unknown clients.
- Server - service software running on a single machine.
- Client - a process that can invoke a service using a set of operations that forms its client interface.
[A client interface for a file service is formed by a set of primitive file operations (create, delete, read, write).]
[A client interface of a DFS should be transparent, i.e., it should not distinguish between local and remote files.]
Distributed File System Requirements
Sharing files across nodes (processes, CPUs, computers, networks) requires or benefits from certain attributes of the system.
Some attributes which are required or may be used as utility metrics for a DFS:
- naming
- transparency (works hand-in-hand with naming)
- concurrency (including synchronization)
- replication (caching, with consistency checks)
- platform independence (heterogeneity)
- fault tolerance
- consistency
- security
- efficiency
Naming
- Definition: naming - mapping between logical and physical objects.
- Definition: multilevel mapping - the abstraction of a file that hides the details of how and where on the disk the file is actually stored.
- A transparent DFS hides the location wherein the network the file is stored.
- For a file being replicated in several sites, the mapping returns a set of the locations of this file's replicas.
Both the existence of multiple copies and their location is hidden from the application.
Definition: location transparency - a file's name does not reveal the file's physical storage location.
- A file name still denotes a specific, although hidden, set of physical disk blocks.
- Loc. trans. is a convenient way to share data.
- It can expose correspondence between component units and machines.
Naming Schemes
Three Main Approaches
- Files are named by a combination of their hostname and local name; guarantees a unique system-wide name.
- Attach remote directories to local directories, giving the appearance of a coherent directory tree; only previously mounted remote directories can be accessed transparently
- Total integration of the 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.
Architecture
A DFS typically is built from architecture with components similar to the following:
- flat file service (unique file identifiers)
- directory service (mapping between text names and UFIDs)
- client modules (e.g., NFS clients)
- access control
Remote File Access
To reduce network traffic, remote access retains recently accessed disk blocks in a cache, so that repeated accesses to the same information can be handled locally.
- If needed data not already cached, a copy of data is brought from the server to the user.
- Accesses are performed on the cached copy.
- Files identified with one master copy residing at the server machine, but copies of (parts of) the file are scattered in different caches.
- Cache-consistency problem - keeping the cached copies consistent with the master file.
Location - Disk Caches vs. Main Memory Cache
- Advantages of disk caches
- More reliable.
- Cached data kept on disk are still there during recovery and don't need to be fetched again.
- Advantages of main-memory caches:
- Permit workstations to be diskless.
- Data can be accessed more quickly.
- Performance speedup in bigger memories.
- Server caches (used to speed up disk I/O) are in main memory regardless of where user caches are located;
using main-memory caches on the user machine permits a single caching mechanism for servers and users.
Cache Update Policy
- Write-through - write data through to disk as soon as they are placed on any cache. Reliable, but poor performance.
- Delayed-write - modifications written to the cache and then written through to the server later. Write accesses complete quickly; some data may be overwritten before they are written back, and so need never be written at all.
- Poor reliability; unwritten data will be lost whenever a user machine crashes.
- One variation is to scan cache at regular intervals and flush blocks that have been modified since the last scan.
- Another variation is ``write-on-close'', wherein data are written back to the server when the file is closed. It might be fastest for unshared files that are open for long periods and frequently modified.
Consistency
Cache consistency is a concern for all types of caching scenarios. This includes processor cache, application cache (e.g., browsers), and distributed data caches.
- Is the locally cached copy of the data consistent with the master copy?
- Client-initiated approach
- The client initiates a validity check.
- The server checks whether the local data are consistent with the master copy.
- Server-initiated approach
- Server records, for each client, the (parts of) files it caches.
- When a server detects a potential inconsistency, it reacts.
Comparing Caching and Remote Service
- In caching, many remote accesses handled efficiently by the local cache; most remote accesses will be served as fast as local ones.
- Servers are contacted only occasionally in caching (rather than for each access).
- Reduces server load and network traffic.
- Enhances potential for scalability.
- Remote server method handles every remote access across the network; penalty in network traffic, server load, and performance.
- Total network overhead in transmitting big chunks of data (caching) is lower than a series of responses to specific requests (remote-service).
- Caching is superior in access patterns with infrequent writes. With frequent writes, substantial overhead incurred to overcome the cache-consistency problem.
- Benefit from caching when execution carried out on machines with either local disks or large main memories.
- Remote access on diskless, small-memory-capacity machines should be done through the remote-service method.
- In caching, the lower (low-level) inter-machine interface is different from the upper (high-level) user interface.
- In remote-service, the inter-machine interface mirrors the local user-file-system interface.
State full File Service
- Mechanism
- The client opens a file.
- The server fetches information about the file from its disk, stores it in its memory, and gives the client a connection identifier unique to the client and the open file.
- The identifier is used for subsequent accesses until the session ends.
- The server must reclaim the main-memory space used by clients who are no longer active.
- Increased performance.
- Fewer disk accesses.
- State full server knows if a file was opened for sequential access and can thus read ahead of the next blocks.
Stateless File Server
- Avoids state information 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.
Distinctions between State full & Stateless Service
- Failure of Recovery.
- A state full server loses all its volatile state in a crash.
- Restore state by recovery protocol based on a dialog with clients, or abort operations that were underway when the crash occurred.
- The server needs to be aware of client failures in order to reclaim the space allocated to record the state of crashed client processes (orphan detection and elimination).
- With a stateless server, the effects of server failure and recovery are almost unnoticeable. A newly reincarnated server can respond to a self-contained request without any difficulty.
- Penalties for using the robust stateless service:
- longer request messages
- slower request processing
- additional constraints imposed on DFS design
- Some environments require state full service.
- A server employing server-initiated cache validation cannot provide stateless service since it maintains a record of which files are cached by which clients.
- UNIX use of file descr iptors and implicit offsets is inherently state full; servers must maintain tables to map the file descr iptors to inodes, and store the current offset within a file.
File Replication
- Replicas of the same file reside on failure-independent machines.
- Improves availability and can shorten the service time.
- The naming scheme maps a replicated file name to a particular replica.
- The 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, and thus update to any replica must be reflected on all other replicas.
- Demand replication - reading a nonlocal replica causes it to be cached locally, thereby generating a new no primary replica.
Example - Sun Network File System (NFS) [Sun 1985; standardized and released into public domain]
- Implementation and a specification of a software system for accessing remote files across LANs (or WANs).
- The implementation is part of the SunOS operating system (a version of 4.2BSD UNIX), using an unreliable datagram protocol (UDP/IP protocol) and Ethernet.
- Implemented using RPC.
- Interconnected workstations viewed as a set of independent machines with independent file systems, which allows sharing among these file systems in a transparent manner.
A remote directory is mounted over a local file system directory. The mounted directory looks like an integral subtree of the local file system, replacing the subtree descending from the local directory.
Specification of the remote directory for the mount operation is nontransparent; the hostname of the remote directory has to be provided. Files in the remote directory can then be accessed in a transparent manner.
Subject to access-rights accreditation, potentially any file system (or directory within a file system), can be mounted remotely on top of any local directory.
- NFS is designed to operate in a heterogeneous environment of different machines, operating systems, and network architectures; the NFS specifications are independent of these media.
- This independence is achieved through the use of RPC primitives built on top of an External Data Representation (XDR) protocol used between two implementation-independent interfaces.
- The NFS specification distinguishes between the services provided by the amount mechanism and the actual remote-file access services.
NFS Protocol
- Provides a set of remote procedure calls for remote file operations. The procedures support the following operations:
- searching for a file within a directory
- reading a set of directory entries
- manipulating links and directories
- accessing file attributes
- reading and writing files
- NFS servers are stateless; each request has to provide a full set of arguments.
- Modified data must be committed to the server's disk before results are returned to the client (thus losing advantages of caching).
- The NFS protocol does not provide concurrency-control mechanisms.
NFS Remote Operations
- A nearly one-to-one correspondence between regular UNIX system calls and the NFS protocol RPCs (except opening and closing files).
- NFS adheres to the remote-service paradigm but employs buffering and caching techniques for the sake of performance.
- File-blocks cache: when a file is opened, the kernel checks with the remote server whether to fetch or revalidate the cached attributes. Cached file blocks are used only if the corresponding cached attributes are up to date.
- File-attribute cache: the attribute cache is updated whenever new attributes arrive from the server.
- Clients do not free delayed-write blocks until the server confirms that the data have been written to disk.