Skip to main content

DFS; stateless vs stateful services

Short answer

A distributed file system provides transparent, shared access to files across a network. Stateful servers maintain client session state like open files and file pointers, using short requests but complex crash recovery; stateless servers store no client information, each request carries full context, making recovery simple but requiring idempotent operations.

Define Distributed file system. Point out the differences between stateless and stateful services.

Distributed file system

A distributed file system (DFS) keeps files on one or more servers and gives clients on a network access to them as if they were local, with a common name space, transparency, sharing, security and consistency (for example NFS, AFS).

Stateless versus stateful services

PointStateful serviceStateless service
Server memoryKeeps information about each client (open files, file pointers)Keeps no client information
RequestShort; refers to a session or open file idLonger; each carries file id, offset, count
Crash recoveryComplex; server must rebuild or clients must re-establish stateSimple; just restart
Client crashServer must detect and clean orphaned stateNo effect
OperationsNeed not be idempotentMust be idempotent (repeatable)
PerformanceFewer disk accesses, read-ahead is easierMore overhead per request
LockingEasy to supportNeeds a separate lock service
ExampleAFS (callbacks), RFSNFS (v2, v3)

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 2 questions →