CN106487931B - A kind of BitTorrent data distribution systems and method based on similar documents collaboration - Google Patents

A kind of BitTorrent data distribution systems and method based on similar documents collaboration Download PDF

Info

Publication number
CN106487931B
CN106487931B CN201611144224.5A CN201611144224A CN106487931B CN 106487931 B CN106487931 B CN 106487931B CN 201611144224 A CN201611144224 A CN 201611144224A CN 106487931 B CN106487931 B CN 106487931B
Authority
CN
China
Prior art keywords
node
file
seed
data
data block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611144224.5A
Other languages
Chinese (zh)
Other versions
CN106487931A (en
Inventor
符永铨
韦立超
刘峰
彭宇行
李东升
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
National University of Defense Technology
Original Assignee
National University of Defense Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by National University of Defense Technology filed Critical National University of Defense Technology
Priority to CN201611144224.5A priority Critical patent/CN106487931B/en
Publication of CN106487931A publication Critical patent/CN106487931A/en
Application granted granted Critical
Publication of CN106487931B publication Critical patent/CN106487931B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/278Data partitioning, e.g. horizontal or vertical partitioning

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Software Systems (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention discloses a kind of BitTorrent data distribution systems based on similar documents collaboration, it is made of control node, peer node, seed node, control node actively discover with the highest a group of file of peer node file to be downloaded similarity, and the address information for possessing the seed node of these files is transferred to peer node;Peer node requests downloading data block to these seed nodes, while obtaining data block from other peer nodes of downloading same file with the seed node for possessing same file.Invention additionally discloses a kind of BitTorrent data distributing methods based on similar documents collaboration.The invention has the following advantages: downloading node is while inheriting BitTorrent transport protocol, realize the function of across similar documents carry out data block exchanges, downloading node exchanges data with other nodes of downloading same file and from the seed node for possessing similar documents simultaneously, effectively increases the efficiency of data distribution.

Description

A kind of BitTorrent data distribution systems and method based on similar documents collaboration
Technical field
The present invention relates to network communication field, in particular to a kind of BitTorrent data point using similar documents collaboration Send out system and method.
Background technique
Data distribution is one of key problem of network communication field.The speed of data distribution is improved for improving network Efficiency and service quality are most important.Currently, data dissemination techniques mainly include under single node download technology and multi-node collaboration Load technology.Each node be possess processor, memory, disk, network interface card, operating system, TCP/IP network protocol stack can be independent The computer of operation.TCP/IP network protocol can be based on by network interface card between node be exchanged with each other internet message.
Single node download technology passes through the node (referred to as document storing section point) that a file stores this document from one Node (referred to as file request node) of the network transmission to a demand file.If there is multiple file request nodes are simultaneously to one A document storing section point demand file, then establishing independent network between different file request nodes and document storing section point Simultaneously individual transmission data are connected, and do not have any communication between file request node.Finally, each file request node obtains One copy of file.This method needs a large amount of network bandwidth resources of consumption file memory node, is easy to store in file Near nodal causes hot spot communication zone, generates network congestion.
Multi-node collaboration download technology by a file from one or more document storing section point by network transmission to Multiple file request nodes.Each file is divided into the data block of one group of same size, and the size of each data block is by application spirit Configuration living.First data block of file is defined as number 0, and the number of second data block is 1, and subsequent data block number is pressed According to data block location incremental calculation.Each file request node can request different numbers to multiple document storing section points simultaneously Data block;Meanwhile if there is multiple file request nodes obtain file data to document storing section point simultaneously, then different texts Part requesting node can mutually transmit the file data blocks of other side's missing, to reduce the network communication pressure of document storing section point Power improves speed of download.
In multi-node collaboration download technology, BitTorrent system is a kind of data distribution systems being commonly used, With simple and practical, it is easy to the characteristics of disposing.BitTorrent system is that a file establishes a seed file (referred to as torrent).File cutting is the identical one group of data block of size by one torrent, and each data block is breathed out by a MD5 Uncommon function generates a unique cryptographic Hash, is used for index data block content.
BitTorrent data distribution systems include a control node (Tracker), one or more file request sections Point (referred to as peer node, Peer), one or more document storing section points (referred to as seed node, Seed).
Control node is interacted with peer node and seed node, is equipped with data transmission control program, and major function is to receive The address information and seed file for collecting peer node and seed node, are then stored in memory and disk, and receive to constant pitch The request for the file download that point is submitted.
Each peer node and seed node installation data download upload program, and data download the major function of upload program It is that the peer node and seed node address information of downloading same file are obtained from control node, and from peer node and seed section Data block required for point is downloaded;Meanwhile the data block downloaded is provided for other peer nodes.
Data distribution basic thought based on BitTorrent is:
(1) data of peer node download upload program and send file request message to control node;
(2) equity of the data transmission control program selection certain amount of control node and peer node downloading same file The address information of node and the seed node for possessing this document, and these address informations are transferred to peer node;
(3) node that the data downloading upload program parsing control node of each peer node (being denoted as Peer0) returns Location information stores into neighbor node set, and required data block is periodically contacted and downloaded with neighbor node, until obtaining Complete file is got, data downloading upload program exits.Specific step is as follows:
The data of 3.1 peer node Peer0 download upload program initialization information, specifically include:
3.1.1 peer node Peer0 enables the quantity of data block to be downloaded be denoted as LeftBlock.N is enabled to correspond to file to be downloaded Data block total number.If LeftBlock=N.
3.1.2 peer node Peer0 is that each neighbours i safeguards a downloading data block array, is denoted as DownloadedBlock.Array DownloadedBlock is initialized as the one-dimension array comprising N number of neutral element,.If neighbours i is The data block for being j through downloading number, then setting i.DownloadedBlock (j)=1, otherwise sets I.DownloadedBlock (j)=0, wherein i. represents a data structure of access neighbours i, this is the programming of object-oriented The mode that object properties are commonly accessed in language, hereafter takes similar representation method.
The least number of copy amount in the data downloading upload program selection neighbor node set S of 3.2 peer node Peer0 According to block, remember that its number is Rarestblock.Specific step is as follows:
3.2.1 the number of copies of neighbor node set downloading data block is calculated.The number of copies of one data block is equal to and possesses The sum of the neighbor node of the data block, the data block for being j for number, number of copies is defined as:
i∈Si.DownloadedBlock(j)
3.2.2 peer node Peer0 selects the least data block of number of copies, remembers that its number is Rarestblock.
The data of 3.3 peer node Peer0 download upload program to data block one for possessing that number is Rarestblock Neighbor node X sends a downloading data block request.
The data downloading of 3.4 neighbor node X uploads the data block of management program selection request, is transmitted by ICP/IP protocol Give peer node Peer0.
The data downloading upload program of 3.5 peer node Peer0 deposits the data block that the number of acquisition is Rarestblock The number for storing up file to be downloaded is the position of Rarestblock.And update remaining number of data blocks LeftBlock= LeftBlock-1, data block number set DownloadedBlock (the Rarestblock)=D1 downloaded.
The data downloading of 3.6 peer node Peer0 uploads management program judgement: if number of data blocks to be downloaded LeftBlock=0 illustrates that peer node has downloaded all data blocks;Otherwise, turn 3.2 steps, it is surplus that peer node continues downloading Remaining data block.
Existing single node download technology and multi-node collaboration download technology are transmitted both for identical file, are not had Have and considers similar file.Relationship between two files can be divided into dissimilar, similar, identical three kinds according to similarity degree.Phase The number of the identical data block of two files is defined as divided by the sum of two all data blocks of file like degree.If two files There is no any identical data block, then both of these documents are dissimilar;, whereas if all data block of two files is all It is identical, then two files are same files;Similar documents refer to that there are the two of certain amount identical block files.Cause This, same file can also regard special similar documents as.The similar documents that the present invention is paid close attention to refer to existing certain identical The file of data block and certain amount different data block.Similar documents source is wider, for example, the Linux of different editions operates system System installation file generally comprises a large amount of identical programs and data, these identical data blocks are of equal value in data dissemination process 's.
Summary of the invention
The technical problem to be solved by the present invention is can not benefit for the existing data distribution systems based on BitTorrent The problem of realizing rapid data distribution with similar documents proposes a kind of BitTorrent data distribution systems of similar documents collaboration And method, excavate similar documents resource effectively to accelerate data distribution.
In order to solve the above technical problems, the embodiment of the present invention provides a kind of BitTorrent number based on similar documents collaboration According to dissemination system, it is made of a control node, one or more peer nodes, one or more seed nodes, each node It is all independent operating and the computer that can mutually carry out network communication;
The control node is responsible for interacting with peer node and seed node, and data transmission is equipped in the control node Program is controlled, the data transmission control program is used to receive the file distribution message of each seed node, stores each seed The information and all seed files of the corresponding seed node of file and peer node;The data transmission control program is same When be also used to receive the file download request message that each peer node submits, and select and pass according to file download request message Defeated one group possess the seed node of similar documents, one group downloading the peer node of same file and possessing same file Seed node is to the peer node for sending file download request message;
Wherein, each peer node is equipped with data downloading upload program, and the data downloading of the peer node uploads journey Sequence is used to send file download request message to control node, and the file download request message includes the title of file to be downloaded With seed file information;Meanwhile the data downloading upload program is also used to read the seed node of control node return, equity Node address information and corresponding seed file, and it is deposited into neighbor node set, then periodically from neighbor node set Requested data block;
Wherein, each seed node is also equipped with data downloading upload program, the data downloading of the seed node Upload program is used to send file distribution message to the control node, and the file distribution message includes what seed node possessed The title and seed file of file;Meanwhile the seed node data downloading upload program be also used to receive it is described to constant pitch The data block of point downloads request, and requests the number of corresponding data block to be selected from file reference numeral position according to data block downloading Data block is selected, and is transmitted to the peer node of request downloading data block by network;
Wherein, the peer node in the peer node from downloading same file or possesses under the seed node of same file When carrying data block, data block is directly transmitted in the number of local file to Correspondent Node, Correspondent Node is according to requested data block Data block is directly stored in local file according to number by the corresponding data block of numbered transmission, peer node;And peer node from When possessing the seed node downloading data block of similar documents, peer node sends requested data block in the position of Correspondent Node file Correspondent Node is numbered, by corresponding transmission of data blocks to peer node, last peer node exists Correspondent Node according to data block Data block is stored in corresponding position by the number of local file.
In order to solve the above technical problems, the embodiment of the present invention also provides a kind of BitTorrent based on similar documents collaboration Data distributing method includes the following steps:
Step 1, a BitTorrent data distribution systems are constructed, it is by a control node, one or more equities Node, one or more seed nodes are constituted, and each node is independent operating, the computer that can mutually carry out network communication;
Step 2, control node executes data transmission control program;The data transmission control program is for independently received The file distribution message of each seed node, extracts the seed file information that the file distribution message includes, and in memory and The corresponding all seed node address informations of each seed file of disk storage;The seed node address information is stored in one Inside dictionary data structure, the dictionary data structure is denoted as seed file dictionary TorrentIndexTable;Secondly, described Data transmission control program is also used to the file download request message of independently received each peer node, and extraction document downloading is asked The seed file for the demand file for asking message to include;The kind Ziwen for the demand file that the extraction document downloading request message includes Part includes the seed file information that resolution file downloading request message includes and is marked as torrent1, and from the seed The kind Ziwen of selection and peer node demand file in all seed files of file dictionary TorrentIndexTable record Highest k different seed files of part similarity, then select the k seed node addresses for possessing corresponding complete file, together When selection k2 download the peer node of same file with the peer nodes for sending request and possess the seed node of same file, Specifically using the k different seed file inquiry seed file dictionary TorrentIndexTable to obtain corresponding kind Child node;Then these seed files, seed node address and peer node address are given by network transmission and sends under file Carry the peer node of request message;
Step 3, each peer node executes data and downloads upload program;Data downloading upload program is responsible for control node The seed node address with similar documents is requested, the peer node address of same file is being downloaded and is possessing same file Seed node address, and these node address are stored in neighbor node set;Then, the data of each peer node, which are downloaded, uploads Data block of the program to the corresponding neighbor node request missing of this node;Meanwhile the program receives the data of other peer nodes Block downloading request, and the data block downloaded is uploaded to corresponding peer node;
Step 4, each seed node executes data and downloads upload program;Data are downloaded upload program and are sent to control node File distribution message, message include the file name and corresponding seed file that this section point possesses;Meanwhile data downloading uploads journey The data block of peer node in sequence also reception system downloads request, and uploads specified data block to peer node.
Further, one BitTorrent data distribution systems of the building in the step 1 specifically:
The control node is responsible for interacting with peer node and seed node, and data transmission is equipped in the control node Program is controlled, the data transmission control program is used to receive the file distribution message of each seed node, and stores each kind The information and all seed files of the corresponding seed node of subfile and peer node;The data transmission control program The file download request message that each peer node is submitted also is received simultaneously, is selected and is passed according to the file download request message Defeated one group possess the seed node of similar documents, one group downloading the peer node of same file and possessing same file Seed node is to the peer node for sending file download request message;
Wherein, each peer node is equipped with data downloading upload program, and the data downloading upload program is used for control Node processed sends file download request message, and the file download request message includes the title and seed file of file to be downloaded Information;Meanwhile the data downloading upload program is also used to read the seed node and peer node address of control node return Information and corresponding seed file, and it is stored in neighbor node set, then periodically from neighbor node aggregate requests data block;
Wherein, each seed node is also equipped with data downloading upload program, the data downloading of the seed node Upload program is used to send file distribution message to the control node, and the file distribution message includes what seed node possessed The title and seed file of file;Meanwhile the seed node data downloading upload program be also used to receive it is described to constant pitch The data block of point downloads request, requests the number of corresponding data block to select from file reference numeral position according to data block downloading Data block, and it is downloaded into the peer node requested to data block is issued by network transmission.
Further, each peer node in the step 3 executes data downloading upload program and specifically includes following step It is rapid:
The data of each peer node of step 3.1 download upload program initialization download process;LeftBlock is set to represent The quantity for the data block that do not download sets N as the data block total number of file to be downloaded, and the initial value that LeftBlock is arranged is N; Meanwhile the data downloading upload program safeguards a downloading data block array for each neighbor node i of neighborhood The length of DownloadedBlock, the data block array DownloadedBlock are gathered around documentary equal to neighbor node i The number of data block;The items of the data block array DownloadedBlock are initialized as 0, if neighbor node i possesses number It otherwise, is set i.DownloadedBlock (j)=0 for the data block of j then setting i.DownloadedBlock (j)=1;
The data block information that each peer node of step 3.2 was downloaded every the t seconds each neighbor node i of request, updates adjacent Occupy the array of the downloading data block DownloadedBlock of node i;Wherein, t represents the waiting time of downloading data block twice, t It is 0.1 second;
The data of each peer node of step 3.3 download upload program and send file download request message to control node, Message include file to be downloaded title and corresponding seed file;
The each peer node of step 3.4 data downloading upload program read control node return neighbor node address and Corresponding seed file, and it is stored in neighbor node set;
The each peer node of step 3.5 is denoted as Peer0, and the data downloading upload program of peer node Peer0 is to possess phase Safeguard that data block maps array DownloadedSameBlock like each seed node of file, minute book node and should The identical data block number map information of seed node;
The each peer node of step 3.6 is denoted as Peer0, the data downloading upload program of peer node Peer0 every t seconds from Neighbor node set downloads a data block, and parameter t arranges value according to step 3.2.
Further, it specifically further includes following that each seed node in the step 4, which executes data downloading upload program, Step:
One entitled F's of the data downloading upload program selection local disk of step 4.1 seed node SeedNode0 The seed file of file sends file distribution message to control node, and transmits the corresponding seed file of file F and save to control Point;
The data block that the data downloading upload program of step 4.2 seed node SeedNode0 persistently monitors peer node is asked Message is sought, the number j for the data block that message includes is read, selects number for the data block of j from local file, and pass by network It is defeated by Correspondent Node.
Further, the step 2 further comprises step in detail below:
The file distribution message of the data transmission control program parsing seed node of step 2.1.1 control node, is planted The title of the address SeedAddress and torrent of child node, are denoted as TorrentNAME;
The data transmission control program of step 2.1.2 control node updates seed file dictionary TorrentIndexTable, The current all seed node address informations of record, i.e. TorrentIndexTable [TorrentNAME]= TorrentIndexTable[TorrentNAME]∪{SeedAddress};
The data transmission control program of step 2.2.1 control node inquires seed file dictionary TorrentIndexTable Record all seed files, calculate seed file dictionary TorrentIndexTable record all seed files with The similarity for the seed file that peer node submits downloading request message to include;If seed file torrent2 is seed file word One in all seed files of allusion quotation TorrentIndexTable record, seed file torrent1 mentions for peer node The seed file for handing over demand file download message to include;
The data transmission control program of step 2.2.2 control node arranges all seed files according to the descending of similarity, Then the maximum k seed file of similarity is selected;Wherein k represents the number of the seed file for similar documents downloading;
Seed file inquiry k that the data transmission control program of step 2.2.3 control node is selected according to step 2.2.2 Seed node address;
Pair of same file is downloaded in data transmission control program selection k2 of step 2.2.4 control node with peer node The address information of equal nodes and the seed node for possessing this document, is denoted as SameFileSet;
The data transmission control program of step 2.2.5 control node is by seed set SeedNodeSet and SameFileSet The seed node address information and corresponding seed file for including are transferred to other side's peer node.
Further, the step 3.5 further comprises step in detail below:
The data of step 3.5.1 peer node Peer0 are downloaded upload program and are read often from the neighbor node set of this node A seed node address for possessing similar documents is denoted as SeedNode2 and its corresponding seed file is denoted as torrent2, is SeedNode2 initializes a data block and maps array DownloadedSameBlock, wherein array The length of DownloadedSameBlock is equal to the total number of the data block of peer node PeerO file to be downloaded, The items of DownloadedSameBlock are initialized as 0;
The data downloading upload program of step 3.5.2 peer node Peer0 calculates the Hash of the data block of file to be downloaded The intersection of the data block hash value collection S2 of the seed node SeedNode2 of value set S1 and step 3.5.1 selection SameBlocks, i.e. SameBlocks=j | j ∈ S1 ∧ j ∈ S2 };
The data downloading upload program of step 3.5.3 peer node Peer0 reads each data of set SameBlocks The cryptographic Hash of block, if number of the data block in the file of this node is j, in the volume of the file of seed node SeedNode2 Number be j2, then update neighbor node SeedNode2 corresponding data block mapping array DownloadedSameBlock (j)= j2。
The step 3.6 further comprises step in detail below:
The data downloading upload program of step 3.6.1 peer node Peer0 selects the least number of neighbor node copy number According to block;
The data downloading upload program judgement of step 3.6.2 peer node Peer0: if number is Rarestblock data The corresponding neighbor node of block is identical with this node file to be downloaded, then the program sends a data block to the neighbor node Request message, message include the number Rarestblock of data block;
If step 3.6.3 step 3.6.2 judges invalid, i.e., number is Rarestblock data block corresponding neighbours section It is not same file that point, which is denoted as Z and this node file to be downloaded, then the data of peer node Peer0 download upload program The data block is calculated in the number j2 of neighbor node Z, and the data block for being j2 to neighbor node Z request number,
Number of data blocks LeftBlock to be downloaded is arranged in the data downloading upload program of step 3.6.4 peer node Peer0 =LeftBlock-1, update data block coding number group DownloadedBlock (Rarestblock) that this node downloaded= 1;
If the data downloading upload program of step 3.6.5 peer node Peer0 judges number of data blocks to be downloaded LeftBlock=0 illustrates to have downloaded all data blocks, goes to step 4, continues as other peer nodes and uploads data block; Otherwise, the data of peer node Peer0 are downloaded upload program suspend mode t seconds, are gone to step 3.6.1 after t seconds intervals, are continued to download Remaining data block, parameter t value are identical as step 3.2;
The step 3.6.1 further comprises step in detail below:
The data downloading upload program of step 3.6.1.1 peer node Peer0 calculates neighbor node set downloading data The copy number of block, the copy number of each data block are equal to the sum for possessing all neighbor nodes of the data block;Setting SameSet representative is downloading the peer node of same file and is possessing the seed node of same file, sets SimilarSet All seed nodes for possessing similar documents are represented, then the copy sum for the data block that number is j is equal to be gathered around in SameSet set There is the number of the neighbor node of the data block and possesses it of the number of the neighbor node of the data block in SimilarSet set With i.e. ∑i∈SameSeti.DownloadedBlock(j)+∑k∈SimilarSetK.E (j), wherein ∑i∈ SameSetI.DownloadedBlock (j), which is represented, possesses the number of the neighbor node of the data block in SameSet set, ∑k∈SimilarSetK.E (j), which is represented, possesses the number of the neighbor node of the data block in SimilarSet set, wherein I.DownloadedBlock (j)=1 represents node i and has downloaded data block j, and E (j) represents whether k possesses data block j: if k is gathered around There are the data block, i.e. DownloadedSameBlock (j) ≠ 0, then setting k.E (j)=1;Otherwise, if DownloadedSameBlock (j)=0, then setting k.E (j)=0;
Step 3.6.1.2 peer node Peer0 data downloading upload program by the copy number of each data block according to Ascending order arrangement, then selects the corresponding data block of header element of arrangement as the least data block of copy number, remembers that its number is Rarestblock;
The step 3.6.3 further comprises step in detail below:
The data block of the data downloading upload program inquiry neighbor node Z of step 3.6.3.1 peer node Peer0 maps number Group DownloadedSameBlock obtains the number j2, i.e. j2=for numbering the data block for being Rarestblock in neighbor node Z Z.DownloadedSameBlock(Rarestblock);
The data downloading upload program of step 3.6.3.2 peer node Peer0 sends data block request message to neighbours' section Point Z, message include the number j2 of data block;
The data downloading upload program of step 3.6.3.3 peer node Peer0 receives the number that neighbor node Z is sent and is After the data block of j2, by the Rarestblock block of data block storage to file to be downloaded.
The present invention by adopting the above technical scheme, has the advantages that downloading node is inheriting BitTorrent transmission While agreement, realize the function of across similar documents carry out data block exchanges, downloading node not only with downloading same file Other node switching data, moreover it is possible to from the seed node downloading data for possessing similar documents, effectively increase the effect of data distribution Rate.
Detailed description of the invention
Fig. 1 is the system assumption diagram of BitTorrent system of the present invention
Fig. 2 is overview flow chart of the present invention
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below with reference to diagram to embodiment of the present invention It is described in further detail.
Fig. 1 is the system assumption diagram of BitTorrent data distribution systems that the present invention constructs, it by a control node, One or more peer nodes, one or more seed nodes are constituted.Each node is independent operating, can mutually carry out network The computer of communication.The working principle of the system: control node actively discovers and peer node file to be downloaded similarity highest A group of file, and the address information for possessing the seed node of these files is transferred to peer node;Peer node to these Seed node requests downloading data block, while from other peer nodes of downloading same file and possessing the seed section of same file Point obtains data block, to be obviously improved the speed of download of peer node.Each part is introduced separately below.
Control node is responsible for interacting with peer node and seed node, and Data Transmission Controlling journey is equipped in control node Sequence.Data transmission control program receives the file distribution message of each seed node, stores the corresponding seed of each seed file The information and all seed files of node and peer node.Data transmission control program receives each peer node and submits File download request, select one group of seed node for possessing similar documents, one group of peer node for downloading same file And possess the seed node of same file, and these nodes are transferred to pair for sending request message with corresponding seed node Equal nodes.
Each peer node is equipped with data downloading upload program.The data download upload program and send text to control node Part request message, message include the title and seed file information of file to be downloaded.Meanwhile data downloading upload program is read Seed node and peer node address information and the corresponding seed file that control node returns, deposit neighbor node set, Then periodically from neighbor node aggregate requests data block.In order to avoid because neighbor node leads to not download all numbers offline According to block, peer node is all every time the least data block of copy amount in neighbor node set to the data block of neighbor request.
Peer node is in the peer node from downloading same file or possesses the seed node downloading data block of same file When, data block is directly transmitted in the number of local file to Correspondent Node, Correspondent Node is according to the numbered transmission of requested data block Data block is directly stored in local file according to number by corresponding data block, peer node;And peer node is similar from possessing When the seed node downloading data block of file, peer node send requested data block Correspondent Node file Position Number to pair Fang Jiedian, Correspondent Node is by corresponding transmission of data blocks to peer node, and last peer node is according to data block in local file Number, data block is stored in corresponding position.
Each seed node is also equipped with data downloading upload program.The data are downloaded upload program and are sent to control node File distribution message, message include the title and seed file for the file that seed node possesses.Meanwhile data downloading uploads journey The data block that sequence receives peer node downloads request, according to the number of requested data block, selects number from file reference numeral position According to block, and by network transmission to the peer node for requesting the data block.
Fig. 2 is overview flow chart of the present invention.Detailed process is as follows:
The first step constructs a BitTorrent data distribution systems, it is by control node, peer node, seed node It constitutes, each node is independent operating, the computer that can mutually carry out network communication.
Control node is responsible for interacting with peer node and seed node, and Data Transmission Controlling journey is equipped in control node Sequence.Data transmission control program receives the file distribution message of each seed node, stores the corresponding seed of each seed file The information and all seed files of node and peer node.Data transmission control program receives each peer node and submits File download request, select one group of seed node for possessing similar documents, one group of peer node for downloading same file And possess the seed node of same file, and these nodes are transferred to pair for sending request message with corresponding seed node Equal nodes.
Each peer node is equipped with data downloading upload program.The data download upload program and send text to control node Part request message, message include the title and seed file information of file to be downloaded.Meanwhile data downloading upload program is read Seed node and peer node address information and the corresponding seed file that control node returns, deposit neighbor node set, Then periodically from neighbor node aggregate requests data block.In order to avoid because neighbor node leads to not download all numbers offline According to block, peer node is all every time the least data block of copy amount in neighbor node set to the data block of neighbor request.
Peer node is in the peer node from downloading same file or possesses the seed node downloading data block of same file When, data block is directly transmitted in the number of local file to Correspondent Node, Correspondent Node is according to the numbered transmission of requested data block Data block is directly stored in local file according to number by corresponding data block, peer node;And peer node is similar from possessing When the seed node downloading data block of file, peer node send requested data block Correspondent Node file Position Number to pair Fang Jiedian, Correspondent Node is by corresponding transmission of data blocks to peer node, and last peer node is according to data block in local file Number, data block is stored in corresponding position.
Each seed node is also equipped with data downloading upload program.The data are downloaded upload program and are sent to control node File distribution message, message include the title and seed file for the file that seed node possesses.Meanwhile data downloading uploads journey The data block that sequence receives peer node downloads request, according to the number of requested data block, selects number from file reference numeral position According to block, and by network transmission to the peer node for requesting the data block.
Second step, control node execute data transmission control program.The data transmission control program is independently received each The file distribution message of seed node, and believe in the corresponding all seed node addresses of memory and each seed file of disk storage Breath.The file download request message of the independently received each peer node of the data transmission control program selects k to possess most phase Other peer nodes of same file are downloaded with peer node like the seed node address of file and k2 and possess same file Seed node and corresponding seed file, by network transmission to peer node.
Secondly, the file download request message of the independently received each peer node of the data transmission control program, is extracted The seed file for the demand file that file download request message includes selects similar to the seed file of peer node demand file Spending highest k, (k is positive integer, represents the seed node quantity that set of metadata of similar data distributes selection, and k is bigger, and seed node is more, mentions The data downloading resource of confession is more, thus the speed of download of peer node is faster, and under default situations, k is set as 5) a different Then seed file selects the k seed node addresses for possessing corresponding complete file, (k2 is positive integer, generation to simultaneous selection k2 Neighbours' number of table BitTorrent original system selection, under default situations, k2 be set as 10) with send request peer node under It carries the peer node of same file and possesses the seed node of same file, then by these seed files, seed node address With peer node address by network transmission to the peer node for sending request message.
Specific step is as follows:
The data transmission control program of 2.1 control nodes receives the file distribution message of each seed node, resolution file Give out information the seed file information for including, and updates the corresponding seed node aggregate information of seed file in memory and disk. The information is stored in inside a dictionary data structure, is denoted as seed file dictionary TorrentIndexTable.For example, it is assumed that There are two the seed nodes of certain seed file torrent1, and address is respectively Seed1 and Seed2, then setting TorrentIndexTable [torrent1]={ Seed1, Seed2 }, whereas if seed file dictionary TorrentIndexTable does not record any seed node information of seed file torrent1, then just setting TorrentIndexTable [torrent1]={ }.Specific step is as follows:
2.1.1 the file distribution message of the data transmission control program parsing seed node of control node, obtains seed section The title of the address SeedAddress and torrent of point, are denoted as TorrentNAME.
2.1.2 the data transmission control program of control node updates seed file dictionary TorrentIndexTable, record Current all seed node address informations.That is TorrentIndexTable [TorrentNAME]= TorrentIndexTable[TorrentNAME]∪{SeedAddress}
The data transmission control program of 2.2 control nodes receives the file download request message that each peer node is submitted, Seed file (being labeled as torrent1) information that resolution file downloading request message includes, then from seed file dictionary In all seed files of TorrentIndexTable record, the similarity highest of selection and the seed file of peer node The different seed files of k, then using these seed files inquiry seed file dictionary TorrentIndexTable to obtain Take corresponding seed node.Finally, selection k2 are downloaded the peer node address and seed node of same file with peer node Address, and these node address and corresponding seed file are transferred to peer node.Specific step is as follows:
2.2.1 the data transmission control program inquiry seed file dictionary TorrentIndexTable record of control node All seed files, calculate seed file dictionary TorrentIndexTable record all seed files and equity The similarity for the seed file that node submits downloading request message to include.If seed file torrent2 is seed file dictionary One in all seed files of TorrentlndexTable record, seed file torrent1 is peer node submission The seed file that demand file download message includes, the specific steps are as follows:
2.2.1.1 the data transmission control program of control node reads all of seed file torrent1 and torrent2 The cryptographic Hash of data block, and cryptographic Hash is stored in respectively in two set S1 and S2;
2.2.1.2 the intersection S1 ∩ S2 of data transmission control program the set of computations S1 and S2 of control node, and set Union S1 ∪ S2:S1 ∩ S2=j | j ∈ S1 ∧ j ∈ S2 }, S1 ∪ S2=j | j ∈ S1 ∨ j ∈ S2 };
2.2.1.3 it is similar to torrent2's to calculate seed file torrent1 for the data transmission control program of control node Degree is the number of the intersection data block that includes | S1 ∩ S2 | the data block for including with union | S1 ∪ S2 | number ratio, i.e.,
2.2.2 the data transmission control program of control node arranges all seed files according to the descending of similarity, then Select the maximum k seed file of similarity.Wherein k represents the number of the seed file for similar documents downloading.Default value It is 5.If the similar documents in system are relatively more, k can be set to biggish number, to promote the downloading speed of peer node Degree.
2.2.3 the data transmission control program of control node inquires k seed section according to the seed file that 2.2.2 selected parts are selected Dot address, the specific steps are as follows:
2.2.3.1 the data transmission control program of control node sets seed node set SeedSet as sky;
2.2.3.2 the data transmission control program of control node is walked according to the descending order traversal 2.2.2 of similarity Suddenly the k seed file selected inquires seed file dictionary TorrentIndexTable using each seed file, obtains k Seed node.Specific step is as follows:
2.2.3.2.1 the data transmission control program initialization index idx of control node is 1.Initialization seed node Location set SeedNodeSet is sky.
2.2.3.2.2 the data transmission control program of control node is read from seed file dictionary TorrentIndexTable I-th dx seed file is taken, torrent-idx is labeled as.
2.2.3.2.3 the data transmission control program of control node inquires seed file dictionary using torrent-idx TorrentIndexTable obtains corresponding seed node address set, is denoted as SeedSet1=TorrentIndexTable [torrent-i]。
If 2.2.3.2.3 set SeedSet1 non-empty, then the data transmission control program of control node is from set SeedSet1 randomly chooses the address of a seed node, is denoted as SeedAddress1, and be stored in set SeedNodeSet, i.e., SeedNodeSet=SeedNodeSet ∪ { SeedAddress1 }.
If 2.2.3.2.4 the seed node number of seed set SeedNodeSet is equal to k, turn 2.2.4 step, otherwise, if Determine idx=idx+1, then turns 2.2.3.2.1 step.
2.2.4 the data transmission control program of control node selects k2 a with peer node downloading same file to constant pitch Point and possess this document seed node address information, be denoted as SameFileSet.
2.2.5 seed set SeedNodeSet and SameFileSet is included by the data transmission control program of control node Seed node address information and corresponding seed file be transferred to other side's peer node.
Third step, each peer node execute data and download upload program.Data downloading upload program is responsible for saving to control Point request has the seed node address of similar documents, is downloading the peer node address of same file and possessing same file Seed node address, and by these node address be stored in neighbor node set.Then, in the data downloading of each peer node Pass data block of the program to the corresponding neighbor node request missing of this node;Meanwhile the program receives the number of other peer nodes It downloads and requests according to block, and upload the data block downloaded to corresponding peer node.
Specific step is as follows:
The data of 3.1 each peer nodes download upload program initialization download process.It sets under LeftBlock representative not The quantity of the data block of load sets N as the data block total number of file to be downloaded.The initial value that LeftBlock is arranged is N.Meanwhile The program is that each neighbor node i of neighborhood safeguards a downloading data block array DownloadedBlock. The length of DownloadedBlock array is equal to the number that neighbor node i gathers around documentary data block. The items of DownloadedBlock are initialized as 0.If node i possesses the data block that number is j, then setting Otherwise i.DownloadedBlock (j)=1 is set i.DownloadedBlock (j)=0.
The data block information that 3.2 each peer nodes were downloaded every the t seconds each neighbor node i of request, more new neighbor i's Downloading data block array DownloadedBlock, wherein t represents the waiting time of downloading data block twice, and t is positive integer, It is usually arranged as lesser numerical value, with quick-downloading all data blocks, therefore, the default value of t is 0.1 second.
The data of 3.3 each peer nodes download upload program and send file request message to control node, and message includes The title of file to be downloaded and corresponding seed file;
The data downloading upload program of 3.4 each peer nodes reads the neighbor node address and correspondence that control node returns Seed file, and be stored in neighbor node set.
The data downloading upload program of 3.5 each peer nodes (being denoted as Peer0) is each seed for possessing similar documents One data block of node maintenance maps array DownloadedSameBlock, the identical number of minute book node and the seed node According to block number map information.Specific step is as follows:
3.5.1 the data of peer node Peer0 are downloaded upload program and are each gathered around from the reading of the neighbor node set of this node There are the seed node address (being denoted as SeedNode2) of similar documents and corresponding seed file (being denoted as torrent2), is SeedNode2 initializes a data block and maps array DownloadedSameBlock.Array DownloadedSameBlock Length be equal to peer node Peer0 file to be downloaded data block total number.The items of DownloadedSameBlock are just Beginning turns to 0.
3.5.2 the data downloading upload program of peer node Peer0 calculates the cryptographic Hash collection of the data block of file to be downloaded The intersection SameBlocks of the data block hash value collection S2 of the seed node SeedNode2 of S1 and the selection of 3.5.1 step is closed, i.e., SameBlocks=j | j ∈ S1 ∧ j ∈ S2 }.
3.5.3 the data downloading upload program of peer node Peer0 reads each data block of set SameBlocks Cryptographic Hash is in the number of the file of seed node SeedNode2 if number of the data block in the file of this node is j J2, then the corresponding data block of more new neighbor SeedNode2 maps array DownloadedSameBlock (j)=j2.
The data downloading upload program of 3.6 each peer nodes (being denoted as Peer0) was downloaded every t seconds from neighbor node set One data block, parameter t arrange value according to step 3.2.Specific step is as follows:
3.6.1 the data downloading upload program of peer node Peer0 selects the least data block of neighbor node copy number. Specific step is as follows:
3.6.1.1 the data downloading upload program of peer node Peer0 calculates neighbor node set downloading data block Copy number.The copy number of each data block is equal to the sum for possessing all neighbours of the data block.Set SameSet generation Table is downloading the peer node of same file and is possessing the seed node of same file, i.DownloadedBlock (j)=1 It represents node i and has downloaded data block j, then SameSet collection amounts to and possesses the copy number of data block j and be represented by all possess The sum of the node of data block j, i.e. ∑i∈SameSetI.DownloadedBlock (j), wherein ∑ represents accumulating operation symbol.If Determine SimilarSet and represents all seed nodes for possessing similar documents.If k.E (j) represents whether node k possesses data block j, If k possesses the data block, set k.E (j)=1;Otherwise, k.E (j)=0 is set.So SimilarSet collection, which amounts to, possesses data The copy number of block j is represented by ∑k∈SimilarSetK.E (j),.Therefore, the copy sum for the data block that number is j is equal to
i∈SameSeti.DownloadedBlock(j)+∑k∈SimilarSetk.E(j)。
3.6.1.2 the data downloading upload program of peer node Peer0 is by the copy number of each data block according to ascending order Then arrangement selects the corresponding data block of header element of arrangement as the least data block of copy number, remembers that its number is Rarestblock。
3.6.2 the data downloading upload program judgement of peer node Peer0: if number is the corresponding neighbour of Rarestblock Residence is identical with this node file to be downloaded, then the program sends a data block request message to the neighbours, message includes The number Rarestblock of data block.
If 3.6.3 3.6.2 judges invalid, i.e., number is that the corresponding neighbours of Rarestblock (being denoted as Z) and this node wait for The file of downloading is not same file, then the data downloading upload program of peer node Peer0 calculates the data block in neighbours Z Number j2, and to neighbours Z request number be j2 data block, the specific steps are as follows:
3.6.3.1 the data block of the data downloading upload program inquiry neighbours Z of peer node Peer0 maps array DownloadedSameBlock obtains the number j2, i.e. j2=for numbering the data block for being Rarestblock in neighbours Z Z.DownloadedSameBlock(Rarestblock)。
3.6.3.2 the data downloading upload program of peer node Peer0 sends data block request message to neighbours Z, message Number j2 comprising data block;
3.6.3.3 the data downloading upload program of peer node Peer0 receives the data that the number of neighbours Z transmission is j2 After block, by the Rarestblock block of data block storage to file to be downloaded.
3.6.4 number of data blocks LeftBlock=to be downloaded is arranged in the data downloading upload program of peer node Peer0 LeftBlock-1.Update the data block coding number group DownloadedBlock (Rarestblock)=1 that this node has been downloaded.
If 3.6.5 the data downloading upload program of peer node Peer0 judges number of data blocks LeftBlock=to be downloaded 0, illustrate to have downloaded all data blocks, turn the 4th step, continues as other peer nodes and upload data block;Otherwise, to constant pitch The data of point Peer0 are downloaded upload program suspend mode t seconds, are turned 3.6.1 after t seconds intervals, are continued to download remaining data block, join Number t arranges value according to step 3.2.
4th step, each seed node execute data and download upload program.Data are downloaded upload program and are sent out to control node Send file distribution message.Meanwhile the data block of the peer node in data downloading upload program reception system is downloaded and is requested, and to Peer node uploads specified data block.
Specific step is as follows:
The file of one entitled F of the data downloading upload program selection local disk of 4.1 seed node SeedNode0 Seed file, send file distribution message to control node, and transmit the corresponding seed file of file F to control node;
The data block request that the data downloading upload program of 4.2 seed node SeedNode0 persistently monitors peer node disappears Breath reads the number j for the data block that message includes, and selects number for the data block of j from local file, and give by network transmission Correspondent Node.
Above to it is provided by the present invention based on similar documents collaboration BitTorrent data distribution systems and method into It has gone and has been discussed in detail, specific case has been applied in present embodiment, the principle of the present invention and embodiment are explained It states, the above description of the embodiment is only used to help understand the method for the present invention and its core ideas;Meanwhile for this field Those skilled in the art, according to the thought of the present invention, there will be changes in the specific implementation manner and application range, to sum up institute It states, the contents of this specification are not to be construed as limiting the invention.

