Distributed Systems笔记-NFS、AFS、GFS
CMU 95702 關于 NFS、AFS、GFS 的筆記。
 
NFS(Network File System)
目的:
- Your files are available from any machine.
- Distribute the files and we will not have to implement new protocols.
特點:
- Defines a virtual C/S file system
- Stateless
- Uses RPC over TCP or UDP.
NFS 的實質在于用戶間計算機的共享。用戶通過 NFS 客戶端接入網絡,可以訪問同一網絡中其它計算機系統的硬盤(該計算機為 NFS 服務端)。NFS 客戶端可以 mount 遠端文件系統的部分或全部到本地,訪問這些文件系統就像訪問在本地磁盤上的文件系統一樣。
NFS 訪問數據的速度以接近采用本地磁盤的速度為目標,NFS客戶端的性能直接取決于服務端的性能和網絡性能。如:
- 網絡的最大吞吐量
- 服務端硬件性能:網卡,磁盤等
- 服務端緩存大小,TCP/IP的配置
- 服務端服務實例的運行個數
- 客戶端請求的網絡文件數
- 客戶端的系統性能
 其它運行在客戶或服務端上與NFS競爭資源的進程
NFS客戶端將用戶級別命令轉化為RPC;NFS服務端將RPC轉換為用戶級別命令。
 NFS的主要缺點:文件服務器的定位對客戶端非透明,即客戶端需要知道服務端的確切地址(掛載點),這也導致了其可擴展性差,維護困難,優點是發展多年,Linux內核直接支持,使用簡單方便。
NFS architecture
NFS server operations
 
-> The directory and file operations are integrated into a single service.
NFS client
AFS(Andrew File System)
目的:
- Scalability
特點:
- Modified from Coulouris
- Cache
 Whole files are cached in client nodes to reduce client server interactions -> achieve scalability.
 A client cache would typically hold several hundreds of files most recently used on that computer.
 Permanent cache, surviving reboots.
- Consider UNIX commands and libraries copied to the client.
- Consider files only used by a single user.
 These last two cases represent the vast majority of cases.
- Gain: Your files are available from any workstation.
- Principle: Make the common case fast.
Open file:
- When the client tries to open a file
 client cache is tried first
 if not there, a server is located and the server is called for the file.
- The copy is stored on the client side and is opened.
- Subsequent reads and writes hit the copy on the client.
Close file:
- When the client closes the file - if the files has changed it is sent back to the server. The client side copy is retained for possible more use.
AFS(Andrew File System) 文件系統主要用于管理分部在不同網絡節點上的文件。AFS 采用安全認證和靈活的訪問控制提供一種分布式的文件和授權服務,該服務可以擴展到多個客戶端。
AFS與NFS不同,AFS提供給用戶的是一個完全透明,永遠唯一的邏輯路徑。因而其具有跨平臺,分布式的特點。但是由于AFS使用本地文件系統來緩存最近被訪問的文件塊,訪問一個在本地的AFS文件由于需要附加一些耗時的操作,比直接訪問本地的其它文件要慢很多。AFS為讀操作做了優化,寫操作很復雜,是一個讀快寫慢的文件系統,不能提供很好的讀寫并發能力。
AFS architecture
Implementation of file system calls in AFS
File name space seen by clients of AFS
 
System call interception in AFS
 
The main components of the Vice service interface
 
CMU’s Coda is an enhanced descendant of AFS
 Very briefly, two important features are:
 Disconnected operation for mobile computing.
 Continued operation during partial network failures in server network.
 During normal operation, a user reads and writes to the file system normally, while the client fetches, or “hoards”, all of the data the user has
 listed as important in the event of network disconnection.
 If the network connection is lost, the Coda client’s local cache serves data from this cache and logs all updates.
 Upon network reconnection, the client moves to reintegration state; it sends logged updates to the servers. From Wikipedia
GFS(Google File System)
目的:
- Scalability
特點:
- Reliably with component failures.
- Massively large files
 Solve problems that Google needs solved – not a massive number of files but massively large files are common. Write once, append, read many times.
- Streaming and no cache
 Access is dominated by long sequential streaming reads and sequential appends. No need for caching on the client.
- Throughput more important than latency.
- Each file is mapped to a set of fixed size chunks(64Mb/chunk).
- 3 replicas
 Each chunk is replicated on three different chunk servers.
- Master and chunk servers
 Each cluster has a single master and multiple (usually hundreds) of chunk servers.
 The master knows the locations of chunk replicas.
 The chunk servers know what replicas they have and are polled by the master on startup.
Think of very large files each holding a very large number of HTML documents scanned from the web. These need read and analyzed.
 This is not your everyday use of a distributed file system (NFS and AFS). Not POSIX.
Google physical infrastructure
Structure
Operations
Read
Suppose a client wants to perform a sequential read, processing a very large file from a particular byte offset.
- The client can compute the chunk index from the byte offset.
- Client calls master with file name and chunk index.
- Master returns chunk identifier and the locations of replicas.
- Client makes call on a chunk server for the chunk and it is processed sequentially with no caching. It may ask for and receive several chunks.
Mutation
Suppose a client wants to perform sequential writes to the end of a file.
- The client can compute the chunk index from the byte offset. This is the chunk holding End Of File.
- Client calls master with file name and chunk index.
- Master returns chunk identifier and the locations of replicas. One is designated as the primary.
- The client sends all data to all replicas.The primary coordinates with replicas to update files
 consistently across replicas.
原文地址: http://www.shuang0420.com/2016/12/10/Distributed%20Systems%E7%AC%94%E8%AE%B0%EF%BC%8DNFS%E3%80%81AFS%E3%80%81GFS/
 
總結
以上是生活随笔為你收集整理的Distributed Systems笔记-NFS、AFS、GFS的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: Distributed Systems笔
- 下一篇: CMU 11642 Search Eng
