Application Layer: P2P file distribution

Learning principles: no practice without learning theory. P2P file distribution never seen it before not to learn.

Concepts
peer: host connected to the pair of intermittent

All parties involved in the collection of a specific document distribution, etc.: torrent (torrent)

Tracker (tracker): Each has a torrent infrastructure node

Nearby Peer: peer successfully create a TCP connection side

Expansion of P2P architecture
client - server architecture and P2P architecture comparison, the following conclusions:

The client - server architecture lower, as the number of parties on the distribution time increases linearly like
a P2P system, distribution time increases linearly with a constant tends, if F denotes the number of bits distributed file, u represents all have the same peer upload rate, this constant F / u.
Is the most popular P2P protocol BitTorrent, the seeds of Thunder download the case of this column.

BitTorrent
When a peer joins a torrent, it registers itself to the tracker, and periodically inform the tracker it is still the torrent.

Work process
Suppose there is a new peer Alice to join a torrent

Tracker randomly selects a subset of the peer (eg 50) and the IP address of this peer 50 sends Alice from participating peer collection, Alice has a list of IP addresses
Alice and All peers on the list of parties to create a TCP connection, and so become parties to the neighboring
block list Alice periodic ask each neighbor peer they have.
Information on the current block itself does not have, Alice sends a request to obtain (block most scarce, the highest priority request)
sends a neighbor which the neighbor block to her request while he does not have to block some information. How do you decide which neighbor request response? BitTorrent uses an algorithm to change.
The basic idea is that Alice conversion method based on the current data can be provided to her neighbors at the highest rate, given its priority.

Proceed as follows:

Alice receives the test continued for her neighbors to each bit rate, and to determine the inflow at the highest rate of four neighbors
every 10 seconds, the rate is recalculated and she may modify the four peer set
every 30 second, Alice to randomly select and send another neighbor block, namely Alie random selection of a new partner to change.
This effect is peer can upload tend to find a coordinated rate each other. Also allows new randomly selected neighbor peer obtained block, so they can have something to change, in addition to five pairs appeal peer, other peers are blocked.
----------------
Disclaimer: This article is the original article CSDN bloggers "sugaryaruan", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement. .
Original link: https: //blog.csdn.net/sugaryaruan/article/details/51824249

Published 54 original articles · won praise 1 · views 2742

Guess you like

Origin blog.csdn.net/weixin_44682507/article/details/103103367