Claims (8)

1. it is a kind of based on similar documents collaboration BitTorrent data distribution systems, which is characterized in that by a control node, One or more peer nodes, one or more seed nodes are constituted, and each node is independent operating and can mutually carry out net The computer of network communication;
The control node is responsible for interacting with peer node and seed node, is equipped with Data Transmission Controlling in the control node Program, the data transmission control program are used to receive the file distribution message of each seed node, store each seed file The information and all seed files of corresponding seed node and peer node;The data transmission control program is gone back simultaneously The file download request message submitted for receiving each peer node, and selected according to file download request message and transmit one Group possess the seed node of similar documents, one group downloading the peer node of same file and possessing the seed of same file Node is to the peer node for sending file download request message;
Wherein, each peer node is equipped with data downloading upload program, and the data downloading upload program of the peer node is used In sending file download request message to control node, the file download request message includes the title and kind of file to be downloaded Subfile information;Meanwhile the data downloading upload program is also used to read the seed node of control node return, peer node Address information and corresponding seed file, and it is deposited into neighbor node set, then periodically from neighbor node aggregate requests Data block;
Wherein, each seed node is also equipped with data downloading upload program, and the data of the seed node, which are downloaded, to be uploaded Program is used to send file distribution message to the control node, and the file distribution message includes the file that seed node possesses Title and seed file;Meanwhile the data downloading upload program of the seed node is also used to receive the peer node Data block downloading request, and request the number of corresponding data block to select number from file reference numeral position according to data block downloading According to block, and the peer node for requesting downloading data block is transmitted to by network;
Wherein, the peer node is downloading number from the peer node for downloading same file or the seed node for possessing same file When according to block, data block is directly transmitted in the number of local file to Correspondent Node, Correspondent Node is according to the number of requested data block Corresponding data block is transmitted, data block is directly stored in local file according to number by peer node;And peer node is from possessing When the seed node downloading data block of similar documents, peer node sends requested data block in the Position Number of Correspondent Node file To Correspondent Node, Correspondent Node is by corresponding transmission of data blocks to peer node, and last peer node is according to data block in local Data block is stored in corresponding position by the number of file.
2. a kind of BitTorrent data distributing method based on similar documents collaboration, characterized by the following steps:
Step 1, a BitTorrent data distribution systems are constructed, it by a control node, one or more peer node, One or more seed nodes are constituted, and each node is independent operating, the computer that can mutually carry out network communication;
Step 2, control node executes data transmission control program;The data transmission control program is for independently received each The file distribution message of seed node extracts the seed file information that the file distribution message includes, and in memory and disk Store the corresponding all seed node address informations of each seed file;The seed node address information is stored in a dictionary Inside data structure, the dictionary data structure is denoted as seed file dictionary TorrentIndexTable;Secondly, the data Transmission control procedure is also used to the file download request message of independently received each peer node, and extraction document downloading request disappears The seed file for the demand file that breath includes;The seed file packet for the demand file that the extraction document downloading request message includes It includes the seed file information that resolution file downloading request message includes and is marked as torrent1, and from the seed file The seed file phase of selection and peer node demand file in all seed files of dictionary TorrentIndexTable record Like highest k different seed file is spent, the k seed node addresses for possessing corresponding complete file are then selected, are selected simultaneously It selects k2 to download the peer node of same file with the peer node for sending request and possess the seed node of same file, specifically Using the k different seed file inquiry seed file dictionary TorrentIndexTable to obtain corresponding seed section Point;Then these seed files, seed node address and peer node address are asked by network transmission to file download is sent Seek the peer node of message;
Step 3, each peer node executes data and downloads upload program;Data downloading upload program is responsible for requesting to control node Seed node address with similar documents is downloading the peer node address of same file and is possessing the seed of same file Node address, and these node address are stored in neighbor node set;Then, the data of each peer node download upload program To the data block of the corresponding neighbor node request missing of this node;Meanwhile the program receives under the data blocks of other peer nodes Request is carried, and uploads the data block downloaded to corresponding peer node;
Step 4, each seed node executes data and downloads upload program;Data download upload program and send file to control node It gives out information, message includes the file name and corresponding seed file that this section point possesses;Meanwhile data downloading upload program is also The data block of peer node in reception system downloads request, and uploads specified data block to peer node.
3. a kind of BitTorrent data distributing method based on similar documents collaboration according to claim 2, feature It is, one BitTorrent data distribution systems of building in the step 1 specifically:
The control node is responsible for interacting with peer node and seed node, is equipped with Data Transmission Controlling in the control node Program, the data transmission control program are used to receive the file distribution message of each seed node, and store each kind of Ziwen The information and all seed files of the corresponding seed node of part and peer node;The data transmission control program is simultaneously The file download request message that each peer node is submitted also is received, is selected according to the file download request message and transmits one Group possess the seed node of similar documents, one group downloading the peer node of same file and possessing the seed of same file Node is to the peer node for sending file download request message;
Wherein, each peer node is equipped with data downloading upload program, and the data downloading upload program is used to save to control Point sends file download request message, and the file download request message includes the title and seed file letter of file to be downloaded Breath;Meanwhile the data downloading upload program is also used to read the seed node of control node return and peer node address is believed Breath and corresponding seed file, and it is stored in neighbor node set, then periodically from neighbor node aggregate requests data block;
Wherein, each seed node is also equipped with data downloading upload program, and the data of the seed node, which are downloaded, to be uploaded Program is used to send file distribution message to the control node, and the file distribution message includes the file that seed node possesses Title and seed file;Meanwhile the data downloading upload program of the seed node is also used to receive the peer node Data block downloading request requests the number of corresponding data block to select data from file reference numeral position according to data block downloading Block, and it is downloaded into the peer node requested to data block is issued by network transmission.
4. a kind of BitTorrent data distributing method based on similar documents collaboration according to claim 2, feature Be, each peer node in the step 3 execute data downloading upload program specifically includes the following steps:
The data of each peer node of step 3.1 download upload program initialization download process;LeftBlock is set to represent not The quantity of the data block of downloading sets N as the data block total number of file to be downloaded, and the initial value that LeftBlock is arranged is N;Together When, the data downloading upload program is that each neighbor node i of neighborhood safeguards a downloading data block array The length of DownloadedBlock, the data block array DownloadedBlock are gathered around documentary equal to neighbor node i The number of data block;The items of the data block array DownloadedBlock are initialized as 0, if neighbor node i possesses number For the data block of j, then setting i.DownloadedBlock (j)=1, otherwise, setting i.DownloadedBlock (j)= 0;
The data block information that each peer node of step 3.2 was downloaded every the t seconds each neighbor node i of request, more new neighbor section The array of the downloading data block DownloadedBlock of point i;Wherein, t represents the waiting time of downloading data block twice, and t is 0.1 second;
The data of each peer node of step 3.3 download upload program and send file download request message, message to control node Title and corresponding seed file including file to be downloaded;
The data downloading upload program of each peer node of step 3.4 reads the neighbor node address and right that control node returns The seed file answered, and it is stored in neighbor node set;
The each peer node of step 3.5 is denoted as Peer0, and the data downloading upload program of peer node Peer0 is to possess similar text Each seed node of part safeguards that a data block maps array DownloadedSameBlock, minute book node and the seed The identical data block number map information of node;
The each peer node of step 3.6 is denoted as Peer0, and the data downloading upload program of peer node Peer0 is every t seconds from neighbour It occupies node set and downloads a data block, parameter t arranges value according to step 3.2.
5. a kind of BitTorrent data distributing method based on similar documents collaboration according to claim 2, feature It is, it is specifically further comprising the steps of that each seed node in the step 4 executes data downloading upload program:
The text of one entitled F of the data downloading upload program selection local disk of step 4.1 seed node SeedNode0 The seed file of part sends file distribution message to control node, and transmits the corresponding seed file of file F to control node;
The data block request that the data downloading upload program of step 4.2 seed node SeedNode0 persistently monitors peer node disappears Breath reads the number j for the data block that message includes, and selects number for the data block of j from local file, and give by network transmission Correspondent Node.
6. a kind of BitTorrent data distributing method based on similar documents collaboration according to claim 2, feature It is, the step 2 further comprises step in detail below:
The file distribution message of the data transmission control program parsing seed node of step 2.1.1 control node, obtains seed section The title of the address SeedAddress and torrent of point, are denoted as TorrentNAME;
The data transmission control program of step 2.1.2 control node updates seed file dictionary TorrentIndexTable, note The current all seed node address informations of record, i.e. TorrentIndexTable [TorrentNAME]
=TorrentIndexTable [TorrentNAME] ∪ { SeedAddress };
The data transmission control program inquiry seed file dictionary TorrentIndexTable record of step 2.2.1 control node All seed files, calculate seed file dictionary TorrentIndexTable record all seed files and equity The similarity for the seed file that node submits downloading request message to include;If seed file torrent2 is seed file dictionary One in all seed files of TorrentIndexTable record, seed file torrent1 is peer node submission The seed file that demand file download message includes;
The data transmission control program of step 2.2.2 control node arranges all seed files according to the descending of similarity, then Select the maximum k seed file of similarity;Wherein k represents the number of the seed file for similar documents downloading;
A kind of the seed file inquiry k that the data transmission control program of step 2.2.3 control node is selected according to step 2.2.2 Child node address;
The equity of same file is downloaded in data transmission control program selection k2 of step 2.2.4 control node with peer node The address information of node and the seed node for possessing this document, is denoted as SameFileSet;
The data transmission control program of step 2.2.5 control node is by seed set SeedNodeSet and SameFileSet packet The seed node address information and corresponding seed file contained is transferred to other side's peer node.
7. a kind of BitTorrent data distributing method based on similar documents collaboration according to claim 4, feature It is, the step 3.5 further comprises step in detail below:
The data of step 3.5.1 peer node Peer0 are downloaded upload program and are each gathered around from the reading of the neighbor node set of this node Have that the seed node address of similar documents is denoted as SeedNode2 and its corresponding seed file is denoted as torrent2, is SeedNode2 initializes a data block and maps array DownloadedSameBlock, wherein array The length of DownloadedSameBlock is equal to the total number of the data block of peer node Peer0 file to be downloaded, The items of DownloadedSameBlock are initialized as 0;
The data downloading upload program of step 3.5.2 peer node Peer0 calculates the cryptographic Hash collection of the data block of file to be downloaded The intersection SameBlocks of the data block hash value collection S2 of the seed node SeedNode2 of S1 and step 3.5.1 selection is closed, i.e., SameBlocks=j | j ∈ S1 ∧ j ∈ S2 };
The data downloading upload program of step 3.5.3 peer node Peer0 reads each data block of set SameBlocks Cryptographic Hash is in the number of the file of seed node SeedNode2 if number of the data block in the file of this node is j J2, then updating the corresponding data block of neighbor node SeedNode2 maps array DownloadedSameBlock (j)=j2.
8. a kind of BitTorrent data distributing method based on similar documents collaboration according to claim 7, feature It is, the step 3.6 further comprises step in detail below:
The data downloading upload program of step 3.6.1 peer node Peer0 selects the least data block of neighbor node copy number;
The data downloading upload program judgement of step 3.6.2 peer node Peer0: if number is Rarestblock data block pair The neighbor node answered is identical with this node file to be downloaded, then the program sends a data block request to the neighbor node Message, message include the number Rarestblock of data block;
If step 3.6.3 step 3.6.2 judges invalid, i.e., number is Rarestblock data block corresponding neighbor node note It is not same file for Z and this node file to be downloaded, then the data downloading upload program of peer node Peer0 calculates The data block neighbor node Z number j2, and to neighbor node Z request number be j2 data block,
Number of data blocks LeftBlock=to be downloaded is arranged in the data downloading upload program of step 3.6.4 peer node Peer0 LeftBlock-1 updates the data block coding number group DownloadedBlock (Rarestblock)=1 that this node has been downloaded;
If the data downloading upload program of step 3.6.5 peer node Peer0 judges number of data blocks LeftBlock=to be downloaded 0, illustrate to have downloaded all data blocks, go to step 4, continues as other peer nodes and upload data block;Otherwise, to constant pitch The data of point Peer0 are downloaded upload program suspend mode t seconds, are gone to step 3.6.1 after t seconds intervals, are continued to download remaining data Block, parameter t value are identical as step 3.2;
The step 3.6.1 further comprises step in detail below:
The data downloading upload program of step 3.6.1.1 peer node Peer0 calculates neighbor node set downloading data block Copy number, the copy number of each data block are equal to the sum for possessing all neighbor nodes of the data block;Setting SameSet representative is downloading the peer node of same file and is possessing the seed node of same file, sets SimilarSet All seed nodes for possessing similar documents are represented, then the copy sum for the data block that number is j is equal to be gathered around in SameSet set There is the number of the neighbor node of the data block and possesses it of the number of the neighbor node of the data block in SimilarSet set With i.e. ∑i∈SameSeti.DownloadedBlock(j)+∑k∈SimilarSetK.E (j), wherein ∑i∈ SameSetI.DownloadedBlock (j), which is represented, possesses the number of the neighbor node of the data block in SameSet set, ∑k∈SimilarSetK.E (j), which is represented, possesses the number of the neighbor node of the data block in SimilarSet set, wherein I.DownloadedBlock (j)=1 represents node i and has downloaded data block j, and E (j) represents whether k possesses data block j: if k is gathered around There are the data block, i.e. DownloadedSameBlock (j) ≠ 0, then setting k.E (j)=1;Otherwise, if DownloadedSameBlock (j)=0, then setting k.E (j)=0;
The data downloading upload program of step 3.6.1.2 peer node Peer0 is by the copy number of each data block according to ascending order Then arrangement selects the corresponding data block of header element of arrangement as the least data block of copy number, remembers that its number is Rarestblock;
The step 3.6.3 further comprises step in detail below:
The data block of the data downloading upload program inquiry neighbor node Z of step 3.6.3.1 peer node Peer0 maps array DownloadedSameBlock obtains the number j2, i.e. j2=for numbering the data block for being Rarestblock in neighbor node Z Z.DownloadedSameBlock(Rarestblock);
The data downloading upload program of step 3.6.3.2 peer node Peer0 sends data block request message to neighbor node Z, Message includes the number j2 of data block;
It is j2's that the data downloading upload program of step 3.6.3.3 peer node Peer0, which receives the number of neighbor node Z transmission, After data block, by the Rarestblock block of data block storage to file to be downloaded.
CN201611144224.5A 2016-12-13 2016-12-13 A kind of BitTorrent data distribution systems and method based on similar documents collaboration Active CN106487931B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611144224.5A CN106487931B (en) 2016-12-13 2016-12-13 A kind of BitTorrent data distribution systems and method based on similar documents collaboration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611144224.5A CN106487931B (en) 2016-12-13 2016-12-13 A kind of BitTorrent data distribution systems and method based on similar documents collaboration

