WO2012142844A1 - P2p-based file distribution system and slicing method - Google Patents

P2p-based file distribution system and slicing method Download PDF

Info

Publication number
WO2012142844A1
WO2012142844A1 PCT/CN2011/084210 CN2011084210W WO2012142844A1 WO 2012142844 A1 WO2012142844 A1 WO 2012142844A1 CN 2011084210 W CN2011084210 W CN 2011084210W WO 2012142844 A1 WO2012142844 A1 WO 2012142844A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
node
level
fragment
size
Prior art date
Application number
PCT/CN2011/084210
Other languages
French (fr)
Chinese (zh)
Inventor
季健
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2012142844A1 publication Critical patent/WO2012142844A1/en

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/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • H04L67/108Resource delivery mechanisms characterised by resources being split in blocks or fragments

Definitions

  • the invention belongs to the peer-to-peer (P2P) technology, and specifically relates to a P2P-based file distribution system and a fragmentation method.
  • P2P peer-to-peer
  • a P2P network is a network architecture in which resources are distributed and shared.
  • each node is peer-to-peer, that is, each node can be either a client or a server.
  • the P2P network solves the problems of network congestion and server bandwidth bottlenecks by distributing the service functions originally completed on the centralized server to the client.
  • P2P file distribution uses a fragmentation method for data interaction, that is, dividing a file into a plurality of data blocks of the same length or different length, and then transmitting the data in units of data blocks.
  • the sharding is a calculation method.
  • the file distribution system can calculate which position of the first shard of a file is in the file, so that when the data is replied, the location can be calculated at the calculated position.
  • the fragmented data of the required size is read out for reply.
  • the size of the fragmentation of the current P2P download system is fixed, and the fragmentation size of the file distribution system is also fixed.
  • the fragmentation method adopts a three-level fragmentation method, and the specific fragmentation method is as follows:
  • a file is divided into segments, and the segment is a first-level fragmentation.
  • the size of the current system middle segment is fixed, which can be 4M.
  • the segment is further fragmented, which is a secondary fragment, and the secondary fragment is a file.
  • the unit shared by the distribution system client that is, only the file distribution system client downloads a complete secondary fragment, and this part of the data can be shared and shared.
  • the size of the secondary fragment in the system is fixed. It is 16KB; then, based on the secondary fragmentation, three-level fragmentation is performed.
  • the third-level fragmentation is the transmission unit of the file distribution system client when performing data interaction.
  • the size of the system's three-level fragmentation is fixed. Specifically, it can be 1KB.
  • the file distribution system also establishes corresponding index information while establishing the fragmentation, and the index information indicates the fragmentation of a file.
  • the index information indicates the fragmentation of a file.
  • the index information is binary data. Each bit of data indicates whether the corresponding fragment exists. A value of 1 indicates that the corresponding fragment exists, and a value of 0 indicates that the corresponding fragment does not exist.
  • the fragmentation is too small, it is beneficial to the data sharing between the service nodes, but the index information occupies more bytes. Excessive index information will consume a certain amount of bandwidth when transmitted between networks; If the fragmentation is relatively thick, it will affect the data sharing between the service nodes, because only the corresponding bit of the index information is 1, the data can be shared externally.
  • the main download is a large number of small files, and in the distribution of media files of the Content Delivery Network (CDN), the main download is It is a relatively large video file; using a fixed fragmentation method for files of different sizes will reduce network utilization.
  • the data transmission uses the UDP protocol. Due to the limitation of the MTU, the current data transmission unit of the system is 1 KB, so that the fixed-size transmission unit cannot adapt to the dynamic change of the network bandwidth. When the network bandwidth is relatively good, The size of 1KB is suitable, and in the case of large fluctuations in network bandwidth, the size of 1KB may cause packet loss or congestion of network transmission, which reduces transmission efficiency. Summary of the invention
  • the technical problem to be solved by the present invention is to provide a fragmentation method for a P2P-based file distribution system, which can dynamically adjust the size of a data transmission level fragment according to a change in network bandwidth, since the transmission level fragmentation is The unit of transmission when data is exchanged, thus improving the efficiency of data transmission.
  • the invention provides a P2P-based file distribution system, which can dynamically adjust the size of a data transmission unit according to changes in network bandwidth, thereby improving data transmission efficiency.
  • the present invention provides a method for sharding a P2P-based file distribution system, the method comprising: sharding a file to be downloaded in a file distribution process, where the shard includes a shared shard and a transport shard. And the last level fragment is a transport level fragment, wherein the size of the transport level fragment is dynamically adjusted according to the network resource status between the local node and the service node during transmission.
  • the size of the shared-level fragment is determined according to the file size range corresponding to the size of the file to be downloaded.
  • the network resource status between the local node and the serving node includes: one or more pieces of information of the amount of interaction data, the packet loss rate, and the delay size between the local node and the serving node in a period of time.
  • the present invention also provides a file downloading method of a P2P-based file distribution system, the method comprising the following steps:
  • the local node fragments the file to be downloaded, and establishes index information of the file to be downloaded, and the index information of the file to be downloaded includes index information of each fragment obtained by the fragment, and each level index
  • the information includes the fragmentation location information of the corresponding segment, where the fragment includes a shared-level fragment and a transport-level fragment, and the initial size of the transport-level fragment is a default value;
  • the local node After the local node requests the server to download the node information, the local node determines the download node corresponding to the shared-level fragment of the file to be downloaded;
  • the local node sends a download request for the shared-level shard to the determined download node, where the index information of the shared-level shard that needs to be downloaded from the download node and the size of the determined transport-level shard are included, and are
  • the network resource status between the service nodes dynamically adjusts the size of the transport level fragment;
  • the local node saves the file data after receiving the data replied by the download node.
  • the network resource status between the local node and the service node includes: the amount of interaction data, the packet loss rate, and the delay size between the local node and the service node in a period of time.
  • One or more messages are included in the network resource status between the local node and the service node.
  • the size of the shared-level fragment is determined according to the file size range corresponding to the size of the file to be downloaded.
  • the invention also provides a P2P-based file distribution system, the system comprising:
  • the local node performs the P2P file downloading, and the file to be downloaded is fragmented, and the index information of the file to be downloaded is established, and the index information of the file to be downloaded includes index information of each fragment obtained by the fragment, each level.
  • the index information includes fragmentation location information of the corresponding segment, the fragment includes a shared-level fragment and a transport-level fragment, and the size of the transport-level fragment is an initial default value; and then the server is requested to download the node information, and after receiving the reply, Sending a download request for the shared-level shard to the determined download node, where the download request includes the index information of the shared-level shard that needs to be downloaded from the download node, and the size of the determined transport-level shard, during the transmission process. Dynamically adjusting a size of the transport level fragment according to a network resource status between the serving node; receiving data replied by the download node;
  • a server providing index information and data information to the local node; after receiving the download node request of the local node, providing download node information to the local node;
  • the download node provides file data to the local node according to the download request for the shared-level shard sent by the local node.
  • the size of the shared-level fragment is determined according to the file size range corresponding to the size of the file to be downloaded.
  • the index information is saved in the local node and the server.
  • the network resource status between the local node and the service node includes: one or more pieces of information about the amount of interaction data, the packet loss rate, and the delay size between the local node and the serving node in a period of time.
  • the download node is a service node or a server.
  • the download node is a server or a service node.
  • the P2P-based file distribution system and the fragmentation method provided by the invention can dynamically adjust the size of the data transmission unit according to the change of the network bandwidth during the downloading process, so as to ensure that the transmission performance of the file distribution system can adapt to the change of the network bandwidth, thereby Improve the efficiency of data transmission and expand the scope of application of file distribution systems.
  • FIG. 1 is a schematic diagram of a three-level adaptive fragmentation method according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of a four-level adaptive fragmentation method according to an embodiment of the present invention.
  • FIG. 3 is a flowchart of a file downloading method of a P2P-based file distribution system according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of the overall architecture of a file distribution system according to an embodiment of the present invention. detailed description
  • the present invention provides a method for sharding a P2P-based file distribution system, the method comprising: sharding a file to be downloaded in a file distribution process, where the shard includes a shared shard and a transport shard.
  • the last shard is a transport shard, wherein the size of the transport shard is dynamically adjusted according to the network resource status between the local node and the serving node during the transmission; specifically, the local node and the service
  • the network resource status between the nodes includes: one or more pieces of information such as the amount of interaction data, the packet loss rate, and the delay size between the local node and the service node in a period of time, when the file to be downloaded is initially fragmented, according to The file size range corresponding to the size of the download file determines the size of the shared-level shard, and the size of the transport-level shard is initially the default.
  • a three-level fragmentation method is used to determine the size of the first and second fragments according to the file size, and the first and second fragments are shared-level fragments.
  • the second-level fragment is used as the data sharing unit for data interaction between nodes
  • the third-level fragment is The transmission level fragmentation is the transmission unit when the data is transmitted between the nodes.
  • the size of the third-level fragment is the default value, which can be 1 KB. During the transmission process, the size of the third-level fragment can be dynamically changed according to the network status. Adjustment.
  • the specific fragmentation method is as follows:
  • the first level of fragmentation and the second level of fragmentation are as follows:
  • the size of the segment 11 into which the first-stage fragment is divided is 4M
  • the size of the block 12 into which the second-stage fragment is divided into 16 KB is 16 KB
  • the file size is between 4MB and 12MB
  • the segment size is 3MB
  • the block size is 16KB.
  • the file size is between 2MB and 4MB
  • the segment size is 2MB
  • the block size is 8KB.
  • the size of the segment 11 is 1MB
  • the size of the block 12 is 4KB.
  • the segment 11 size is 1MB
  • the block 12 size is 2KB.
  • the size of the third-level fragment 13 is an integer multiple of 64 bytes, and may be 1 KB or 512 bytes.
  • the transmission unit is up to 1 KB and the minimum is 64 bytes.
  • the index information corresponding to the file is established at the same time as the three-level fragmentation of the file, and the index information is also divided into three levels, and the information of each level indicates the position information of the corresponding level of the fragment as the present invention provides
  • a four-level fragmentation method is adopted.
  • the fragmentation method determines the size of the first, second, and third fragments according to the file size, and the first, second, and third-level fragments are shared. Fragmentation, where the secondary fragment is used as the data sharing unit for data exchange between nodes, the fourth fragment is the transmission level fragmentation, and the fourth fragment is the transmission unit when the data is transmitted between the nodes.
  • the size of the fourth-level fragment is the initial default value, which can be 1 KB.
  • the size of the fourth-level fragment can be dynamically adjusted according to the network status during the transmission process.
  • the first level of fragmentation and the second level of fragmentation are as follows:
  • the size of the segment 21 into which the first-stage fragment is divided is 4M
  • the size of the block 22 into which the second-level fragment is divided into 16 KB is 16 KB
  • the file size is between 4MB and 12MB
  • the segment 21 size is 3MB
  • the block 22 size is 16KB.
  • the size of segment 21 is 2MB
  • the size of block 22 is 8KB.
  • the size of the segment 21 is 1MB
  • the size of the block 22 is 4KB.
  • the segment 21 size is 1MB
  • the block 22 size is 2KB.
  • the size of the third stage fragment 23 is fixed to 1 KB;
  • the fourth-level fragment 24 is further subdivided on the basis of the transmission unit of the third-level fragment 1 KB, and its size is an integer multiple of 64 bytes, which may be 1 KB, 512 bytes, 256 bytes, 128 bytes. , 64 bytes, etc.; Since the four-level fragmentation is the transmission unit for data interaction, the transmission unit is up to 1 KB and the minimum is 64 bytes.
  • the index information corresponding to the file is established, and the index information is also divided into four levels, which respectively represent the location information of the fragment of the corresponding level, that is, how many segments are divided into the file, and each segment is divided into How many blocks, the size of the last piece of the last piece, and so on.
  • the same index information is maintained in the file distribution system and the file distribution system DTS-S-SP; since the file is larger than 12 MB, the level is The fragment size is divided into 4 MB. It can be seen that the file is divided into 6 segments in the index information, and the block size is divided into 16 KB. The first 5 segments of the index information respectively contain 256 blocks. The last segment contains 33 blocks, and the last block of the last segment has a size of 10.14 KB.
  • the present invention also provides a file downloading method of a P2P-based file distribution system. As shown in FIG. 3, the method includes the following steps:
  • Step 301 start;
  • Step 302 The local node obtains a download instruction.
  • Step 303 The local node applies to the server for the file attribute information of the file to be downloaded, and the file attribute information may be the CID and the file size information of the file.
  • the file to be downloaded is fragmented according to the file to be downloaded.
  • the size of the file size corresponding to the size determines the size of the shared-level shard, the default setting of the size of the transport-level shard, and the corresponding index information is saved;
  • the sharing level fragmentation may be performed according to the size of the file to be downloaded, as described in the first embodiment, that is, the sharing level fragment may be implemented as the first level fragment and the second layer fragment described in the first embodiment.
  • the third-level fragment described in the first example is a transport-level fragment, and its initial default value is set to 1 KB, which can be adjusted according to the network state during transmission;
  • the sharing level fragmentation may be performed according to the size of the file to be downloaded, as described in the second embodiment, that is, the sharing level fragment may be the first level fragment, the second level fragment, and the third level described in the second embodiment.
  • Fragmentation, and the four-stage fragment described in the second embodiment is a transport-level fragment, and its initial default value is set to 1 KB, which can be adjusted according to the network state during transmission.
  • Step 304 After the local node applies to the server to download the node information, the download node corresponding to the shared-level fragment of the file to be downloaded is determined, where the shared-level fragment may be the second-level fragment described in the first embodiment.
  • the two-stage fragmentation described in the second embodiment may be used.
  • the download node may be a service node or a server.
  • Step 305 The local node sends a download request for the shared-level fragment to the determined download node, and determines a transmission unit size, that is, a size of the transport-level fragment, according to a network resource status between the local node and the download node.
  • the local node requests the file CID, the segment number, when requesting data from the download node.
  • Block number, slice number, offset from the slice, the number of bytes to be read, the number of bytes is specifically
  • the network resource status refers to one or more pieces of information about the amount of interaction data, the packet loss rate, and the delay size between the local node and the download node in a period of time; preferably, the period of time may be 5s;
  • the initial default size of the shard is 1 KB, so the initial default value of the transmission unit is 1 KB.
  • the size of the transmission shard is always 64-byte integer multiple, the minimum is 64 bytes, the maximum is 1KB;
  • the transmission level fragmentation may be the third level fragment described in the first embodiment, or may be the fourth level fragment described in the second embodiment.
  • Step 306 The download node sends a data reply to the local node. Specifically, when replying the data, the file CID, the segment number, the block number, the fragment number, the offset with respect to the fragment, the number of bytes of the shared data, and Actual file data;
  • Step 307 After receiving the data replied by the download node, the local node writes the actual file data into the corresponding memory location, and sets the corresponding index information. When the lowest level index information is filled in, Then set the upper level index;
  • Step 308 If the corresponding data is received, the corresponding location index is set. If the shared-level data block index is set to 0, then step 305 is continued until the lowest-level fragment data index of the shared-level fragment is set to 1 o'clock, continue to step 309;
  • the fourth level index is set, that is, The corresponding four-level index position is set to 1.
  • the three-level index position is set until the secondary fragment data is filled, and the secondary index is set until the second level.
  • the index position is set to 1, the data transmission ends, the data The blocks can be shared externally.
  • Step 309 End the data transmission.
  • the present invention also provides a P2P-based file distribution system, which includes:
  • the local node performs the P2P file downloading, and the file to be downloaded is fragmented, and the index information of the file to be downloaded is established, and the index information of the file to be downloaded includes index information of each fragment obtained by the fragment, each level.
  • the index information includes fragmentation location information of the corresponding segment, the fragment includes a shared-level fragment and a transport-level fragment, and the size of the transport-level fragment is an initial default value; and then the server is requested to download the node information, and after receiving the reply, Sending a download request for the shared-level shard to the determined download node, where the download request includes the index information of the shared-level shard that needs to be downloaded from the download node, and the size of the determined transport-level shard, during the transmission process. Dynamically adjusting the size of the transport level fragment according to a network resource condition between the serving node; receiving data replied by the download node.
  • a server providing index information and data information to the local node; after receiving the download request of the local node, providing the download information to the local node;
  • the server may include the following three modules:
  • the content management module DTS-S-SM monitors related directories on the library, monitors the addition and deletion of files in real time, and notifies the node of the index module file changes;
  • the node indexing module DTS_S_RM provides node index information, that is, which download nodes the files to be downloaded are respectively, and the download node includes a server and a service node.
  • the node indexing module is configured to provide CID and file size information of the file to be downloaded according to the request of the local node, and provide the service node with a shared-level fragment corresponding to the file to be downloaded according to the request of the local node. Download node information;
  • the static node module DTS_S_SP receives the online message of the node indexing module and returns the data to the local node according to the download request for the shared-level fragment sent by the local node.
  • the downloading node provides the file data to the local node according to the download request for the shared-level fragment sent by the local node.
  • the download node may be a service node or a static node module DTS-S-SP.
  • the fragmentation method of the P2P-based file distribution system proposed by the present invention can adaptively perform fragmentation adjustment according to the size of the file to be downloaded, so that files of different sizes can obtain similar P2P distribution performance, and can be downloaded.
  • the size of the data transmission unit is dynamically adjusted according to the change of the network bandwidth, so as to ensure that the transmission performance of the file distribution system can adapt to changes in the network bandwidth, thereby improving the performance of data transmission.

