- 2075 Bhadra · 10 marks
GFS master role in read/write
Short answer
The master stores metadata, returns chunk locations for reads, and grants leases to choose a primary for writes, while data flows directly from client to chunkservers and control messages go through the master and primary. Reads request location then contact the nearest replica.
What is the main role of GFS Master during read and write processes? How data and control messages flow in GFS architecture? Explain with suitable flow diagram.
Role of the GFS master
The master is the single metadata server and coordinator of the cluster. It does not carry file data, it only guides.
During read:
- Keeps the namespace and file-to-chunk mapping.
- Given file name and chunk index, returns the chunk handle and the locations of its replicas to the client.
During write / append:
- Decides which chunkserver holds the lease for the chunk and makes it the primary (lease normally 60 s, extendable).
- Returns the identity of the primary and secondary replicas to the client.
- Creates new chunks when needed, places replicas across racks and disks, and keeps chunk version numbers to detect stale replicas.
Other tasks: heartbeat monitoring, re-replication when replicas are lost, load balancing, garbage collection, and operation-log management.
Read flow
- The client translates (file name, byte offset) into a chunk index using the fixed chunk size.
- It sends (file name, chunk index) to the master.
- The master replies with the chunk handle and replica locations; the client caches this.
- The client sends the read request to the closest replica, which returns the data.
Write flow (control and data)
Client Master Primary Secondaries
|-- 1 who holds lease? -->| | |
|<-- 2 primary+replicas --| | |
|-- 3 push data ------------------------>---------> (data flow,
| (chained to all replicas, cached in buffers) pipelined)
|-- 4 write request ------------------>| |
| | 5 assign serial |
| | number, apply |
| | |-- 5 fwd -->|
| | |<-- 6 ack --|
|<-- 7 reply (success or error) -------| |
- Client asks the master which chunkserver holds the lease and where the other replicas are.
- The master replies with the primary and secondary replicas.
- The client pushes data to all replicas; data flows along a chain from nearest to nearest (to use each machine's network bandwidth fully) and is held in a buffer (LRU) by each chunkserver.
- After all replicas confirm receipt, the client sends the write request to the primary.
- The primary assigns consecutive serial numbers to all mutations, applies them locally, and forwards the request to the secondaries, which apply them in the same order.
- The secondaries reply to the primary when finished.
- The primary replies to the client; any errors are reported and the client retries.
Control vs data flow
- Control messages (metadata requests, lease grants, write request/commit order) go between client, master and primary.
- Data goes directly from the client to chunkservers, and between chunkservers in a pipeline; it never passes through the master. This keeps the master from being a bottleneck.
Message summary
| Message | From to | Type |
|---|---|---|
| File name + chunk index | Client to Master | Control |
| Chunk handle + replica list | Master to Client | Control |
| Data to be written | Client to chunkservers (chain) | Data |
| Write request | Client to Primary | Control |
| Order forwarded | Primary to Secondaries | Control |
| Completion ack | Secondaries to Primary to Client | Control |
| File data (read) | Chunkserver to Client | Data |
The data path is decoupled from the control path: data is pushed along a chain of chunkservers to use each machine's full outgoing bandwidth, while control follows a primary-secondary model that guarantees the same mutation order on all replicas.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Single master not a GFS bottleneck · Big Data Technologies, chapter 2
- Short note: Client-Server and Master-Slave · Big Data Technologies, chapter 1
- Role of data scientist in big data · Big Data Technologies, chapter 1 · asked 2×
- Short note: Shadow Master and Cluak · Big Data Technologies, chapter 2
- GFS vs other file systems · Big Data Technologies, chapter 2
- Large fixed-size chunks in GFS · Big Data Technologies, chapter 2
- GFS vs HDFS architecture · Information System, chapter 8
- Flow control mechanisms in data communication · Telecommunications, chapter 8
- Flow control in data communication network · Telecommunications, chapter 8
- Segregation and bleeding; control during placing · Concrete Technology and Masonry Structure, chapter 3