Publications (2)

Publication Number Publication Date
CN106487931A CN106487931A (en) 2017-03-08
CN106487931B true CN106487931B (en) 2019-05-24

Family

ID=58284722

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611144224.5A Active CN106487931B (en) 2016-12-13 2016-12-13 A kind of BitTorrent data distribution systems and method based on similar documents collaboration

Country Status (1)

Country Link
CN (1) CN106487931B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108710618B (en) * 2017-04-05 2022-02-22 郑州芯兰德网络科技有限公司 Propagation seed node selection method based on concurrent process and influence expectation
CN109144639B (en) * 2018-08-07 2021-09-07 武汉斗鱼网络科技有限公司 Bullet screen message distribution method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101136911A (en) * 2006-08-31 2008-03-05 腾讯科技(深圳)有限公司 Method to download files using P2P technique and P2P download system
CN101166190A (en) * 2007-09-20 2008-04-23 腾讯科技(深圳)有限公司 Video/audio file multi-source download method and device
CN101212646A (en) * 2006-12-31 2008-07-02 中国科学院声学研究所 System and method for implementing video-on-demand with peer-to-peer network technique
CN101588353A (en) * 2008-05-21 2009-11-25 闪联信息技术工程中心有限公司 Method, system and equipment for sharing files
CN102355448A (en) * 2011-06-29 2012-02-15 北京原力创新科技有限公司 Cloud streaming media data transmission method and system
CN103281382A (en) * 2013-05-31 2013-09-04 合一网络技术(北京)有限公司 Method and node for file transfer based on p2p
CN103685496A (en) * 2013-12-06 2014-03-26 华为技术有限公司 Transmission method and device of file data

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101136911A (en) * 2006-08-31 2008-03-05 腾讯科技(深圳)有限公司 Method to download files using P2P technique and P2P download system
CN101212646A (en) * 2006-12-31 2008-07-02 中国科学院声学研究所 System and method for implementing video-on-demand with peer-to-peer network technique
CN101166190A (en) * 2007-09-20 2008-04-23 腾讯科技(深圳)有限公司 Video/audio file multi-source download method and device
CN101588353A (en) * 2008-05-21 2009-11-25 闪联信息技术工程中心有限公司 Method, system and equipment for sharing files
CN102355448A (en) * 2011-06-29 2012-02-15 北京原力创新科技有限公司 Cloud streaming media data transmission method and system
CN103281382A (en) * 2013-05-31 2013-09-04 合一网络技术(北京)有限公司 Method and node for file transfer based on p2p
CN103685496A (en) * 2013-12-06 2014-03-26 华为技术有限公司 Transmission method and device of file data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于 P2P- BitTorrent 协议文件共享系统的研究与实现;孟菲;《中国优秀硕士学位论文全文数据库 信息科技辑》;20110315(第3期);正文第35-38页