Abstract

The present invention provides a P2P-based file distribution system and a slicing method. In a file distribution process, the adaptive slicing method slices a file to be downloaded, a slice in a last level being a transmission-level slice. The size of the transmission-level slice is dynamically adjusted according to a network resource condition between a local node and a serving node, so as to ensure that the transmission performance of the file distribution system is adaptive to the change of the network bandwidth, thereby improving the data transmission efficiency and expanding the application scope of the file distribution system.

Description

一种基于 P2P的文件分发系统及分片方法 技术领域  P2P-based file distribution system and fragmentation method
本发明属于点对点 (P2P, Peer to Peer )技术领或, 具体涉及一种基于 P2P的文件分发系统及分片方法。 背景技术  The invention belongs to the peer-to-peer (P2P) technology, and specifically relates to a P2P-based file distribution system and a fragmentation method. Background technique
P2P网络是一种资源分布利用与共享的网络体系架构, 在进行通信时, 各个节点之间是对等的, 即每一个节点既可以是客户端, 也可以是服务器。 P2P网络通过将原本在集中式服务器完成的服务功能分散到用户端完成,解 决网络拥塞和服务器带宽瓶颈等问题。 P2P文件分发采用了分片的方法来进 行数据交互, 也就是将文件划分为许多长度相同或者不同的数据块, 然后 以数据块为单位进行传输。 所述分片是一种计算方法, 根据该计算方法, 文件分发系统能够计算出一个文件的第几个分片在文件的哪个位置, 这样 在回复数据时就可以到计算出的位置处将所需大小的分片数据读取出来用 于回复。 目前的 P2P下载系统的分片的大小是固定的, 文件分发系统的分 片大小也是固定的, 在文件分发系统中, 分片方法采用了三级的分片方法, 具体分片方法如下:  A P2P network is a network architecture in which resources are distributed and shared. When communicating, each node is peer-to-peer, that is, each node can be either a client or a server. The P2P network solves the problems of network congestion and server bandwidth bottlenecks by distributing the service functions originally completed on the centralized server to the client. P2P file distribution uses a fragmentation method for data interaction, that is, dividing a file into a plurality of data blocks of the same length or different length, and then transmitting the data in units of data blocks. The sharding is a calculation method. According to the calculation method, the file distribution system can calculate which position of the first shard of a file is in the file, so that when the data is replied, the location can be calculated at the calculated position. The fragmented data of the required size is read out for reply. The size of the fragmentation of the current P2P download system is fixed, and the fragmentation size of the file distribution system is also fixed. In the file distribution system, the fragmentation method adopts a three-level fragmentation method, and the specific fragmentation method is as follows:
首先一个文件被分成段, 段为一级分片, 目前的系统中段的大小是固 定的, 具体可以为 4M; 其次是将段再进行分片, 为二级分片, 二级分片是 文件分发系统客户端共享的单位, 即只有文件分发系统客户端下载完一个 完整的二级分片, 才可以将这部分数据对外提供共享, 目前系统中二级分 片的大小是固定的, 具体可以为 16KB; 然后在二级分片的基础上再进行三 级分片, 三级分片是文件分发系统客户端在进行数据交互时的传输单位, 目前系统的三级分片的大小是固定的, 具体可以为 1KB。 文件分发系统建立分片的同时也建立了对应的索引信息, 索引信息表 示一个文件的分片情况。 文件分发系统客户端在进行文件数据共享时, 共 享的双方通过索引信息交互知道对端是否存在自身所需要的数据。 索引信 息为二进制数据, 每一位数据都表示相应的分片是否存在, 为 1 表示相应 的分片存在, 为 0表示相应的分片不存在。 First, a file is divided into segments, and the segment is a first-level fragmentation. The size of the current system middle segment is fixed, which can be 4M. Secondly, the segment is further fragmented, which is a secondary fragment, and the secondary fragment is a file. The unit shared by the distribution system client, that is, only the file distribution system client downloads a complete secondary fragment, and this part of the data can be shared and shared. Currently, the size of the secondary fragment in the system is fixed. It is 16KB; then, based on the secondary fragmentation, three-level fragmentation is performed. The third-level fragmentation is the transmission unit of the file distribution system client when performing data interaction. Currently, the size of the system's three-level fragmentation is fixed. Specifically, it can be 1KB. The file distribution system also establishes corresponding index information while establishing the fragmentation, and the index information indicates the fragmentation of a file. When the file distribution system client performs file data sharing, the shared parties interact through the index information to know whether the peer has the data it needs. The index information is binary data. Each bit of data indicates whether the corresponding fragment exists. A value of 1 indicates that the corresponding fragment exists, and a value of 0 indicates that the corresponding fragment does not exist.
如果分片划分得过小, 虽然有利于服务节点之间的数据共享, 但会导 致索引信息所占用字节数比较多, 过多的索引信息在网络之间传输会占用 消耗一定的带宽; 而如果将分片划分得比较粗, 则会影响服务节点之间的 数据共享, 因为只有索引信息相对应的位为 1时, 该数据才能够对外共享。 在有些应用中, 比如电子节目菜单( EPG, Electronic Program Guide ) 的内 容同步中, 主要下载的是大量小文件, 而在内容分发网络(CDN, Content Delivery Network ) 的媒体文件分发中, 主要下载的是比较大的视频文件; 针对不同大小的文件采用固定的分片方法, 会降低网络利用率。  If the fragmentation is too small, it is beneficial to the data sharing between the service nodes, but the index information occupies more bytes. Excessive index information will consume a certain amount of bandwidth when transmitted between networks; If the fragmentation is relatively thick, it will affect the data sharing between the service nodes, because only the corresponding bit of the index information is 1, the data can be shared externally. In some applications, such as the content synchronization of the Electronic Program Guide (EPG), the main download is a large number of small files, and in the distribution of media files of the Content Delivery Network (CDN), the main download is It is a relatively large video file; using a fixed fragmentation method for files of different sizes will reduce network utilization.
在文件分发系统的系统中数据传输采用的是 UDP协议, 由于 MTU的 限制, 目前系统的数据传输单位为 1KB, 这样固定大小的传输单位无法适 应网络带宽的动态变化, 在网络带宽比较好时, 1KB 的大小比较合适, 而 在网络带宽波动比较大的情况下, 1KB 的大小可能会导致丟包或者造成网 络传输的拥塞, 降低了传输效率。 发明内容  In the system of the file distribution system, the data transmission uses the UDP protocol. Due to the limitation of the MTU, the current data transmission unit of the system is 1 KB, so that the fixed-size transmission unit cannot adapt to the dynamic change of the network bandwidth. When the network bandwidth is relatively good, The size of 1KB is suitable, and in the case of large fluctuations in network bandwidth, the size of 1KB may cause packet loss or congestion of network transmission, which reduces transmission efficiency. Summary of the invention
本发明要解决的技术问题是提供一种基于 P2P的文件分发系统的分片 方法, 该分片方法能够根据网络带宽的变化来动态调整数据传输级分片的 大小, 由于该传输级分片为数据交互时的传输单位, 因此能够提高数据传 输的效率。  The technical problem to be solved by the present invention is to provide a fragmentation method for a P2P-based file distribution system, which can dynamically adjust the size of a data transmission level fragment according to a change in network bandwidth, since the transmission level fragmentation is The unit of transmission when data is exchanged, thus improving the efficiency of data transmission.
本发明提供一种基于 P2P的文件分发系统, 该系统能够根据网络带宽 的变化动态调整数据传输单位的大小, 从而提高数据传输的效率。 本发明提供一种基于 P2P的文件分发系统的分片方法, 该方法包括: 在文件分发过程中, 将待下载的文件进行分片, 所述分片包括共享级 分片和传输级分片, 且最后一级分片为传输级分片, 其中, 在传输过程中 根据本地节点与服务节点之间的网络资源状况动态调整所述传输级分片的 大小。 The invention provides a P2P-based file distribution system, which can dynamically adjust the size of a data transmission unit according to changes in network bandwidth, thereby improving data transmission efficiency. The present invention provides a method for sharding a P2P-based file distribution system, the method comprising: sharding a file to be downloaded in a file distribution process, where the shard includes a shared shard and a transport shard. And the last level fragment is a transport level fragment, wherein the size of the transport level fragment is dynamically adjusted according to the network resource status between the local node and the service node during transmission.
在上述方案中, 将对待下载的文件进行分片时, 根据所述待下载文件 的大小对应的文件大小范围确定所述共享级分片的大小。  In the above solution, when the file to be downloaded is fragmented, the size of the shared-level fragment is determined according to the file size range corresponding to the size of the file to be downloaded.
在上述方案中, 所述本地节点与服务节点之间的网络资源状况包括: 一段时间内所述本地节点与服务节点间的交互数据量、 丟包率和延时大小 中一个或多个信息。  In the above solution, the network resource status between the local node and the serving node includes: one or more pieces of information of the amount of interaction data, the packet loss rate, and the delay size between the local node and the serving node in a period of time.
本发明还提供一种基于 P2P的文件分发系统的文件下载方法, 该方法 包括以下步驟:  The present invention also provides a file downloading method of a P2P-based file distribution system, the method comprising the following steps:
本地节点在进行 P2P文件下载时, 将待下载的文件进行分片, 建立该 待下载文件的索引信息, 所述待下载文件的索引信息包括分片得到的各级 片段的索引信息, 每级索引信息包括对应片段的分片位置信息, 所述分片 包括共享级分片及传输级分片, 且传输级分片的初始大小为默认值;  When the P2P file is downloaded, the local node fragments the file to be downloaded, and establishes index information of the file to be downloaded, and the index information of the file to be downloaded includes index information of each fragment obtained by the fragment, and each level index The information includes the fragmentation location information of the corresponding segment, where the fragment includes a shared-level fragment and a transport-level fragment, and the initial size of the transport-level fragment is a default value;
本地节点向服务器申请到下载节点信息后, 确定待下载文件的共享级 分片所对应的下载节点;  After the local node requests the server to download the node information, the local node determines the download node corresponding to the shared-level fragment of the file to be downloaded;
本地节点向确定的下载节点发送针对共享级分片的下载请求, 其中含 有需要从该下载节点下载的共享级分片的索引信息以及确定的传输级分片 的大小, 并且在传输过程中根据与服务节点间的网络资源状况动态调整传 输级分片的大小;  The local node sends a download request for the shared-level shard to the determined download node, where the index information of the shared-level shard that needs to be downloaded from the download node and the size of the determined transport-level shard are included, and are The network resource status between the service nodes dynamically adjusts the size of the transport level fragment;
本地节点收到下载节点回复的数据后将文件数据保存。  The local node saves the file data after receiving the data replied by the download node.
在上述方案中, 所述本地节点与服务节点间的网络资源状况包括: 一 段时间内所述本地节点与服务节点间的交互数据量、 丟包率和延时大小中 一个或多个信息。 In the above solution, the network resource status between the local node and the service node includes: the amount of interaction data, the packet loss rate, and the delay size between the local node and the service node in a period of time. One or more messages.
在上述方案中, 将待下载的文件进行分片时, 根据所述待下载文件的 大小对应的文件大小范围确定所述共享级分片的大小。  In the above solution, when the file to be downloaded is fragmented, the size of the shared-level fragment is determined according to the file size range corresponding to the size of the file to be downloaded.
本发明还提供一种基于 P2P的文件分发系统, 该系统包括:  The invention also provides a P2P-based file distribution system, the system comprising:
本地节点, 在进行 P2P文件下载时, 将待下载的文件进行分片, 建立 该待下载文件的索引信息, 所述待下载文件的索引信息包括分片得到的各 级片段的索引信息, 每级索引信息包括对应片段的分片位置信息, 所述分 片包括共享级分片及传输级分片, 且传输级分片的大小为初始默认值; 然 后向服务器申请下载节点信息, 收到回复后向确定的下载节点发送针对共 享级分片的下载请求, 其中, 该下载请求中含有需要从该下载节点下载的 共享级分片的索引信息以及确定的传输级分片的大小, 在传输过程中根据 与服务节点之间的网络资源状况动态调整所述传输级分片的大小; 接收下 载节点回复的数据;  The local node performs the P2P file downloading, and the file to be downloaded is fragmented, and the index information of the file to be downloaded is established, and the index information of the file to be downloaded includes index information of each fragment obtained by the fragment, each level. The index information includes fragmentation location information of the corresponding segment, the fragment includes a shared-level fragment and a transport-level fragment, and the size of the transport-level fragment is an initial default value; and then the server is requested to download the node information, and after receiving the reply, Sending a download request for the shared-level shard to the determined download node, where the download request includes the index information of the shared-level shard that needs to be downloaded from the download node, and the size of the determined transport-level shard, during the transmission process. Dynamically adjusting a size of the transport level fragment according to a network resource status between the serving node; receiving data replied by the download node;
服务器, 向所述本地节点提供索引信息及数据信息; 在收到所述本地 节点的下载节点请求后, 向所述本地节点提供下载节点信息;  a server, providing index information and data information to the local node; after receiving the download node request of the local node, providing download node information to the local node;
下载节点, 根据所述本地节点发送的针对共享级分片的下载请求, 向 该本地节点提供文件数据。  The download node provides file data to the local node according to the download request for the shared-level shard sent by the local node.
在上述方案中, 所述本地节点将待下载的文件进行分片时, 根据待下 载文件的大小对应的文件大小范围确定共享级分片的大小。  In the above solution, when the local node fragments the file to be downloaded, the size of the shared-level fragment is determined according to the file size range corresponding to the size of the file to be downloaded.
在上述方案中, 所述索引信息保存在本地节点以及所述服务器中。 在上述方案中, 所述本地节点与服务节点之间的网络资源状况包括: 一段时间内本地节点与服务节点间的交互数据量、 丟包率和延时大小中一 个或多个信息。  In the above solution, the index information is saved in the local node and the server. In the above solution, the network resource status between the local node and the service node includes: one or more pieces of information about the amount of interaction data, the packet loss rate, and the delay size between the local node and the serving node in a period of time.
在上述方案中, 所述下载节点是服务节点或者服务器。  In the above solution, the download node is a service node or a server.
所述下载节点是服务器或者服务节点。 本发明提出的基于 P2P的文件分发系统及分片方法, 能够在下载过程 中根据网络带宽的变化动态的调整数据传输单位的大小, 以保证文件分发 系统的传输性能能够适应网络带宽的变化, 从而提高数据传输的效率, 扩 大了文件分发系统的应用范围。 附图说明 The download node is a server or a service node. The P2P-based file distribution system and the fragmentation method provided by the invention can dynamically adjust the size of the data transmission unit according to the change of the network bandwidth during the downloading process, so as to ensure that the transmission performance of the file distribution system can adapt to the change of the network bandwidth, thereby Improve the efficiency of data transmission and expand the scope of application of file distribution systems. DRAWINGS
图 1为本发明实施例所述的三级自适应分片方法示意图;  1 is a schematic diagram of a three-level adaptive fragmentation method according to an embodiment of the present invention;
图 2为本发明实施例所述的四级自适应分片方法示意图;  2 is a schematic diagram of a four-level adaptive fragmentation method according to an embodiment of the present invention;
图 3为本发明实施例所述的基于 P2P的文件分发系统的文件下载方法 流程图;  3 is a flowchart of a file downloading method of a P2P-based file distribution system according to an embodiment of the present invention;
图 4为本发明实施例所述的文件分发系统总体架构示意图。 具体实施方式  FIG. 4 is a schematic diagram of the overall architecture of a file distribution system according to an embodiment of the present invention. detailed description
本发明提供一种基于 P2P的文件分发系统的分片方法, 该方法包括: 在文件分发过程中, 将待下载的文件进行分片, 所述分片包括共享级 分片和传输级分片, 且最后一级分片为传输级分片, 其中, 在传输过程中 根据本地节点与服务节点之间的网络资源状况动态调整所述传输级分片的 大小; 具体的, 所述本地节点与服务节点之间的网络资源状况包括: 一段 时间内本地节点与服务节点间的交互数据量、 丟包率和延时大小中一个或 多个信息, 在对待下载的文件进行初始分片时, 根据待下载文件的大小对 应的文件大小范围确定共享级分片的大小, 而传输级分片的大小初始为默 认值。  The present invention provides a method for sharding a P2P-based file distribution system, the method comprising: sharding a file to be downloaded in a file distribution process, where the shard includes a shared shard and a transport shard. And the last shard is a transport shard, wherein the size of the transport shard is dynamically adjusted according to the network resource status between the local node and the serving node during the transmission; specifically, the local node and the service The network resource status between the nodes includes: one or more pieces of information such as the amount of interaction data, the packet loss rate, and the delay size between the local node and the service node in a period of time, when the file to be downloaded is initially fragmented, according to The file size range corresponding to the size of the download file determines the size of the shared-level shard, and the size of the transport-level shard is initially the default.
下面结合附图对本发明优选的实施例进行详细说明。  Preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
作为本发明提供的第一实施例, 如图 1 所示, 采用三级分片方法, 根 据文件大小确定第一、 二级分片的大小, 所述一、 二级分片为共享级分片, 其中二级分片作为节点间进行数据交互时的数据共享单位, 第三级分片为 传输级分片, 即节点间进行数据传输时的传输单位, 第三级分片的大小采 用默认值, 具体可以为 1KB, 在传输过程中, 可以根据网络状况对第三级 分片大小进行动态调整。 具体分片方法如下: As a first embodiment of the present invention, as shown in FIG. 1, a three-level fragmentation method is used to determine the size of the first and second fragments according to the file size, and the first and second fragments are shared-level fragments. , where the second-level fragment is used as the data sharing unit for data interaction between nodes, and the third-level fragment is The transmission level fragmentation is the transmission unit when the data is transmitted between the nodes. The size of the third-level fragment is the default value, which can be 1 KB. During the transmission process, the size of the third-level fragment can be dynamically changed according to the network status. Adjustment. The specific fragmentation method is as follows:
第一级分片及第二级分片的方法如下:  The first level of fragmentation and the second level of fragmentation are as follows:
当文件大小大于 12MB时, 则第一级分片分割成的段 11大小为 4M, 第二级分片分割成的块 12大小为 16KB;  When the file size is greater than 12 MB, the size of the segment 11 into which the first-stage fragment is divided is 4M, and the size of the block 12 into which the second-stage fragment is divided into 16 KB is 16 KB;
当文件大小介于 4MB到 12MB之间时, 则段 11大小为 3MB, 块 12 大小为 16KB;  When the file size is between 4MB and 12MB, the segment size is 3MB, and the block size is 16KB.
当文件大小介于 2MB到 4MB之间时, 则段 11大小为 2MB, 块 12大 小为 8KB;  When the file size is between 2MB and 4MB, the segment size is 2MB, and the block size is 8KB.
当文件大小介于 1MB到 2MB之间时, 则段 11大小为 1MB, 块 12大 小为 4KB;  When the file size is between 1MB and 2MB, the size of the segment 11 is 1MB, and the size of the block 12 is 4KB.
当文件大小小于 1MB时, 则段 11大小为 1MB, 块 12大小为 2KB。 第三级分片 13的大小为 64字节的整数倍,具体可以为 1KB、512字节、 When the file size is less than 1MB, the segment 11 size is 1MB, and the block 12 size is 2KB. The size of the third-level fragment 13 is an integer multiple of 64 bytes, and may be 1 KB or 512 bytes.
256字节、 128字节、 64字节等; 由于三级分片是进行数据交互时的传输单 位, 因此传输单位最大为 1KB, 最小为 64字节。 256 bytes, 128 bytes, 64 bytes, etc.; Since the three-stage fragmentation is the transmission unit for data interaction, the transmission unit is up to 1 KB and the minimum is 64 bytes.
相应的, 在对文件进行三级分片的同时建立该文件对应的索引信息, 该索引信息也分为三级, 各级索弓 I信息分别表示对应级别的分片的位置信 作为本发明提供的第二实施例, 如图 2所示, 采用四级分片方法, 该 分片方法根据文件大小确定第一、 二、 三分片的大小, 所述一、 二、 三级 分片为共享级分片, 其中二级分片作为节点间进行数据交互时的数据共享 单位, 第四级分片为传输级分片, 四级分片为节点间进行数据传输时的传 输单位, 分片时四级分片的大小采用初始默认值, 具体可以为 1KB, 在传 输过程中可以根据网络状况动态调整第四级分片的大小; 具体分片方法如 下: Correspondingly, the index information corresponding to the file is established at the same time as the three-level fragmentation of the file, and the index information is also divided into three levels, and the information of each level indicates the position information of the corresponding level of the fragment as the present invention provides In the second embodiment, as shown in FIG. 2, a four-level fragmentation method is adopted. The fragmentation method determines the size of the first, second, and third fragments according to the file size, and the first, second, and third-level fragments are shared. Fragmentation, where the secondary fragment is used as the data sharing unit for data exchange between nodes, the fourth fragment is the transmission level fragmentation, and the fourth fragment is the transmission unit when the data is transmitted between the nodes. The size of the fourth-level fragment is the initial default value, which can be 1 KB. The size of the fourth-level fragment can be dynamically adjusted according to the network status during the transmission process. Next:
第一级分片及第二级分片的方法如下:  The first level of fragmentation and the second level of fragmentation are as follows:
当文件大小大于 12MB时, 则第一级分片分割成的段 21大小为 4M, 第二级分片分割成的块 22大小为 16KB;  When the file size is greater than 12 MB, the size of the segment 21 into which the first-stage fragment is divided is 4M, and the size of the block 22 into which the second-level fragment is divided into 16 KB is 16 KB;
当文件大小介于 4MB到 12MB之间时, 则段 21大小为 3MB, 块 22 大小为 16KB;  When the file size is between 4MB and 12MB, the segment 21 size is 3MB, and the block 22 size is 16KB.
当文件大 d、介于 2MB到 4MB之间时, 则段 21大小为 2MB , 块 22大 小为 8KB;  When the file size is between d and 2MB to 4MB, the size of segment 21 is 2MB, and the size of block 22 is 8KB.
当文件大小介于 1MB到 2MB之间时, 则段 21大小为 1MB, 块 22大 小为 4KB;  When the file size is between 1MB and 2MB, the size of the segment 21 is 1MB, and the size of the block 22 is 4KB.
当文件大小小于 1MB时, 则段 21大小为 1MB, 块 22大小为 2KB。 第三级分片 23的大小固定为 1KB;  When the file size is less than 1MB, the segment 21 size is 1MB, and the block 22 size is 2KB. The size of the third stage fragment 23 is fixed to 1 KB;
第四级分片 24是在三级分片 1KB的传输单位基础上再进行一次细分, 其大小为 64字节的整数倍, 具体可以为 1KB、 512字节、 256字节、 128 字节、 64字节等; 由于四级分片是进行数据交互时的传输单位, 因此传输 单位最大为 1KB, 最小为 64字节。  The fourth-level fragment 24 is further subdivided on the basis of the transmission unit of the third-level fragment 1 KB, and its size is an integer multiple of 64 bytes, which may be 1 KB, 512 bytes, 256 bytes, 128 bytes. , 64 bytes, etc.; Since the four-level fragmentation is the transmission unit for data interaction, the transmission unit is up to 1 KB and the minimum is 64 bytes.
对文件进行分片后, 建立该文件对应的索引信息, 该索引信息也分为 四级, 分别表示对应级别的分片的位置信息, 即该文件被分成了多少个段、 每个段被分成多少个块, 最后一段最后一块的大小等信息。  After the file is fragmented, the index information corresponding to the file is established, and the index information is also divided into four levels, which respectively represent the location information of the fragment of the corresponding level, that is, how many segments are divided into the file, and each segment is divided into How many blocks, the size of the last piece of the last piece, and so on.
例如, 对于一个大小为 20.51MB的文件, 根据本发明所述自适应分片 方法, 在文件分发系统和文件分发系统 DTS— S— SP维护相同的索引信息; 由于该文件大于 12MB, 则一级分片分割成的段大小为 4MB, 可知在索引 信息中文件被分为 6个段, 二级分片分割成的块大小为 16KB, 则可知索引 信息中前 5个段分别包含 256个块, 最后一段包含 33个块, 最后一段的最 后一块的大小为 10.14KB。 本发明还提供一种基于 P2P的文件分发系统的文件下载方法, 如图 3 所示, 该方法包括以下步驟: For example, for a file having a size of 20.51 MB, according to the adaptive fragmentation method of the present invention, the same index information is maintained in the file distribution system and the file distribution system DTS-S-SP; since the file is larger than 12 MB, the level is The fragment size is divided into 4 MB. It can be seen that the file is divided into 6 segments in the index information, and the block size is divided into 16 KB. The first 5 segments of the index information respectively contain 256 blocks. The last segment contains 33 blocks, and the last block of the last segment has a size of 10.14 KB. The present invention also provides a file downloading method of a P2P-based file distribution system. As shown in FIG. 3, the method includes the following steps:
步驟 301 : 开始;  Step 301: start;
步驟 302: 本地节点获得下载指令;  Step 302: The local node obtains a download instruction.
步驟 303: 本地节点向服务器申请待下载文件的文件属性信息, 该文件 属性信息具体可以为文件的 CID和文件大小信息, 得到该文件属性信息后 将待下载的文件进行分片, 根据待下载文件大小对应的文件大小范围确定 共享级分片的大小, 对传输级分片的大小采用默认设置, 并保存相应的索 引信息;  Step 303: The local node applies to the server for the file attribute information of the file to be downloaded, and the file attribute information may be the CID and the file size information of the file. After obtaining the attribute information of the file, the file to be downloaded is fragmented according to the file to be downloaded. The size of the file size corresponding to the size determines the size of the shared-level shard, the default setting of the size of the transport-level shard, and the corresponding index information is saved;
具体的, 可以如实施例一所述根据待下载文件的大小进行共享级分片 , 即所述共享级分片可以为实施例一中所述的一级分片、 二级分片, 而实施 例一中所述的三级分片为传输级分片, 其大小初始默认值设置为 1KB, 在 传输过程中可根据网络状态进行调整;  Specifically, the sharing level fragmentation may be performed according to the size of the file to be downloaded, as described in the first embodiment, that is, the sharing level fragment may be implemented as the first level fragment and the second layer fragment described in the first embodiment. The third-level fragment described in the first example is a transport-level fragment, and its initial default value is set to 1 KB, which can be adjusted according to the network state during transmission;
也可以根据实施例二中所述的根据待下载文件的大小进行共享级分 片, 即所述共享级分片可以为实施例二中所述的一级分片、 二级分片及三 级分片, 而实施例二中所述的四级分片为传输级分片, 其大小初始默认值 设置为 1KB, 在传输过程中可根据网络状态进行调整。  The sharing level fragmentation may be performed according to the size of the file to be downloaded, as described in the second embodiment, that is, the sharing level fragment may be the first level fragment, the second level fragment, and the third level described in the second embodiment. Fragmentation, and the four-stage fragment described in the second embodiment is a transport-level fragment, and its initial default value is set to 1 KB, which can be adjusted according to the network state during transmission.
步驟 304: 本地节点向服务器申请到下载节点信息后, 确定待下载文件 的共享级分片所对应的下载节点, 此处所述共享级分片可以是实施例一中 所述的二级分片, 也可以是实施例二中所述的二级分片; 具体的, 所述下 载节点可以是服务节点, 也可以是服务器。  Step 304: After the local node applies to the server to download the node information, the download node corresponding to the shared-level fragment of the file to be downloaded is determined, where the shared-level fragment may be the second-level fragment described in the first embodiment. The two-stage fragmentation described in the second embodiment may be used. Specifically, the download node may be a service node or a server.
步驟 305: 本地节点向确定的下载节点发送针对共享级分片的下载请 求, 并且根据本地节点与下载节点间的网络资源状况确定传输单位大小, 也就是传输级分片的大小;  Step 305: The local node sends a download request for the shared-level fragment to the determined download node, and determines a transmission unit size, that is, a size of the transport-level fragment, according to a network resource status between the local node and the download node.
具体的, 本地节点在向下载节点请求数据时会请求文件 CID, 段号、 块号、 分片号、 相对于分片的偏移, 需要读取的字节数, 该字节数具体为Specifically, the local node requests the file CID, the segment number, when requesting data from the download node. Block number, slice number, offset from the slice, the number of bytes to be read, the number of bytes is specifically
64字节的整数倍; An integer multiple of 64 bytes;
所述网络资源状况是指一段时间内本地节点与下载节点间的交互数据 量、 丟包率和延时大小中一个或多个信息; 优选的, 所述一段时间具体可 以是 5s; 由于传输级分片初始默认大小为 1KB, 因此传输单位初始默认值 为 1KB, 当网络状况变差时, 重新调整传输级分片的大小, 使其以 2的倍 数递减, 该传输级分片的大小始终为 64字节的整数倍, 最小为 64字节, 最大为 1KB; 当调整传输级分片的大小时, 同时修改相应的索引信息, 使 得索引信息中的文件分片大小与实际文件分片大小始终一致; 具体的, 所 述传输级分片可以是实施例一中所述的第三级分片, 也可以是实施例二中 所述的第四级分片。  The network resource status refers to one or more pieces of information about the amount of interaction data, the packet loss rate, and the delay size between the local node and the download node in a period of time; preferably, the period of time may be 5s; The initial default size of the shard is 1 KB, so the initial default value of the transmission unit is 1 KB. When the network condition deteriorates, resize the transmission shard to be decremented by a multiple of 2. The size of the transmission shard is always 64-byte integer multiple, the minimum is 64 bytes, the maximum is 1KB; When adjusting the size of the transport-level fragment, the corresponding index information is modified at the same time, so that the file fragment size and the actual file fragment size in the index information are always Specifically, the transmission level fragmentation may be the third level fragment described in the first embodiment, or may be the fourth level fragment described in the second embodiment.
步驟 306: 下载节点向本地节点发送数据回复, 具体的, 在回复数据时 会回复文件 CID, 段号、 块号、 分片号、 相对于分片的偏移, 共享的数据 的字节数以及实际的文件数据;  Step 306: The download node sends a data reply to the local node. Specifically, when replying the data, the file CID, the segment number, the block number, the fragment number, the offset with respect to the fragment, the number of bytes of the shared data, and Actual file data;
步驟 307: 本地节点在接收到下载节点回复的数据后, 将实际的文件数 据写入到相应的内存位置中, 并对相应的索引信息进行置位, 当最低一级 索引信息数据填充完整后, 则对上一级索引进行置位;  Step 307: After receiving the data replied by the download node, the local node writes the actual file data into the corresponding memory location, and sets the corresponding index information. When the lowest level index information is filled in, Then set the upper level index;
步驟 308: 接收到相应的数据则对相应位置索引进行置位, 若共享级数 据块索引置位为 0时, 则继续步驟 305, 直到当共享级分片最低一级分片数 据索引置位为 1时, 继续步驟 309;  Step 308: If the corresponding data is received, the corresponding location index is set. If the shared-level data block index is set to 0, then step 305 is continued until the lowest-level fragment data index of the shared-level fragment is set to 1 o'clock, continue to step 309;
例如, 当最低一级索引为实施例二中所述的四级索引信息时, 当本地 节点接收到回复并将实际文件数据写入到相应的内存位置后, 对四级索引 进行置位, 即将相应的四级索引位置置位为 1 , 当 1KB数据填充完整后, 则对三级索引位置进行置位, 直到当二级分片数据填充完整, 则对二级索 引进行置位, 直到二级索引位置置位为 1 时, 结束此次数据传输, 该数据 块就可以对外共享了。 For example, when the lowest level index is the four level index information described in the second embodiment, when the local node receives the reply and writes the actual file data to the corresponding memory location, the fourth level index is set, that is, The corresponding four-level index position is set to 1. When the 1KB data is filled, the three-level index position is set until the secondary fragment data is filled, and the secondary index is set until the second level. When the index position is set to 1, the data transmission ends, the data The blocks can be shared externally.
步驟 309: 结束此次数据传输。  Step 309: End the data transmission.
如图 4所示, 本发明还提供一种基于 P2P的文件分发系统, 该系统包 括:  As shown in FIG. 4, the present invention also provides a P2P-based file distribution system, which includes:
本地节点, 在进行 P2P文件下载时, 将待下载的文件进行分片, 建立 该待下载文件的索引信息, 所述待下载文件的索引信息包括分片得到的各 级片段的索引信息, 每级索引信息包括对应片段的分片位置信息, 所述分 片包括共享级分片及传输级分片, 且传输级分片的大小为初始默认值; 然 后向服务器申请下载节点信息, 收到回复后向确定的下载节点发送针对共 享级分片的下载请求, 其中, 该下载请求中含有需要从该下载节点下载的 共享级分片的索引信息以及确定的传输级分片的大小, 在传输过程中根据 与服务节点之间的网络资源状况动态调整所述传输级分片的大小; 接收下 载节点回复的数据。  The local node performs the P2P file downloading, and the file to be downloaded is fragmented, and the index information of the file to be downloaded is established, and the index information of the file to be downloaded includes index information of each fragment obtained by the fragment, each level. The index information includes fragmentation location information of the corresponding segment, the fragment includes a shared-level fragment and a transport-level fragment, and the size of the transport-level fragment is an initial default value; and then the server is requested to download the node information, and after receiving the reply, Sending a download request for the shared-level shard to the determined download node, where the download request includes the index information of the shared-level shard that needs to be downloaded from the download node, and the size of the determined transport-level shard, during the transmission process. Dynamically adjusting the size of the transport level fragment according to a network resource condition between the serving node; receiving data replied by the download node.
服务器, 向本地节点提供索引信息及数据信息; 在收到本地节点的下 载节点请求后, 向本地节点提供下载节点信息;  a server, providing index information and data information to the local node; after receiving the download request of the local node, providing the download information to the local node;
具体的, 所述服务器可以包括以下三个模块:  Specifically, the server may include the following three modules:
内容管理模块 DTS— S— SM, 对片库上的相关目录进行监控, 实时监测 到文件的添加及删除事件, 并通知节点索引模块文件变化的情况;  The content management module DTS-S-SM monitors related directories on the library, monitors the addition and deletion of files in real time, and notifies the node of the index module file changes;
节点索引模块 DTS— S— RM, 提供节点索引信息, 即需要下载的文件分 别在哪些下载节点上, 所述下载节点包括服务器及服务节点。 具体的, 节 点索引模块用于根据所述本地节点的请求提供待下载文件的 CID和文件大 小信息; 根据所述本地节点的请求向所述服务节点提供待下载文件的共享 级分片所对应的下载节点信息;  The node indexing module DTS_S_RM provides node index information, that is, which download nodes the files to be downloaded are respectively, and the download node includes a server and a service node. Specifically, the node indexing module is configured to provide CID and file size information of the file to be downloaded according to the request of the local node, and provide the service node with a shared-level fragment corresponding to the file to be downloaded according to the request of the local node. Download node information;
静态节点模块 DTS— S— SP,接收节点索引模块的上线消息, 以及根据本 地节点发送的针对共享级分片的下载请求, 将数据回复给本地节点。 下载节点, 根据所述本地节点发送的针对共享级分片的下载请求, 向 该本地节点提供文件数据; 具体的, 该下载节点可以是服务节点, 也可以 是静态节点模块 DTS— S— SP。 The static node module DTS_S_SP receives the online message of the node indexing module and returns the data to the local node according to the download request for the shared-level fragment sent by the local node. The downloading node provides the file data to the local node according to the download request for the shared-level fragment sent by the local node. Specifically, the download node may be a service node or a static node module DTS-S-SP.
本发明提出的基于 P2P的文件分发系统的分片方法, 能够根据待下载 文件的大小自适应的进行分片的调整, 从而使得大小不一的文件能够取得 类似的 P2P分发性能, 并且能够在下载过程中根据网络带宽的变化动态的 调整数据传输单位的大小, 以保证文件分发系统的传输性能能够适应网络 带宽的变化, 从而提高数据传输的性能。  The fragmentation method of the P2P-based file distribution system proposed by the present invention can adaptively perform fragmentation adjustment according to the size of the file to be downloaded, so that files of different sizes can obtain similar P2P distribution performance, and can be downloaded. During the process, the size of the data transmission unit is dynamically adjusted according to the change of the network bandwidth, so as to ensure that the transmission performance of the file distribution system can adapt to changes in the network bandwidth, thereby improving the performance of data transmission.
显然, 本领域的技术人员可以对本发明进行各种改动和变型而不脱离 本发明的精神和范围。 这样, 倘若本发明的这些修改和变型属于本发明权 利要求及其等同技术的范围之内, 则本发明也意图包含这些改动和变型在 内。  It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and modifications of the invention

