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,System)