Also Published As

Publication number Publication date
CN106487931A (en) 2017-03-08

Similar Documents

Publication Publication Date Title
US9037657B2 (en) Systems and methods for peer-to-peer bandwidth allocation
JP4490743B2 (en) File sharing system, file sharing management server and client device
JP4938074B2 (en) Resource location information request method, user node and server for the method
US20080040420A1 (en) Content distribution network
CN106576078A (en) Method and system for routing data flows in a cloud storage system
CN105830419B (en) It is prioritized the peer-to-peer network of propagation of the object by network
JP4473942B2 (en) Content distribution apparatus, content distribution method, and content distribution program
CN101356769A (en) Peer-to-peer message format data structure
CN102223411A (en) Method and system for downloading file by adopting P2P (Peer-to-Peer) technology and client side
CN104967677B (en) A kind of document transmission method and device based on NDN cache optimization
CN102420864B (en) Massive data-oriented data exchange method
CN113453038A (en) Effectiveness optimal collaborative cache management method under CDN-P2P hybrid architecture
CN106487931B (en) A kind of BitTorrent data distribution systems and method based on similar documents collaboration
CN101772936B (en) Method and system for data management in communication networks
US20090192999A1 (en) Search service providing system and search service providing method
WO2008017502A1 (en) Content distribution network
KR101055265B1 (en) Apparatus and method for providing P2P services, and a recording medium for causing a computer to execute a method for exchanging data in a peer node constituting a P2P network
CN100474809C (en) File transfer method and apparatus
Liu et al. Efficient resource discovery in self‐organized unstructured peer‐to‐peer networks
WO2014075426A1 (en) Data updating method and web server
WO2009125760A1 (en) Content distribution system and content distribution method used for the same
CN109543123A (en) A kind of short network address generation method, device, system, equipment and readable storage medium storing program for executing
CN105072159A (en) Node management list structure in P2P networking and management method thereof
CN115022660A (en) Parameter configuration method and system for content distribution network
CN103024009A (en) Electronic book data updating method based on peer-to-peer network transmission

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CB03 Change of inventor or designer information

Inventor after: Fu Yongquan

Inventor after: Wei Lichao

Inventor after: Liu Feng

Inventor after: Peng Yuxing

Inventor after: Li Dongsheng

Inventor before: Fu Yongquan

Inventor before: Wei Lichao

Inventor before: Liu Feng

Inventor before: Peng Yuxing

Inventor before: Li Dongsheng

CB03 Change of inventor or designer information