Claims

权利要求书 Claim
1、 一种基于 P2P的文件分发系统的分片方法, 其特征在于, 该方法包 括:  A fragmentation method for a P2P-based file distribution system, the method comprising:
在文件分发过程中, 将待下载的文件进行分片, 所述分片包括共享级 分片和传输级分片, 且最后一级分片为传输级分片, 其中, 在传输过程中 根据本地节点与服务节点之间的网络资源状况动态调整所述传输级分片的 大小。  In the file distribution process, the file to be downloaded is fragmented, and the fragment includes a shared-level fragment and a transport-level fragment, and the last-level fragment is a transport-level fragment, wherein the local-layer fragment is transmitted according to the local The network resource status between the node and the serving node dynamically adjusts the size of the transport level fragment.
2、 根据权利要求 1所述的方法, 其特征在于, 将待下载的文件进行分 片时, 根据所述待下载文件的大小对应的文件大小范围确定所述共享级分 片的大小。  The method according to claim 1, wherein when the file to be downloaded is sliced, the size of the shared-level slice is determined according to a file size range corresponding to the size of the file to be downloaded.
3、 根据权利要求 1所述的方法, 其特征在于, 所述本地节点与服务节 点之间的网络资源状况包括: 一段时间内所述本地节点与服务节点间的交 互数据量、 丟包率和延时大小中一个或多个信息。  3. The method according to claim 1, wherein the network resource status between the local node and the service node comprises: an amount of interaction data between the local node and the service node, a packet loss rate, and a period of time. One or more pieces of information in the delay size.
4、 一种基于 P2P的文件分发系统的文件下载方法, 其特征在于, 该 方法包括以下步驟:  A file downloading method for a P2P-based file distribution system, characterized in that the method comprises the following steps:
本地节点在进行 P2P文件下载时, 将待下载的文件进行分片, 建立该 待下载文件的索引信息, 所述待下载文件的索引信息包括分片得到的各级 片段的索引信息, 每级索引信息包括对应片段的分片位置信息, 所述分片 包括共享级分片及传输级分片, 且传输级分片的初始大小为默认值;  When the P2P file is downloaded, the local node fragments the file to be downloaded, and establishes index information of the file to be downloaded, and the index information of the file to be downloaded includes index information of each fragment obtained by the fragment, and each level index The information includes the fragmentation location information of the corresponding segment, where the fragment includes a shared-level fragment and a transport-level fragment, and the initial size of the transport-level fragment is a default value;
本地节点向服务器申请到下载节点信息后, 确定待下载文件的共享级 分片所对应的下载节点;  After the local node requests the server to download the node information, the local node determines the download node corresponding to the shared-level fragment of the file to be downloaded;
本地节点向确定的下载节点发送针对共享级分片的下载请求, 其中含 有需要从该下载节点下载的共享级分片的索引信息以及确定的传输级分片 的大小, 并且在传输过程中根据与服务节点之间的网络资源状况动态调整 传输级分片的大小; 本地节点接收下载节点回复的数据。 The local node sends a download request for the shared-level shard to the determined download node, where the index information of the shared-level shard that needs to be downloaded from the download node and the size of the determined transport-level shard are included, and are The network resource status between the service nodes dynamically adjusts the size of the transport level fragmentation; The local node receives the data replied by the download node.
5、 根据权利要求 4所述的文件下载方法, 其特征在于, 所述本地节点 与服务节点间的网络资源状况包括: 一段时间内所述本地节点与服务节点 间的交互数据量、 丟包率和延时大小中一个或多个信息。  The file downloading method according to claim 4, wherein the network resource status between the local node and the serving node includes: the amount of interaction data and the packet loss rate between the local node and the serving node in a period of time And one or more pieces of information in the delay size.
6、 根据权利要求 4所述的文件下载方法, 其特征在于, 将待下载的文 件进行分片时, 根据所述待下载文件的大小对应的文件大小范围确定所述 共享级分片的大小。  The file downloading method according to claim 4, wherein when the file to be downloaded is fragmented, the size of the shared-level fragment is determined according to a file size range corresponding to the size of the file to be downloaded.
7、 一种基于 P2P的文件分发系统, 其特征在于, 该系统包括: 本地节点, 在进行 P2P文件下载时, 将待下载的文件进行分片, 建立 该待下载文件的索引信息, 所述待下载文件的索引信息包括分片得到的各 级片段的索引信息, 每级索引信息包括对应片段的分片位置信息, 所述分 片包括共享级分片及传输级分片, 且传输级分片的大小为初始默认值; 然 后向服务器申请下载节点信息, 收到回复后向确定的下载节点发送针对共 享级分片的下载请求, 其中, 该下载请求中含有需要从该下载节点下载的 共享级分片的索引信息以及确定的传输级分片的大小, 在传输过程中根据 与服务节点之间的网络资源状况动态调整所述传输级分片的大小; 接收下 载节点回复的数据;  A P2P-based file distribution system, the system includes: a local node, when a P2P file is downloaded, the file to be downloaded is fragmented, and the index information of the file to be downloaded is established. The index information of the download file includes index information of each fragment obtained by the fragment, and the index information of each level includes fragmentation location information of the corresponding fragment, and the fragment includes a shared-level fragment and a transport-level fragment, and the transport-level fragment is included. The size is the initial default value; then the server is requested to download the node information, and after receiving the reply, the download request for the shared-level shard is sent to the determined download node, where the download request includes the share level that needs to be downloaded from the download node. The index information of the fragment and the size of the determined transport level fragment, dynamically adjusting the size of the transport level fragment according to the network resource status with the service node during the transmission; receiving the data replied by the download node;
服务器, 向所述本地节点提供索引信息及数据信息; 在收到所述本地 节点的下载节点请求后, 向所述本地节点提供下载节点信息;  a server, providing index information and data information to the local node; after receiving the download node request of the local node, providing download node information to the local node;
下载节点, 根据所述本地节点发送的针对共享级分片的下载请求, 向 所述本地节点提供文件数据。  The download node provides file data to the local node according to the download request for the shared-level fragment sent by the local node.
8、 根据权利要求 7所述的系统, 其特征在于, 所述本地节点将待下载 的文件进行分片时, 根据待下载文件的大小对应的文件大小范围确定共享 级分片的大小。  The system according to claim 7, wherein when the local node fragments the file to be downloaded, the size of the shared-level fragment is determined according to the file size range corresponding to the size of the file to be downloaded.
9、 根据权利要求 7所述的系统, 其特征在于, 所述索引信息保存在本 地节点以及所述服务器中。 9. The system according to claim 7, wherein the index information is saved in the present The ground node and the server.
10、 根据权利要求 7所述的系统, 其特征在于, 所述本地节点与服务 节点之间的网络资源状况包括: 一段时间内本地节点与服务节点间的交互 数据量、 丟包率和延时大小中一个或多个信息。  10. The system according to claim 7, wherein the network resource status between the local node and the serving node comprises: the amount of interaction data, the packet loss rate, and the delay between the local node and the serving node in a period of time. One or more messages in size.
11、 根据权利要求 7所述的系统, 其特征在于, 所述下载节点是服务 节点或者服务器。  The system according to claim 7, wherein the download node is a service node or a server.
PCT/CN2011/084210 2011-04-22 2011-12-19 P2p-based file distribution system and slicing method WO2012142844A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110102631.0 2011-04-22
CN2011101026310A CN102170475A (en) 2011-04-22 2011-04-22 File distribution system and fragmentation method based on P2P (peer-to-peer)

