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/

分布式系统是一种由多个独立的计算机节点组成的系统,这些节点通过网络互相通信和协调,共同完成任务。分布式系统的原则和范例可以总结如下。 首先,容错性是分布式系统的重要原则之一。由于分布式系统由多个节点组成,节点之间的通信可能会遇到错误、故障或延迟。为了提高系统的可靠性,分布式系统需要具备容错机制,能够自动检测和纠正错误,保证系统的正常运行。 其次,一致性是分布式系统的核心原则之一。分布式系统中的数据通常被存储在不同的节点上,这就带来了数据一致性的挑战。为了保证数据的一致性,分布式系统需要使用合适的一致性协议和算法,确保各个节点之间的数据一致性和同步。 同时,可扩展性也是分布式系统的重要原则之一。分布式系统需要具备良好的可扩展性,能够根据用户需求动态地扩展节点数量和处理能力。通过水平扩展和垂直扩展等手段,分布式系统可以实现高性能和高可用性。 此外,安全性也是分布式系统的原则之一。由于分布式系统中的节点和网络是开放的,容易受到安全攻击和数据泄露的威胁。为了保障系统的安全,分布式系统需要实现合适的安全机制,包括身份认证、数据加密和访问控制等。 最后,弹性性是分布式系统的原则之一。分布式系统需要具备弹性,能够在节点故障、网络拥塞或大量请求压力下保持正常运行。通过引入负载均衡、流量控制和自动伸缩等机制,分布式系统可以提高其弹性,并能够快速恢复正常运行。 总之,分布式系统的原则和范例包括容错性、一致性、可扩展性、安全性和弹性性。这些原则和范例的应用可以提高分布式系统的可靠性、性能和安全性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值