Caching in Distributed File System: Ke Wang CS614 - Advanced System Apr 24, 2001
Caching in Distributed File System: Ke Wang CS614 - Advanced System Apr 24, 2001
in
Distributed File System
Ke Wang
CS614 – Advanced System
Apr 24, 2001
Key requirements of distributed system
Scalability from small to large networks
Fast and transparent access to geographically
Distributed File System(DFS)
Information protection
Ease of administration
Wide support from variety of vendors
Background
DFS -- a distributed implementation of a file
system, where multiple users share files and
storage resources.
Overall storage space managed by a DFS is
composed of different, remotely located,
smaller storage spaces
There is usually a correspondence between
constituent storage spaces and sets of files
DFS Structure
Service - a software entity providing a
particular type of function to client
Server - service software running on a single
machine
Client - process that can invoke a service
using a set of operations that forms its client
interface
Why caching?
Retaining most recently accessed disk blocks.
Repeated accesses to a block in cache can be
handled without involving the disk.
Advantages
- Reduce delays
- Reduce contention for disk arm
Caching in DFS
Advantages
Reduce network traffic
Reduce server contention
Problems
Cache-consistency
Stuff to consider
Cache location (disk vs. memory)
Cache Placement (client vs. server)
Cache structure (block vs. file)
Stateful vs. Stateless server
Cache update policies
Consistency
Client-driven vs. Server-driven protocols
Practical Distributed System
NFS: Sun’s Network File System
AFS: Andrew File System (CMU)
Sprite FS: File System for the Sprite OS
( UC Berkeley)
Sun’s Network File System(NFS)
Sun’s Network File System(NFS)
Originally released in 1985
Build on top of an unreliable datagram
protocol UDP (change to TCP now)
Client-server model
Andrew File System(AFS)
Developed at CMU since 1983
Client-server model
Key software: Vice and Venus
Goal: high scalability (5,000-10,000
nodes)
Andrew File System(AFS)
Andrew File System(AFS)
VICE is a multi-threaded server process with
each thread handling a single client request
Higher scalability!
Sprite File System
Designed for networked workstation
with large physical memories
(can be diskless)
Expect memory of 100-500Mbytes
Goal: high performance
Caches in Sprite FS
Caches in Sprite FS(cont)
When a process makes a file access, it is
presented first to the cache(file traffic). If not
satisfied, request is passed either to a local
disk, if the file is stored locally(disk traffic), or
to the server where the file is stored(server
traffic). Servers also maintain caches to
reduce disk traffic.
Caching in Sprite FS
Two unusual aspects
Guarantee complete consistent view
More Reliable
Cached data are still there during recovery
and don’t need to be fetched again
Cache Location
Disk vs. Main Memory(cont)
Advantages of main-memory caches:
Permit workstations to be diskless
More quick access
Server caches(used to speed up disk I/O)
are always in main memory; using main-
memory caches on the clients permits a
single caching mechanism for servers and
users
Cache Placement
Client vs. Server
Client cache reduce network traffic
Read-only operations on unchanged files
do not need go over the network
Server cache reduce server load
Cache is amortized across all clients ( but
needs to be bigger to be effective)
In practice, need BOTH!
Cache structure
Block basis
Simple
Sprite FS, NFS
File basis
Reduce interaction with servers
AFS
Cannot access files larger than cache
Compare
NFS: client memory(disk), block basis
AFS: client disk, file basis
Sprint FS: client memory, server
memory, block basis
Stateful vs. Stateless Server
Stateful – Servers hold information
about the client
failures
Stateless Server
Each request must be 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
Stateless Server(cont)
Advantage
A file server crash does not affect clients
Simple
Disadvantage
Impossible to enforce consistency
RPC needs to contain all state, longer
Stateful vs. Stateless
AFS and Sprite FS are stateful
Sprite FS servers keep track of which
clients have which files open
AFS servers keep track of the contents of
client’s caches
NFS is stateless
Cache Update Policy
Write-through
Delayed-write
server
Client-driven vs. Server-driven
AFS is server-driven (callback)
Contributes to AFS’s scalability
Whole file caching and session semantics
also help
NFS and Sprite are client-driven
Increased load on network and server
AFS:Effect on scalability
Sprite:Dynamic cache size
Make client cache as large as possible
Virtual memory and file system
negotiate
Compare age of oldest page
Two problems
Double caching
Multiblock pages
Why not callback in Sprite?
Why not callback in Sprite?
Estimated improvement is small
Reason
Andrew is user-level process
Sprite is kernel-level implementation
Comparison
Performance – running time
Performance – running time
Use Andrew benchmark
Sprite system is fastest
Kernel-to-kernel PRC
Delayed write
Kernel implementation (AFS is user-level)
Performance – CPU utilization
Performance – CPU utilization
Use Andrew benchmark
Andrew system showed greatest
scalability
File-based cache
Server-driven
Use of callback
Nomadic Caching
New issues
If client become disconnected?
Weakly connected(by modem)?