Publications (1)

Publication Number Publication Date
WO2012142844A1 true WO2012142844A1 (en) 2012-10-26

Family

ID=44491451

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/084210 WO2012142844A1 (en) 2011-04-22 2011-12-19 P2p-based file distribution system and slicing method

Country Status (2)

Country Link
CN (1) CN102170475A (en)
WO (1) WO2012142844A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10142411B2 (en) 2015-05-29 2018-11-27 Microsoft Technology Licensing, Llc Dynamic swarm segmentation
EP3481077A4 (en) * 2016-07-22 2019-05-08 Huawei Technologies Co., Ltd. Method, device, and terminal for downloading streaming media file fragment

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102170475A (en) * 2011-04-22 2011-08-31 中兴通讯股份有限公司 File distribution system and fragmentation method based on P2P (peer-to-peer)
CN103188279B (en) * 2011-12-27 2016-06-01 中国电信股份有限公司 By the method and apparatus that peer-to-peer network downloads file from multiple neighbor nodes
CN102546786B (en) * 2011-12-29 2015-04-01 中兴通讯股份有限公司 Method and system for variable-length access of multi-media files in content distribution network
CN103634332B (en) * 2012-08-20 2016-12-21 中国移动通信集团公司 A kind of flow-medium transmission method based on P2P, Apparatus and system
CN104168081B (en) 2013-05-20 2018-09-07 腾讯科技(深圳)有限公司 A kind of document transmission method and device
CN103731499B (en) * 2013-12-31 2018-01-05 兴天通讯技术(天津)有限公司 Terminal and document transmission method
CN104967640A (en) * 2014-07-31 2015-10-07 腾讯科技(深圳)有限公司 Data storage method, apparatus and system
CN106101146B (en) * 2016-08-12 2019-05-07 暴风集团股份有限公司 The method and system of Flash peer-to-peer network live streaming are carried out based on block style
CN107888633B (en) * 2016-09-29 2020-10-20 上海帝联信息科技股份有限公司 File distribution method and device
CN108512770B (en) * 2017-02-28 2020-10-23 华为技术有限公司 Data flow distribution method and related equipment
CN106993054B (en) * 2017-05-05 2022-06-03 腾讯科技(深圳)有限公司 File distribution method, node and system
CN109525622B (en) * 2017-09-19 2021-11-26 阿里巴巴集团控股有限公司 Fragment resource ID generation method, resource sharing method, device and electronic equipment
CN107734045A (en) * 2017-10-25 2018-02-23 深圳市雷鸟信息科技有限公司 Network file request, network file processing method, television terminal, file server and system
CN109167845A (en) * 2018-11-27 2019-01-08 云之端网络(江苏)股份有限公司 A kind of fragment cache memory and recombination method towards big file distributing scene
CN109922142B (en) * 2019-02-21 2022-04-19 创新先进技术有限公司 File downloading method, device and system
CN109981751B (en) * 2019-03-06 2022-06-17 珠海金山网络游戏科技有限公司 File transmission method and system, computer equipment and storage medium
WO2020216035A1 (en) * 2019-04-22 2020-10-29 北京开广信息技术有限公司 Real-time pushing method and real-time receiving method for media stream, server, and client
CN111447265A (en) * 2020-03-24 2020-07-24 深圳市网心科技有限公司 File storage method, file downloading method, file processing method and related components

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080133538A1 (en) * 2006-12-05 2008-06-05 Timothy R Chavez Background file sharing in a segmented peer-to-peer file sharing network
CN101330434A (en) * 2007-06-19 2008-12-24 中国电信股份有限公司 Method for storing node content for telecommunication P2P application
WO2009103345A1 (en) * 2008-02-22 2009-08-27 Telefonaktiebolaget Lm Ericsson (Publ) Method and apparatus for obtaining media over a communications network
CN101697553A (en) * 2009-10-12 2010-04-21 中国科学院计算技术研究所 Data transmission method under P2P environment
CN102170475A (en) * 2011-04-22 2011-08-31 中兴通讯股份有限公司 File distribution system and fragmentation method based on P2P (peer-to-peer)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100469002C (en) * 2005-08-09 2009-03-11 张永敏 Data block transmission method
CN101437044B (en) * 2008-11-28 2012-05-09 中兴通讯股份有限公司 Method and system for downloading file by point-to-point network technique based on sliced sheet
CN101764834A (en) * 2008-12-24 2010-06-30 中国移动通信集团公司 Method, user terminal and system for sharing files in group
CN101562635B (en) * 2009-05-15 2012-05-09 中兴通讯股份有限公司 Method and player for mobile streaming media on demand

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080133538A1 (en) * 2006-12-05 2008-06-05 Timothy R Chavez Background file sharing in a segmented peer-to-peer file sharing network
CN101330434A (en) * 2007-06-19 2008-12-24 中国电信股份有限公司 Method for storing node content for telecommunication P2P application
WO2009103345A1 (en) * 2008-02-22 2009-08-27 Telefonaktiebolaget Lm Ericsson (Publ) Method and apparatus for obtaining media over a communications network
CN101697553A (en) * 2009-10-12 2010-04-21 中国科学院计算技术研究所 Data transmission method under P2P environment
CN102170475A (en) * 2011-04-22 2011-08-31 中兴通讯股份有限公司 File distribution system and fragmentation method based on P2P (peer-to-peer)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10142411B2 (en) 2015-05-29 2018-11-27 Microsoft Technology Licensing, Llc Dynamic swarm segmentation
EP3481077A4 (en) * 2016-07-22 2019-05-08 Huawei Technologies Co., Ltd. Method, device, and terminal for downloading streaming media file fragment

