Distributed System 基础(三)端到端系统(Peer-to-peer Systems)

列举几个例子:E-mule,BitTorrent,Napster...他们都没有central authority,并且是在全球范围使用。这些系统极具动态性,人们能随时链接或者断开链接。他们的效率并没有那么高,所以现在已经过时。

1 分布式文件存储-BitTorrent的总体思想

如果你想把文件从服务器发送给数百万用户,那么让他们链接到同一台服务器是有很大问题的。可能会产生单点错误(single point of failure)或者巨大的瓶颈问题(bottleneck problem)。对此,可以使用P2P系统解决。P2P系统的提出一个想法:每个人先从服务器上下载一部分文件,然后开始从其他用户(peer)那里下载其他片段。

2 BitTorrent

在BitTorrent系统中,角色很少,其中一个叫做:"tracker"。它有共享该文件的用户的名单,文件拓展名为“.torrent”,并包含诸如名称,大小,tracker 信息等。该文件通常会被分为很多部分,所以也有大小和hash值。我们需要hash来确保我们下载了正确的部分,也可以通过hash来避免一种叫poison的攻击。

另一个参与者叫"seed".Seed是一个拥有整个文件的节点,如果某个用户想要下载一个文件,他询问tracker来给他一个节点来下载文件。最初,tracker会导向seed,然后开始追踪下一个part在那个节点有,然后重定向到该节点。如果某用户拥有了这个文件的全部part。那么它将成为一个seed。

那么我们如何选择从什么part开始下载呢?

有三种方案:

1 顺序:效果很差,可能会有很多问题

2最少见优先(rarest first):问题在于对那些拥有最少的part的那部分人可能开销就很大了

3随机

事实上,一般我们将随机和最少见优先结合使用,先使用随机,然后最少见。这么处理是因为:随机方法在数量很多的时候效果很好,最少见方法用来确定没有part丢失。

当然,在系统中,总有人想只从别人那下载却不给别人上传,这人些被称为free fider。那我们怎么发现他们呢?

3 Choking algorithm

Choking意思是停止上传。在BitTorrent中,对unchoking有一项规则:每个端(peer)可以unchoke 4 个节点,并且很大概率是给他提供下载的那些节点。这样一来,如果某个用户是free rider。那么它被人unchoke的概率就很小了。即可能就没有人会给他上传了。问题是如果有个节点刚刚开,那么它里面没有文件能上传给别人,那它也没办法被unchoke,怎么办?我们还有更好的算法,比如:optimistic unchoking来解决这个问题。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Computers and computer networks are one of the most incredible inventions of the 20th century, having an ever-expanding role in our daily lives by enabling complex human activities in areas such as entertainment, education, and commerce. One of the most challenging problems in computer science for the 21st century is to improve the design of distributed systems where computing devices have to work together as a team to achieve common goals. In this book, I have tried to gently introduce the general reader to some of the most fundamental issues and classical results of computer science underlying the design of algorithms for distributed systems, so that the reader can get a feel of the nature of this exciting and fascinating field called distributed computing. The book will appeal to the educated layperson and requires no computer-related background. I strongly suspect that also most computer-knowledgeable readers will be able to learn something new. Gadi Taubenfeld is a professor and past dean of the School of Computer Science at the Interdisciplinary Center in Herzliya, Israel. He is an established authority in the area of concurrent and distributed computing and has published widely in leading journals and conferences. He authored the book Synchronization Algorithms and Concurrent Programming, published by Pearson Education. His primary research interests are in concurrent and distributed computing. Gadi was the head of the computer science division at Israel's Open University; member of technical staff at AT&T Bell Laboratories; consultant to AT&T Labs–Research; and a research scientist and lecturer at Yale University. Gadi served as the program committee chair of PODC 2013 and DISC 2008 and holds a Ph.D. in Computer Science from the Technion–Israel Institute of Technology.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值