Also Published As

Publication number Publication date
CN102170475A (en) 2011-08-31

Similar Documents

Publication Publication Date Title
WO2012142844A1 (en) P2p-based file distribution system and slicing method
US10491657B2 (en) Network acceleration method, apparatus and device based on router device
Gkantsidis et al. Network coding for large scale content distribution
Picconi et al. Is there a future for mesh-based live video streaming?
CN101309282B (en) Method, server and system for document transmission in local area network
WO2018076765A1 (en) Content distribution method and device for cloud computing system, computing node and system
WO2013075578A1 (en) System and method for offline download of network resource file
WO2010127618A1 (en) System and method for implementing streaming media content service
US20140108508A1 (en) Cloud subscription download method and system, and computer storage medium
US20150032798A1 (en) Method And Apparatus For Providing Redundant Data Access
Marciniak et al. Small is not always beautiful
CN102394899A (en) On-demand system and method for improving file downloading speed
WO2022166584A1 (en) Point-to-point network scheduling method and system
TW201737109A (en) Data uploading method, device, and system
Liu et al. A novel cache replacement scheme against cache pollution attack in content-centric networks
CN108833554B (en) Large-scale network-oriented real-time high-reliability message distribution system and method thereof
Fesehaye et al. A Scalable Distributed File System for Cloud Computing
CN107612980B (en) Adjustable and reliable consistency maintenance method in structured P2P network
Jiang et al. A replica placement algorithm for hybrid CDN-P2P architecture
Tseng et al. A novel cache scheme based on content popularity and user locality for future internet
WO2016165596A1 (en) Multimedia file control method and system
CN110784534B (en) Data service method, device and system and electronic equipment
Sheu et al. Mixed P2P-CDN system for media streaming in mobile environment
CN101635669B (en) Method for acquiring data fragments in data-sharing systems
Hundeboll et al. Peer-assisted content distribution with random linear network coding

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11863720

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11863720

Country of ref document: EP

Kind code of ref document: A1