WO2016184230A1 - P2p data downloading method and apparatus - Google Patents

P2p data downloading method and apparatus Download PDF

Info

Publication number
WO2016184230A1
WO2016184230A1 PCT/CN2016/076065 CN2016076065W WO2016184230A1 WO 2016184230 A1 WO2016184230 A1 WO 2016184230A1 CN 2016076065 W CN2016076065 W CN 2016076065W WO 2016184230 A1 WO2016184230 A1 WO 2016184230A1
Authority
WO
WIPO (PCT)
Prior art keywords
current
initial
cdn
probability
download
Prior art date
Application number
PCT/CN2016/076065
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 WO2016184230A1 publication Critical patent/WO2016184230A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/238Interfacing the downstream path of the transmission network, e.g. adapting the transmission rate of a video stream to network bandwidth; Processing of multiplex streams
    • H04N21/23805Controlling the feeding rate to the network, e.g. by controlling the video pump
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/238Interfacing the downstream path of the transmission network, e.g. adapting the transmission rate of a video stream to network bandwidth; Processing of multiplex streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • H04N21/2408Monitoring of the upstream path of the transmission network, e.g. client requests

Definitions

  • the present invention relates to computer communication technologies, and in particular, to a method and apparatus for P2P data downloading.
  • the client player downloads video data from a CDN (Content Delivery Network) server via the http (HyperText Transfer Protocol) protocol for online playback.
  • CDN Content Delivery Network
  • http HyperText Transfer Protocol
  • the client player adopts a P2P (peer-to-peer) download function (ie, the client player). Sharing data with other client players, the client player can download video data that is not in the client player from other client players, and other client players can download other clients from the client player. Video data not available in the player).
  • the current P2P data downloading method is as follows: Referring to FIG.
  • the emergency zone and the P2P download zone are sequentially set in the positive direction of the playback point of the client player, wherein the video data of the emergency zone is to be played by the client player.
  • Video data, so the video data in the emergency area is mainly downloaded directly from the CDN server.
  • the video data in the P2P download area is mainly downloaded from other client players.
  • Each square in the emergency area and the P2P download area represents a data block.
  • the data block is the basic data unit for video playback, http download, P2P download and sharing.
  • the current P2P data download method is specifically as follows: when setting the P2P download area, each data block in the P2P download area is once selected with a probability of n%, and selected. Video data in the data block from the CDN server Load, this will make the difference between the video player data generated by each client player (that is, I have no video data others, others have video data I did not), so that in the live state, each client player Have the opportunity to share data.
  • the network bandwidth of each client player is different, and the rate of downloading video data from the CDN server is also different. If each client player has a fixed value of n%, the network bandwidth is small. The low-speed client player takes a long time to download the video data from the CDN server, which affects the P2P sharing data; and regardless of the total number of client players that are simultaneously broadcasted, each client player is selected. A fixed value of n% is likely to cause excessive video data to be downloaded from the CDN server, which hinders further improvement of the P2P download rate. For example, the selection probability is set to 20%, and when there are more client players watching the same live program. If it reaches 10,000, in theory, the selection probability of each client player only needs to be 0.01%. By P2P sharing data, each client player can obtain all the video data needed for the live program, if the probability is selected. Fixed at 20%, inevitably caused too much video data to be downloaded from the CDN server.
  • the present invention provides a P2P data downloading method and device, which can balance different network bandwidth network speed client players, can better perform P2P sharing data; and can realize P2P download rate. Further improvement.
  • the present invention discloses a method for P2P data downloading, the method comprising:
  • an initial CDN download probability indicates a probability that video data in the initially set data block in the P2P download area is selected to be downloaded from the CDN server;
  • the current network status parameter includes a current P2P upload rate and current P2P traffic. Ratio and current P2P upload volume; get current network status parameters, including:
  • the initial network condition parameter includes an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount, and the CDN prefetch data amount is according to the current P2P download amount, the current CDN download amount, and the The initial CDN download probability is obtained; obtaining the initial CDN download probability and the initial network condition parameter includes: obtaining an initial CDN download probability returned by the play server, and initializing the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio.
  • the current P2P upload rate is greater than the initial P2P upload rate, the current P2P traffic ratio is greater than or equal to the initial P2P traffic ratio, and the current P2P upload amount is greater than or equal to the CDN prefetched data amount,
  • the initial CDN download probability is increased according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio as the initial P2P traffic;
  • Recalculating the current P2P upload rate and the current P2P traffic if the current P2P upload rate is less than a preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch data amount. And the current P2P upload amount, re-acquiring the initial CDN download probability, and initializing the initial network status parameter, and initializing the CDN download probability update ratio to a preset value;
  • the initial CDN download probability is reduced according to the CDN download probability update ratio, and the obtained The current CDN download probability is described, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio is used as the initial P2P traffic.
  • the CDN download probability update ratio is preset, or in the current P2P When the upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate, it is obtained according to a preset ratio reduction. Further, the initial CDN download probability is preset and is less than or equal to 50%.
  • the current P2P download quantity, the current P2P upload quantity, and the current CDN download quantity in the preset preset time interval include the following steps:
  • B3 determining whether the time of the second timer is greater than or equal to a second preset time interval, if greater than or equal to the second preset time interval, executing b5; otherwise, executing b4;
  • B4 clear the statistical time of the first timer, the first timer restarts the statistical time, and then executes b2;
  • B6 Calculate the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the statistical time of the second timer.
  • the method further includes:
  • the current CDN download probability is used as an initial CDN download probability and the current network status parameter as an initial network status parameter.
  • the present invention also discloses an apparatus for downloading P2P data, the apparatus comprising:
  • An obtaining module configured to obtain an initial CDN download probability, an initial network status parameter, and a current network status parameter; wherein the initial CDN download probability indicates that video data in a data block in an initially set P2P download area is selected from a CDN server The probability of downloading;
  • a processing module configured to perform the current network status parameter and the initial network status parameter Comparing, according to the comparison result, updating the initial CDN download probability to obtain a current CDN download probability
  • a downloading module configured to select video data in the data block in the P2P download area to be downloaded from the CDN server according to the current CDN download probability.
  • the current network status parameter includes a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload amount;
  • the obtaining module further includes: a statistics unit and a calculating unit;
  • the statistics unit is configured to count the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval;
  • the calculating unit is configured to calculate the current P2P upload rate and the current P2P traffic ratio according to the current P2P download amount, the current P2P upload amount, and the current CDN download amount.
  • the initial network condition parameter includes an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount, and the CDN prefetch data amount is according to the current P2P download amount, the current CDN download amount, and the The initial CDN download probability is obtained; obtaining the initial CDN download probability and the initial network condition parameter includes: obtaining an initial CDN download probability returned by the play server, and initializing the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio.
  • the processing module further includes: a probability adjustment unit,
  • the probability adjustment unit is configured to: if the current P2P upload rate is greater than the initial P2P upload rate, the current P2P traffic ratio is greater than or equal to the initial P2P traffic ratio, and the current P2P upload amount is greater than or equal to the CDN pre- Taking the amount of data, the initial CDN download probability is increased according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate. Describe the current P2P traffic ratio as the initial P2P traffic;
  • the probability adjustment unit is further configured to re-acquire the initial if the current P2P upload rate is less than a preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch data amount.
  • the CDN downloads the probability, and initializes the initial network condition parameter, and initializes the CDN download probability update ratio to a preset value;
  • the probability adjustment unit is further configured to: if the current P2P upload rate is smaller than the initial P2P If the upload rate is greater than the preset ratio of the initial P2P upload rate, the initial CDN download probability is reduced according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P is obtained.
  • the upload rate is used as the initial P2P upload rate and the current P2P traffic ratio as the initial P2P traffic.
  • the statistics unit is further configured to perform the following steps:
  • B3 determining whether the time of the second timer is greater than or equal to a second preset time interval, if greater than or equal to the second preset time interval, executing b5; otherwise, executing b4;
  • B4 clear the statistical time of the first timer, the first timer restarts the statistical time, and then executes b2;
  • B6 Calculate the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the statistical time of the second timer.
  • the CDN download probability update ratio is preset, or is decreased according to a preset ratio when the current P2P upload rate is smaller than the initial P2P upload rate and greater than a preset ratio of the initial P2P upload rate. obtain.
  • the initial CDN download probability is preset and is less than or equal to 50%.
  • the acquiring module is configured to: after the downloading module selects video data in the data block in the P2P download area to be downloaded from the CDN server, use the current CDN download probability as an initial CDN download probability,
  • the current network status parameter is used as an initial network status parameter.
  • the method and device for downloading P2P data provided by the invention: setting the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance to download more video data from the CDN server, and the network bandwidth is small.
  • the low-speed client player downloads very little video data from the CDN server, and can balance different network bandwidth speeds of the client player, which can better enter
  • the P2P shares data and the CDN download probability of different client players is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved.
  • FIG. 1 is a flow chart of an embodiment of a method for downloading P2P data according to the present invention
  • FIG. 2 is a flow chart of another embodiment of a method for downloading P2P data according to the present invention.
  • FIG. 3 is a flow chart of still another embodiment of a method for downloading P2P data according to the present invention.
  • FIG. 4 is a flow chart of still another embodiment of a method for downloading P2P data according to the present invention.
  • FIG. 5 is a flowchart of still another embodiment of a method for downloading P2P data according to the present invention.
  • FIG. 6 is a schematic structural diagram of an embodiment of a device for downloading P2P data according to the present invention.
  • first device if a first device is coupled to a second device, the first device can be directly electrically coupled to the second device, or electrically coupled indirectly through other devices or coupling means. Connected to the second device.
  • FIG. 1 is a schematic diagram of a P2P data downloading method according to Embodiment 1 of the present invention; as shown in FIG. 1 , it may specifically include:
  • S101 Acquire initial CDN download probability, initial network status parameter, and current network status parameter; wherein, the initial CDN download probability indicates a probability that video data in the initially set data block in the P2P download area is selected to be downloaded from the CDN server.
  • the initial network condition parameter may include an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount.
  • the current network status parameter may include a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload amount.
  • S102 Compare the current network status parameter with the initial network status parameter, and update the initial CDN download probability according to the comparison result to obtain a current CDN download probability.
  • the initial CDN download probability can be improved. Obtaining the current CDN download probability, increasing the probability that the video data in the data block in the P2P download area is downloaded from the CDN server. If the current network condition is worse than the initial network condition, the initial CDN download probability can be reduced to obtain the current CDN download probability, and the probability is reduced. The probability that the video data in the data block in the P2P download area is downloaded from the CDN server, so that the network player with good network status can download more video data from the CDN server and share it to the client with poor network status. The player is used.
  • S103 Select video data in the data block in the P2P download area to be downloaded from the CDN server according to the current CDN download probability.
  • the current CDN download probability in this embodiment is performed on the initial CDN download probability.
  • the update obtained, that is, the CDN download probability in this embodiment is not fixed, but is changed in real time according to the current network condition.
  • the P2P data downloading method described in this embodiment sets the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance to download more video data from the CDN server, and the network bandwidth is small.
  • the low-speed client player downloads very little video data from the CDN server can balance different network bandwidth network speed client players, can better P2P share data; and, different client player CDN
  • the download probability is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved.
  • the initial network condition parameter includes an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount
  • the current network status parameter includes a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload. See Figure 2, S101 obtains the initial CDN download probability, initial network status parameters, and current network status parameters, including:
  • S101a Acquire an initial CDN download probability returned by the playback server, and initialize an initial P2P upload rate, an initial P2P traffic ratio, and a CDN download probability update ratio.
  • the play server may set an initial CDN download probability.
  • the initial CDN download probability may be obtained from the play server, and the video in a data block in the P2P download area is first selected by using the initial CDN download probability. Whether the data is downloaded from the CDN server.
  • the value of the initial CDN downloading probability can be set according to the actual application status, for example, it can be set to 10%, 15%, etc., which is not specifically limited.
  • the P2P traffic ratio is: (P2P traffic/video traffic)%, wherein the P2P traffic represents the sum of the P2P download amount and the P2P upload amount in a certain period of time, and the video traffic indicates the CDN download amount and the P2P download amount in a certain period of time. Sum.
  • the P2P upload rate is (P2P upload amount/video traffic)%.
  • the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio are initialized, and the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio are set to initial values, an initial P2P upload rate, and an initial.
  • P2P traffic ratio and CDN download probability The initial value of the update ratio may be set according to the actual application status. In this embodiment, the initial value of the initial P2P upload rate and the initial P2P traffic ratio is set to 0, and the initial value of the CDN download probability update ratio is set to 5%.
  • S101b Statistics the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval.
  • the preset time interval may be set according to actual application conditions, such as setting to 90 seconds, 100 seconds, 270 seconds, and the like. Moreover, the preset time interval can be set not only as a fixed interval but also as a changeable one.
  • the statistics are started when the P2P engine successfully establishes a connection with the play server and determines that the p2p data interaction can be performed.
  • the current P2P download amount, the current P2P upload amount, and the current CDN download in the preset time interval are counted in this embodiment.
  • the method of quantity is as follows:
  • the first preset time interval and the second preset time interval are set, and the second preset time interval is greater than the first preset time interval.
  • the current P2P download amount, the current P2P upload amount, and the current CDN download amount are not necessarily calculated.
  • the second preset time interval is reached, the current P2P download amount and the current P2P upload must be calculated. Volume and current CDN downloads.
  • the first timer and the second timer are set to start timing at the same time.
  • the first preset time interval may be set according to an actual application condition, which is not limited thereto, and is set to 90 seconds in this embodiment.
  • the preset statistical end probability is used to determine whether to end the statistics of the first timer.
  • the preset statistical end probability may be set according to the actual application status, which is not limited, and is set to 50% in this embodiment.
  • B3 determining whether the time of the second timer is greater than or equal to the second preset time interval, if greater than Equal to the second preset time interval, then b5 is performed; otherwise, b4 is executed.
  • the second preset time interval is greater than the first preset time interval, and the second preset time interval may be set according to the actual application condition, which is not limited thereto, and is set to 270 seconds in this embodiment.
  • B4 The statistical time of the first timer is cleared, the first timer restarts the counting time, and then b2 is executed.
  • B6 Calculate the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the statistical time of the second timer.
  • S101c Calculate the current P2P upload rate and the current P2P traffic ratio according to the current P2P download amount, the current P2P upload amount, and the current CDN download amount.
  • the P2P traffic ratio is: (P2P traffic/video traffic)%, wherein the P2P traffic represents the sum of the P2P download amount and the P2P upload amount in a certain period of time, and the video traffic indicates the CDN download amount and the P2P download amount in a certain period of time. Sum. Therefore, the current P2P download amount and the current P2P upload amount are summed to obtain the current P2P traffic, the current P2P download amount and the current CDN download amount are summed to obtain the current video traffic, and the current P2P traffic ratio is obtained through the current P2P traffic and the current video traffic.
  • the current P2P traffic is summed to obtain the current P2P traffic, and the current P2P traffic and the current CDN download are summed to obtain the current video traffic, and the current P2P traffic ratio is obtained according to the current P2P traffic and the current video traffic.
  • the P2P upload rate is (P2P upload amount/video traffic)%. Therefore, according to the current P2P upload amount and the current video traffic obtained above, the current P2P upload rate is obtained.
  • S101d Calculate the CDN prefetch data amount according to the current P2P download amount, the current CDN download amount, and the initial CDN download probability.
  • the CDN prefetch data amount indicates that the amount of data downloaded from the CDN is selected by the CDN download probability within a certain period of time, and the CDN prefetch data amount is: CDN download probability* video traffic.
  • the current P2P download amount and the current CDN download amount are summed to obtain the current video traffic, and the initial CDN prefetch data amount is: initial CDN download probability* current video traffic.
  • the P2P data downloading method described in this embodiment sets the CDN download probability according to the network condition.
  • the client player with high network bandwidth and high network speed has a greater chance of downloading more video data from the CDN server, and the network player with low network speed and low network speed downloads a small amount of video data from the CDN server, which can balance different
  • the network bandwidth network speed client player can better perform P2P sharing data; and the CDN download probability of different client players is dynamically changed according to the previous CDN download probability, which is not easy to be downloaded from the CDN server. More video data can further improve the P2P download rate.
  • the initial network status parameters include the initial P2P upload rate, the initial P2P traffic ratio, and the CDN prefetch data volume.
  • the current network status parameters include the current P2P upload rate, the current P2P traffic ratio, and the current P2P upload amount, the P2P upload rate, the P2P traffic ratio, and the P2P.
  • the amount of uploading and the amount of CDN prefetched data are conveniently obtained, and the present invention is facilitated.
  • S102 compares the current network status parameter with the initial network status parameter, and updates the initial CDN download probability according to the comparison result to obtain the current CDN download probability, including:
  • S102a Compare the current P2P upload rate, the current P2P traffic ratio, and the current P2P upload amount with the initial P2P upload rate, the initial P2P traffic ratio, and the CDN prefetch data amount, respectively, if the current P2P upload rate is greater than the initial P2P upload rate, current If the P2P traffic ratio is greater than or equal to the initial P2P traffic ratio and the current P2P upload amount is greater than or equal to the CDN prefetch data volume, execute S102b; if the current P2P upload rate is less than the preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch For the amount of data, S101a is performed; if the current P2P upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate, then S102c is performed.
  • the preset ratio of the initial P2P upload rate that is, a part of the initial P2P upload rate, if the preset ratio is 80%, the current P2P upload rate is less than 80% of the initial P2P upload rate.
  • the preset ratio is not limited to 80%, and can be set according to the actual application. This is not specifically limited.
  • the current P2P upload rate is less than the preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch data amount, execute S101a, that is, re-acquire the initial CDN download probability, and initialize the initial network status parameter, and initialize
  • the CDN download probability update ratio is a preset value.
  • S102b The initial CDN download probability is increased according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio is used as the initial P2P traffic, and then S103 is performed.
  • S102c The initial CDN download probability is reduced according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio is used as the initial P2P traffic, and then S103 is performed. .
  • the CDN download probability update ratio is preset, or is obtained according to a preset ratio decrease when the current P2P upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate.
  • the reduction according to the preset ratio may be set according to the actual application status, for example, it may be set to be reduced to 1/2, 1/3, etc., which is not specifically limited.
  • the CDN download probability update ratio is first reduced according to the preset ratio, and then the initial CDN download probability is reduced according to the CDN download probability update ratio.
  • the initial CDN download probability is first reduced according to the CDN download probability update ratio, and then the CDN download probability update ratio is further reduced according to the preset ratio.
  • the initial CDN download probability is preset and is 50% or less, and the maximum setting is 50% because theoretically, the implementation of p2p data download requires at least two nodes, and the 50% probability can be guaranteed in two. Nodes can download the data needed by the other party and share it with each other.
  • the range of the CDN download probability is set in advance, after the current CDN download probability is obtained by performing S102b, S102d, it is also required to determine whether the current CDN download probability is within the range of the CDN download probability, if not within the range of the CDN download probability, Then, the current CDN download probability needs to be limited to the range of the CDN download probability, and then the subsequent operations are performed.
  • the current CDN download probability may be the largest of the CDN download probabilities, such as the current CDN download probability is greater than The smallest CDN download probability can take the current CDN download probability as the smallest of the CDN download probabilities.
  • the range of the CDN downloading probability is not limited to the above-mentioned range of values, and may be set according to actual application conditions, which is not limited thereto.
  • the P2P data downloading method described in this embodiment sets the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance to download more video data from the CDN server, and the network bandwidth is small.
  • the low-speed client player downloads very little video data from the CDN server can balance different network bandwidth network speed client players, can better P2P share data; and, different client player CDN
  • the download probability is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved.
  • the range of CDN download probabilities can be preset, and the CDN download probability can be controlled within a certain range to avoid downloading too much video data from the CDN server.
  • the S103 further includes:
  • S104 The current CDN download probability is used as the initial CDN download probability and the current network status parameter as the initial network status parameter, and then the step of acquiring the initial CDN download probability, the initial network status parameter, and the current network status parameter is performed by S101.
  • the operation is repeated repeatedly to adjust the CDN download probability at any time according to the network condition, so that the CDN download probability
  • the P2P data downloading method described in this embodiment sets the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance to download more from the CDN server.
  • Video data, network bandwidth, low network speed, low-speed client player downloads very little video data from CDN server can balance different network bandwidth network speed client player, can better P2P share data; and, different
  • the CDN download probability of the client player is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved. Repeated operations, dynamically change the CDN download probability in real time, and make better use of the current network status of the client player.
  • the fifth embodiment of the present invention provides a device for downloading P2P data.
  • the method may specifically include:
  • the obtaining module 201 is configured to obtain an initial CDN download probability, an initial network status parameter, and a current network status parameter, where the initial CDN download probability indicates that the video data in the data block in the initially set P2P download area is selected from the CDN server. Probability of downloading;
  • the processing module 202 is configured to compare the current network status parameter with the initial network status parameter, and update the initial CDN download probability according to the comparison result to obtain a current CDN download probability;
  • the downloading module 203 is configured to select video data in the data block in the P2P download area to be downloaded from the CDN server according to the current CDN download probability.
  • the current network status parameter includes a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload amount;
  • the obtaining module 201 further includes: a statistics unit and a calculating unit;
  • the statistics unit is configured to count the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval;
  • the calculating unit is configured to calculate a current P2P upload rate and a current P2P traffic ratio according to the current P2P download amount, the current P2P upload amount, and the current CDN download amount.
  • the initial network condition parameter includes an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount, and the CDN prefetch data amount is calculated according to the current P2P download amount, the current CDN download amount, and the initial CDN download probability, and the processing module 202 Further comprising: a probability adjustment unit,
  • the current P2P upload rate is greater than the initial P2P upload rate, the current P2P If the traffic ratio is greater than or equal to the initial P2P traffic ratio and the current P2P upload amount is greater than or equal to the CDN prefetch data volume, the initial CDN download probability is increased according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is made.
  • the initial P2P upload rate and the current P2P traffic ratio are used as initial P2P traffic;
  • the probability adjustment unit is further configured to: if the current P2P upload rate is less than a preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch data amount, re-acquire the initial CDN download probability, and initialize the initial network status parameter, and initialize
  • the CDN download probability update ratio is a preset value
  • the probability adjustment unit is further configured to: if the current P2P upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate, reduce the initial CDN download probability according to the CDN download probability update ratio, and obtain the current CDN download probability. And the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio as the initial P2P traffic.
  • the CDN download probability update ratio is preset, or is obtained according to a preset ratio decrease when the current P2P upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate.
  • the initial CDN download probability is preset and is 50% or less.
  • the device for downloading P2P data sets the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance of downloading more video data and network bandwidth from the CDN server.
  • the low-speed client player downloads very little video data from the CDN server, can balance different network bandwidth network speed client players, can better P2P share data; and, different client player CDN
  • the download probability is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved.
  • the initial network status parameters include the initial P2P upload rate, the initial P2P traffic ratio, and the CDN prefetch data volume.
  • the current network status parameters include the current P2P upload rate, the current P2P traffic ratio, and the current P2P upload amount, the P2P upload rate, the P2P traffic ratio, and the P2P.
  • the amount of uploading and the amount of CDN prefetched data are conveniently obtained, and the present invention is facilitated. Repeated operations, dynamically change the CDN download probability in real time, and make better use of the current network status of the client player.
  • the device corresponds to the foregoing method flow description, and the deficiencies refer to the description of the above method flow, and will not be further described.
  • the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed.
  • the foregoing steps include the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Abstract

Provided are a P2P data downloading method and apparatus, which belong to the technical field of computer communications. The method comprises: acquiring an initial CDN downloading probability, an initial network condition parameter and a current network condition parameter, wherein the initial CDN downloading probability indicates an initially set probability that video data in a data block of a P2P downloading region is chosen to be downloaded from a CDN server; comparing the current network condition parameter with the initial network condition parameter, and updating the initial CDN downloading probability to obtain a current CDN downloading probability according to a comparison result; and choosing to download the video data in the data block of the P2P downloading region from the CDN server according to the current CDN downloading probability. The apparatus comprises: an acquiring module, a processing module and a downloading module. P2P data may be better shared, and further improvement of a P2P downloading rate may be realized.

Description

一种P2P数据下载的方法和装置Method and device for downloading P2P data 技术领域Technical field
本发明涉及计算机通信技术,尤其涉及一种P2P数据下载的方法和装置。The present invention relates to computer communication technologies, and in particular, to a method and apparatus for P2P data downloading.
背景技术Background technique
随着计算机通信技术的发展,越来越多的用户通过计算机在线观看视频。在线观看视频时,客户端播放器通过http(HyperText Transfer Protocol,超文本传输协议)协议从CDN(Content Delivery Network,内容分发网络)服务器下载视频数据进行在线播放。而为了提高视频数据的下载速度同时减小客户端播放器对CDN服务器的访问压力和带宽,客户端播放器采取了P2P(peer-to-peer,对等计算)下载功能(即客户端播放器与其他客户端播放器建立连接分享数据,客户端播放器可以从其他客户端播放器中下载客户端播放器中没有的视频数据,其他客户端播放器可以从客户端播放器中下载其他客户端播放器中没有的视频数据)。目前P2P数据下载的方法具体如下:参见图1,在客户端播放器的播放点的正方向依次设置紧急区和P2P下载区,其中,紧急区的视频数据是客户端播放器马上就要播放使用到的视频数据,因此紧急区的视频数据主要从CDN服务器直接下载,P2P下载区的视频数据主要从其他客户端播放器中下载,紧急区和P2P下载区中的每个方格代表一个数据块,该数据块是视频播放、http下载、P2P下载及分享的基本数据单位。然而,由于直播状态下,所有客户端播放器的播放进度基本都在同一个时间点上,各客户端播放器之间获取视频数据下载的进度和所拥有的视频数据也基本相同(即我有的视频数据别人也有,我没有的视频数据别人也没有),这种情况将导致各客户端播放器之间没有机会进行P2P分享数据,最终客户端播放器的数据都要从CDN服务器下载,P2P的作用受到了很大限制。With the development of computer communication technology, more and more users watch videos online through computers. When watching a video online, the client player downloads video data from a CDN (Content Delivery Network) server via the http (HyperText Transfer Protocol) protocol for online playback. In order to improve the download speed of the video data and reduce the access pressure and bandwidth of the client player to the CDN server, the client player adopts a P2P (peer-to-peer) download function (ie, the client player). Sharing data with other client players, the client player can download video data that is not in the client player from other client players, and other client players can download other clients from the client player. Video data not available in the player). The current P2P data downloading method is as follows: Referring to FIG. 1, the emergency zone and the P2P download zone are sequentially set in the positive direction of the playback point of the client player, wherein the video data of the emergency zone is to be played by the client player. Video data, so the video data in the emergency area is mainly downloaded directly from the CDN server. The video data in the P2P download area is mainly downloaded from other client players. Each square in the emergency area and the P2P download area represents a data block. The data block is the basic data unit for video playback, http download, P2P download and sharing. However, due to the live broadcast status, the playback progress of all client players is basically at the same time point, and the progress of downloading video data between each client player is basically the same as that of the video data owned (ie, I have The video data is also available to others, and I don't have any video data.) This situation will result in no P2P sharing data between the client players. Finally, the client player data must be downloaded from the CDN server. P2P The role is greatly limited.
为了解决直播状态存在的上述问题,对于直播状态,目前P2P数据下载的方法具体如下:在设置P2P下载区时,对P2P下载区内的每一数据块分别进行一次概率为n%的选取,选中的数据块中的视频数据从CDN服务器中下 载,这样就会使各客户端播放器之间产生拥有视频数据的差异(即我有的视频数据别人没有,别人有的视频数据我没有),从而使在直播状态下,各客户端播放器能够有机会分享数据。In order to solve the above problems in the live broadcast state, for the live broadcast state, the current P2P data download method is specifically as follows: when setting the P2P download area, each data block in the P2P download area is once selected with a probability of n%, and selected. Video data in the data block from the CDN server Load, this will make the difference between the video player data generated by each client player (that is, I have no video data others, others have video data I did not), so that in the live state, each client player Have the opportunity to share data.
然而,实际应用中各客户端播放器的网络带宽不同,从CDN服务器下载视频数据时的速率也不相同,如果各客户端播放器均是选取概率为n%的固定值,则网络带宽小网速低的客户端播放器从CDN服务器下载视频数据时需要很长时间才能下载完成,影响P2P分享数据;且无论同时进行直播的客户端播放器的总数是多少,各客户端播放器均是选取概率为n%的固定值,容易造成从CDN服务器下载了过多的视频数据,阻碍P2P下载率的进一步提高,例如:选取概率设为20%,当收看同一直播节目的客户端播放器较多时,假如达到10000个时,理论上每个客户端播放器的选取概率只需要为0.01%,通过P2P分享数据每个客户端播放器就可以获取到直播节目需要的所有视频数据,如果将选取概率固定为20%,必然造成从CDN服务器下载了过多的视频数据。However, in actual applications, the network bandwidth of each client player is different, and the rate of downloading video data from the CDN server is also different. If each client player has a fixed value of n%, the network bandwidth is small. The low-speed client player takes a long time to download the video data from the CDN server, which affects the P2P sharing data; and regardless of the total number of client players that are simultaneously broadcasted, each client player is selected. A fixed value of n% is likely to cause excessive video data to be downloaded from the CDN server, which hinders further improvement of the P2P download rate. For example, the selection probability is set to 20%, and when there are more client players watching the same live program. If it reaches 10,000, in theory, the selection probability of each client player only needs to be 0.01%. By P2P sharing data, each client player can obtain all the video data needed for the live program, if the probability is selected. Fixed at 20%, inevitably caused too much video data to be downloaded from the CDN server.
发明内容Summary of the invention
为了解决现有技术的问题,本发明提供了一种P2P数据下载的方法和装置,可以平衡不同的网络带宽网速的客户端播放器,可以更好地进行P2P分享数据;可以实现P2P下载率的进一步提高。In order to solve the problems of the prior art, the present invention provides a P2P data downloading method and device, which can balance different network bandwidth network speed client players, can better perform P2P sharing data; and can realize P2P download rate. Further improvement.
为了解决现有技术的问题,本发明公开了一种P2P数据下载的方法,所述方法包括:In order to solve the problems of the prior art, the present invention discloses a method for P2P data downloading, the method comprising:
获取初始CDN下载概率、初始网络状况参数和当前网络状况参数;其中,所述初始CDN下载概率表示初始设定的P2P下载区内的数据块中的视频数据被选取从CDN服务器中下载的概率;Obtaining an initial CDN download probability, an initial network status parameter, and a current network status parameter; wherein the initial CDN download probability indicates a probability that video data in the initially set data block in the P2P download area is selected to be downloaded from the CDN server;
将所述当前网络状况参数与所述初始网络状况参数进行比较,根据比较结果,对所述初始CDN下载概率进行更新得到当前CDN下载概率;Comparing the current network status parameter with the initial network status parameter, and updating the initial CDN download probability according to the comparison result to obtain a current CDN download probability;
根据所述当前CDN下载概率,选取所述P2P下载区内的数据块中的视频数据从所述CDN服务器中下载。And selecting video data in the data block in the P2P download area to be downloaded from the CDN server according to the current CDN download probability.
进一步地,所述当前网络状况参数包括当前P2P上传率、当前P2P流量 比率和当前P2P上传量;获取当前网络状况参数,包括:Further, the current network status parameter includes a current P2P upload rate and current P2P traffic. Ratio and current P2P upload volume; get current network status parameters, including:
统计预设时间间隔内的当前P2P下载量、所述当前P2P上传量和当前CDN下载量;Counting the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval;
根据所述当前P2P下载量、所述当前P2P上传量和所述当前CDN下载量,计算所述当前P2P上传率、所述当前P2P流量比率。And calculating the current P2P upload rate and the current P2P traffic ratio according to the current P2P download amount, the current P2P upload amount, and the current CDN download amount.
进一步地,所述初始网络状况参数包括初始P2P上传率、初始P2P流量比率和CDN预取数据量,所述CDN预取数据量根据所述当前P2P下载量、所述当前CDN下载量和所述初始CDN下载概率计算得到;获取初始CDN下载概率、初始网络状况参数包括:获取播放服务器返回的初始CDN下载概率,并对初始P2P上传率、初始P2P流量比率和CDN下载概率更新比例进行初始化。Further, the initial network condition parameter includes an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount, and the CDN prefetch data amount is according to the current P2P download amount, the current CDN download amount, and the The initial CDN download probability is obtained; obtaining the initial CDN download probability and the initial network condition parameter includes: obtaining an initial CDN download probability returned by the play server, and initializing the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio.
将所述当前网络状况参数与所述初始网络状况参数进行比较,根据比较结果,对所述初始CDN下载概率进行更新得到当前CDN下载概率,包括:Comparing the current network status parameter with the initial network status parameter, and updating the initial CDN download probability according to the comparison result to obtain a current CDN download probability, including:
如果所述当前P2P上传率大于所述初始P2P上传率、所述当前P2P流量比率大于等于所述初始P2P流量比率并且所述当前P2P上传量大于等于所述CDN预取数据量,则将所述初始CDN下载概率,按照CDN下载概率更新比例进行增加,得到所述当前CDN下载概率,并将所述当前P2P上传率做为所述初始P2P上传率、所述当前P2P流量比率做为所述初始P2P流量;And if the current P2P upload rate is greater than the initial P2P upload rate, the current P2P traffic ratio is greater than or equal to the initial P2P traffic ratio, and the current P2P upload amount is greater than or equal to the CDN prefetched data amount, The initial CDN download probability is increased according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio as the initial P2P traffic;
如果所述当前P2P上传率小于所述初始P2P上传率的预设比例、或者所述当前P2P上传量小于所述CDN预取数据量,则重新计算所述当前P2P上传率、所述当前P2P流量比率和所述当前P2P上传量,则重新获取所述初始CDN下载概率,并初始化所述初始网络状况参数,初始化所述CDN下载概率更新比例为预设值;Recalculating the current P2P upload rate and the current P2P traffic, if the current P2P upload rate is less than a preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch data amount. And the current P2P upload amount, re-acquiring the initial CDN download probability, and initializing the initial network status parameter, and initializing the CDN download probability update ratio to a preset value;
如果所述当前P2P上传率小于所述初始P2P上传率且大于所述初始P2P上传率的预设比例,则将所述初始CDN下载概率,按照所述CDN下载概率更新比例进行减小,得到所述当前CDN下载概率,并将所述当前P2P上传率做为所述初始P2P上传率、所述当前P2P流量比率做为所述初始P2P流量。If the current P2P upload rate is smaller than the initial P2P upload rate and greater than a preset ratio of the initial P2P upload rate, the initial CDN download probability is reduced according to the CDN download probability update ratio, and the obtained The current CDN download probability is described, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio is used as the initial P2P traffic.
进一步地,所述CDN下载概率更新比例为预先设定,或在所述当前P2P 上传率小于所述初始P2P上传率且大于所述初始P2P上传率的预设比例时按照预设比例减小而获得。进一步地,所述初始CDN下载概率预先设定且小于等于50%。Further, the CDN download probability update ratio is preset, or in the current P2P When the upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate, it is obtained according to a preset ratio reduction. Further, the initial CDN download probability is preset and is less than or equal to 50%.
具体的,统计预设时间间隔内的当前P2P下载量、所述当前P2P上传量和当前CDN下载量,具体包括如下步骤:Specifically, the current P2P download quantity, the current P2P upload quantity, and the current CDN download quantity in the preset preset time interval include the following steps:
b1:在P2P引擎成功与播放服务器建立连接并确定可以进行p2p数据交互时,开始通过第一计时器和第二计时器统计时间;B1: when the P2P engine successfully establishes a connection with the play server and determines that the p2p data interaction can be performed, the time is counted by the first timer and the second timer;
b2:当第一计时器的统计时间达到第一预设时间间隔时,通过预设统计结束概率确定是否结束所述第一计时器的统计,如果确定结束所述第一计时器的统计,则执行b6;否则,执行b3;B2: when the statistical time of the first timer reaches the first preset time interval, determining whether to end the statistics of the first timer by using a preset statistical end probability, and if it is determined to end the statistics of the first timer, Execute b6; otherwise, execute b3;
b3:判断所述第二计时器的时间是否大于等于第二预设时间间隔,如果大于等于所述第二预设时间间隔,则执行b5;否则,执行b4;B3: determining whether the time of the second timer is greater than or equal to a second preset time interval, if greater than or equal to the second preset time interval, executing b5; otherwise, executing b4;
b4:将所述第一计时器的统计时间清零,所述第一计时器重新开始统计时间,然后执行b2;B4: clear the statistical time of the first timer, the first timer restarts the statistical time, and then executes b2;
b5:所述第二计时器结束统计,然后执行b6;B5: the second timer ends the statistics, and then executes b6;
b6:计算所述第二计时器的统计时间内的当前P2P下载量、当前P2P上传量和当前CDN下载量。B6: Calculate the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the statistical time of the second timer.
具体的,选取所述P2P下载区内的数据块中的视频数据从所述CDN服务器中下载之后,进一步包括:Specifically, after the video data in the data block in the P2P download area is downloaded from the CDN server, the method further includes:
将所述当前CDN下载概率作为初始CDN下载概率、所述当前网络状况参数作为初始网络状况参数。The current CDN download probability is used as an initial CDN download probability and the current network status parameter as an initial network status parameter.
为了解决现有技术的问题,本发明还公开了一种P2P数据下载的装置,所述装置包括:In order to solve the problems of the prior art, the present invention also discloses an apparatus for downloading P2P data, the apparatus comprising:
获取模块,用于获取初始CDN下载概率、初始网络状况参数和当前网络状况参数;其中,所述初始CDN下载概率表示初始设定的P2P下载区内的数据块中的视频数据被选取从CDN服务器中下载的概率;An obtaining module, configured to obtain an initial CDN download probability, an initial network status parameter, and a current network status parameter; wherein the initial CDN download probability indicates that video data in a data block in an initially set P2P download area is selected from a CDN server The probability of downloading;
处理模块,用于将所述当前网络状况参数与所述初始网络状况参数进行 比较,根据比较结果,对所述初始CDN下载概率进行更新得到当前CDN下载概率;a processing module, configured to perform the current network status parameter and the initial network status parameter Comparing, according to the comparison result, updating the initial CDN download probability to obtain a current CDN download probability;
下载模块,用于根据所述当前CDN下载概率,选取所述P2P下载区内的数据块中的视频数据从所述CDN服务器中下载。And a downloading module, configured to select video data in the data block in the P2P download area to be downloaded from the CDN server according to the current CDN download probability.
进一步地,所述当前网络状况参数包括当前P2P上传率、当前P2P流量比率和当前P2P上传量;所述获取模块进一步包括:统计单元和计算单元;Further, the current network status parameter includes a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload amount; the obtaining module further includes: a statistics unit and a calculating unit;
所述统计单元,用于统计预设时间间隔内的当前P2P下载量、所述当前P2P上传量和当前CDN下载量;The statistics unit is configured to count the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval;
所述计算单元,用于根据所述当前P2P下载量、所述当前P2P上传量和所述当前CDN下载量,计算所述当前P2P上传率、所述当前P2P流量比率。The calculating unit is configured to calculate the current P2P upload rate and the current P2P traffic ratio according to the current P2P download amount, the current P2P upload amount, and the current CDN download amount.
进一步地,所述初始网络状况参数包括初始P2P上传率、初始P2P流量比率和CDN预取数据量,所述CDN预取数据量根据所述当前P2P下载量、所述当前CDN下载量和所述初始CDN下载概率计算得到;获取初始CDN下载概率、初始网络状况参数包括:获取播放服务器返回的初始CDN下载概率,并对初始P2P上传率、初始P2P流量比率和CDN下载概率更新比例进行初始化。Further, the initial network condition parameter includes an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount, and the CDN prefetch data amount is according to the current P2P download amount, the current CDN download amount, and the The initial CDN download probability is obtained; obtaining the initial CDN download probability and the initial network condition parameter includes: obtaining an initial CDN download probability returned by the play server, and initializing the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio.
所述处理模块进一步包括:概率调节单元,The processing module further includes: a probability adjustment unit,
所述概率调节单元,用于如果所述当前P2P上传率大于所述初始P2P上传率、所述当前P2P流量比率大于等于所述初始P2P流量比率并且所述当前P2P上传量大于等于所述CDN预取数据量,则将所述初始CDN下载概率,按照所述CDN下载概率更新比例进行增加,得到所述当前CDN下载概率,并将所述当前P2P上传率做为所述初始P2P上传率、所述当前P2P流量比率做为所述初始P2P流量;The probability adjustment unit is configured to: if the current P2P upload rate is greater than the initial P2P upload rate, the current P2P traffic ratio is greater than or equal to the initial P2P traffic ratio, and the current P2P upload amount is greater than or equal to the CDN pre- Taking the amount of data, the initial CDN download probability is increased according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate. Describe the current P2P traffic ratio as the initial P2P traffic;
所述概率调节单元,还用于如果所述当前P2P上传率小于所述初始P2P上传率的预设比例、或者所述当前P2P上传量小于所述CDN预取数据量,则重新获取所述初始CDN下载概率,并初始化所述初始网络状况参数,初始化所述CDN下载概率更新比例为预设值;The probability adjustment unit is further configured to re-acquire the initial if the current P2P upload rate is less than a preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch data amount. The CDN downloads the probability, and initializes the initial network condition parameter, and initializes the CDN download probability update ratio to a preset value;
所述概率调节单元,还用于如果所述当前P2P上传率小于所述初始P2P 上传率且大于所述初始P2P上传率的预设比例,则将所述初始CDN下载概率,按照所述CDN下载概率更新比例进行减小,得到所述当前CDN下载概率,并将所述当前P2P上传率做为所述初始P2P上传率、所述当前P2P流量比率做为所述初始P2P流量。The probability adjustment unit is further configured to: if the current P2P upload rate is smaller than the initial P2P If the upload rate is greater than the preset ratio of the initial P2P upload rate, the initial CDN download probability is reduced according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P is obtained. The upload rate is used as the initial P2P upload rate and the current P2P traffic ratio as the initial P2P traffic.
进一步地,所述统计单元进一步还用于执行如下步骤:Further, the statistics unit is further configured to perform the following steps:
b1:在P2P引擎成功与播放服务器建立连接并确定可以进行p2p数据交互时,开始通过第一计时器和第二计时器统计时间;B1: when the P2P engine successfully establishes a connection with the play server and determines that the p2p data interaction can be performed, the time is counted by the first timer and the second timer;
b2:当第一计时器的统计时间达到第一预设时间间隔时,通过预设统计结束概率确定是否结束所述第一计时器的统计,如果确定结束所述第一计时器的统计,则执行b6;否则,执行b3;B2: when the statistical time of the first timer reaches the first preset time interval, determining whether to end the statistics of the first timer by using a preset statistical end probability, and if it is determined to end the statistics of the first timer, Execute b6; otherwise, execute b3;
b3:判断所述第二计时器的时间是否大于等于第二预设时间间隔,如果大于等于所述第二预设时间间隔,则执行b5;否则,执行b4;B3: determining whether the time of the second timer is greater than or equal to a second preset time interval, if greater than or equal to the second preset time interval, executing b5; otherwise, executing b4;
b4:将所述第一计时器的统计时间清零,所述第一计时器重新开始统计时间,然后执行b2;B4: clear the statistical time of the first timer, the first timer restarts the statistical time, and then executes b2;
b5:所述第二计时器结束统计,然后执行b6;B5: the second timer ends the statistics, and then executes b6;
b6:计算所述第二计时器的统计时间内的当前P2P下载量、当前P2P上传量和当前CDN下载量。B6: Calculate the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the statistical time of the second timer.
进一步地,所述CDN下载概率更新比例为预先设定,或在所述当前P2P上传率小于所述初始P2P上传率且大于所述初始P2P上传率的预设比例时按照预设比例减小而获得。Further, the CDN download probability update ratio is preset, or is decreased according to a preset ratio when the current P2P upload rate is smaller than the initial P2P upload rate and greater than a preset ratio of the initial P2P upload rate. obtain.
进一步地,所述初始CDN下载概率预先设定且小于等于50%。Further, the initial CDN download probability is preset and is less than or equal to 50%.
进一步地,所述获取模块用于,在下载模块选取所述P2P下载区内的数据块中的视频数据从所述CDN服务器中下载之后,将所述当前CDN下载概率作为初始CDN下载概率、所述当前网络状况参数作为初始网络状况参数。Further, the acquiring module is configured to: after the downloading module selects video data in the data block in the P2P download area to be downloaded from the CDN server, use the current CDN download probability as an initial CDN download probability, The current network status parameter is used as an initial network status parameter.
本发明提供的P2P数据下载的方法和装置:根据网络状况设置CDN下载概率,使得网络带宽大网速高的客户端播放器有更大机会从CDN服务器下载更多的视频数据、网络带宽小网速低的客户端播放器从CDN服务器下载很少的视频数据,可以平衡不同的网络带宽网速的客户端播放器,可以更好地进 行P2P分享数据;并且,不同的客户端播放器的CDN下载概率根据之前的CDN下载概率进行动态改变,不容易造成从CDN服务器下载过多的视频数据,可以实现P2P下载率的进一步提高。The method and device for downloading P2P data provided by the invention: setting the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance to download more video data from the CDN server, and the network bandwidth is small. The low-speed client player downloads very little video data from the CDN server, and can balance different network bandwidth speeds of the client player, which can better enter The P2P shares data; and the CDN download probability of different client players is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved.
附图说明DRAWINGS
图1是本发明P2P数据下载的方法一个实施例流程图;1 is a flow chart of an embodiment of a method for downloading P2P data according to the present invention;
图2是本发明P2P数据下载的方法另一实施例流程图;2 is a flow chart of another embodiment of a method for downloading P2P data according to the present invention;
图3是本发明P2P数据下载的方法又一实施例流程图;3 is a flow chart of still another embodiment of a method for downloading P2P data according to the present invention;
图4是本发明P2P数据下载的方法再一实施例流程图;4 is a flow chart of still another embodiment of a method for downloading P2P data according to the present invention;
图5是本发明P2P数据下载的方法再一实施例流程图;FIG. 5 is a flowchart of still another embodiment of a method for downloading P2P data according to the present invention; FIG.
图6是本发明P2P数据下载的装置一个实施例结构示意图。FIG. 6 is a schematic structural diagram of an embodiment of a device for downloading P2P data according to the present invention.
具体实施方式detailed description
以下将配合附图及实施例来详细说明本发明的实施方式,藉此对本发明如何应用技术手段来解决技术问题并达成技术功效的实现过程能充分理解并据以实施。The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and embodiments, in which the present invention can be fully understood and implemented by the technical means of solving the technical problems and achieving the technical effects.
如在说明书及权利要求当中使用了某些词汇来指称特定组件。本领域技术人员应可理解,硬件制造商可能会用不同名词来称呼同一个组件。本说明书及权利要求并不以名称的差异来作为区分组件的方式,而是以组件在功能上的差异来作为区分的准则。如在通篇说明书及权利要求当中所提及的“包含”为一开放式用语,故应解释成“包含但不限定于”。“大致”是指在可接收的误差范围内,本领域技术人员能够在一定误差范围内解决所述技术问题,基本达到所述技术效果。此外,“耦接”一词在此包含任何直接及间接的电性耦接手段。因此,若文中描述一第一装置耦接于一第二装置,则代表所述第一装置可直接电性耦接于所述第二装置,或通过其他装置或耦接手段间接地电性耦接至所述第二装置。说明书后续描述为实施本发明的较佳实施方式,然所述描述乃以说明本发明的一般原则为目的,并非用以限定本发明的范围。本发明的保护范围当视所附权利要求所界定者为准。 Certain terms are used throughout the description and claims to refer to particular components. Those skilled in the art will appreciate that hardware manufacturers may refer to the same component by different nouns. The present specification and the claims do not use the difference in the name as the means for distinguishing the components, but the difference in function of the components as the criterion for distinguishing. The word "comprising" as used throughout the specification and claims is an open term and should be interpreted as "including but not limited to". "Substantially" means that within the range of acceptable errors, those skilled in the art will be able to solve the technical problems within a certain error range, substantially achieving the technical effects. In addition, the term "coupled" is used herein to include any direct and indirect electrical coupling means. Therefore, if a first device is coupled to a second device, the first device can be directly electrically coupled to the second device, or electrically coupled indirectly through other devices or coupling means. Connected to the second device. The description of the present invention is intended to be illustrative of the preferred embodiments of the invention. The scope of the invention is defined by the appended claims.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的商品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种商品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个......”限定的要素,并不排除在包括所述要素的商品或者系统中还存在另外的相同要素。It should also be noted that the terms "including", "comprising" or "comprising" or any other variations thereof are intended to encompass a non-exclusive inclusion, such that the item or system comprising a plurality of elements includes not only those elements but also Other elements, or elements that are inherent to such goods or systems. An element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the item or system including the element, without further limitation.
实施例一Embodiment 1
图1为本发明实施例一提供的一种P2P数据下载的方法;如图1所示,其可以具体包括:FIG. 1 is a schematic diagram of a P2P data downloading method according to Embodiment 1 of the present invention; as shown in FIG. 1 , it may specifically include:
S101:获取初始CDN下载概率、初始网络状况参数和当前网络状况参数;其中,初始CDN下载概率表示初始设定的P2P下载区内的数据块中的视频数据被选取从CDN服务器中下载的概率。S101: Acquire initial CDN download probability, initial network status parameter, and current network status parameter; wherein, the initial CDN download probability indicates a probability that video data in the initially set data block in the P2P download area is selected to be downloaded from the CDN server.
其中,初始网络状况参数可以包括初始P2P上传率、初始P2P流量比率和CDN预取数据量。当前网络状况参数可以包括当前P2P上传率、当前P2P流量比率和当前P2P上传量。The initial network condition parameter may include an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount. The current network status parameter may include a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload amount.
S102:将当前网络状况参数与初始网络状况参数进行比较,根据比较结果,对初始CDN下载概率进行更新得到当前CDN下载概率。S102: Compare the current network status parameter with the initial network status parameter, and update the initial CDN download probability according to the comparison result to obtain a current CDN download probability.
具体地,通过将当前网络状况参数与初始网络状况参数进行比较,根据比较结果可以知道当前网络状况是不是比初始网络状况好,如当前网络状况比初始网络状况好,则可以提高初始CDN下载概率得到当前CDN下载概率,增加P2P下载区内的数据块中的视频数据从CDN服务器中下载的概率,如当前网络状况比初始网络状况差,则可以降低初始CDN下载概率得到当前CDN下载概率,减少P2P下载区内的数据块中的视频数据从CDN服务器中下载的概率,从而网络状态好的客户端播放器可以更快地从CDN服务器中下载更多的视频数据分享给网络状态差的客户端播放器使用。Specifically, by comparing the current network condition parameter with the initial network condition parameter, according to the comparison result, it can be known whether the current network condition is better than the initial network condition, and if the current network condition is better than the initial network condition, the initial CDN download probability can be improved. Obtaining the current CDN download probability, increasing the probability that the video data in the data block in the P2P download area is downloaded from the CDN server. If the current network condition is worse than the initial network condition, the initial CDN download probability can be reduced to obtain the current CDN download probability, and the probability is reduced. The probability that the video data in the data block in the P2P download area is downloaded from the CDN server, so that the network player with good network status can download more video data from the CDN server and share it to the client with poor network status. The player is used.
S103:根据当前CDN下载概率,选取P2P下载区内的数据块中的视频数据从CDN服务器中下载。S103: Select video data in the data block in the P2P download area to be downloaded from the CDN server according to the current CDN download probability.
具体地,本实施例中的当前CDN下载概率是对初始CDN下载概率进行 更新得到的,即本实施例中CDN下载概率不是固定不变地,而是根据当前的网络状况进行实时变化。Specifically, the current CDN download probability in this embodiment is performed on the initial CDN download probability. The update obtained, that is, the CDN download probability in this embodiment is not fixed, but is changed in real time according to the current network condition.
本实施例所述的P2P数据下载的方法,根据网络状况设置CDN下载概率,使得网络带宽大网速高的客户端播放器有更大机会从CDN服务器下载更多的视频数据、网络带宽小网速低的客户端播放器从CDN服务器下载很少的视频数据,可以平衡不同的网络带宽网速的客户端播放器,可以更好地进行P2P分享数据;并且,不同的客户端播放器的CDN下载概率根据之前的CDN下载概率进行动态改变,不容易造成从CDN服务器下载过多的视频数据,可以实现P2P下载率的进一步提高。The P2P data downloading method described in this embodiment sets the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance to download more video data from the CDN server, and the network bandwidth is small. The low-speed client player downloads very little video data from the CDN server, can balance different network bandwidth network speed client players, can better P2P share data; and, different client player CDN The download probability is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved.
实施例二Embodiment 2
在本发明的一优选实施例中,当初始网络状况参数包括初始P2P上传率、初始P2P流量比率和CDN预取数据量;当前网络状况参数包括当前P2P上传率、当前P2P流量比率和当前P2P上传量;参见图2,S101获取初始CDN下载概率、初始网络状况参数和当前网络状况参数,包括:In a preferred embodiment of the present invention, the initial network condition parameter includes an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount; the current network status parameter includes a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload. See Figure 2, S101 obtains the initial CDN download probability, initial network status parameters, and current network status parameters, including:
S101a:获取播放服务器返回的初始CDN下载概率,并对初始P2P上传率、初始P2P流量比率和CDN下载概率更新比例进行初始化。S101a: Acquire an initial CDN download probability returned by the playback server, and initialize an initial P2P upload rate, an initial P2P traffic ratio, and a CDN download probability update ratio.
具体地,播放服务器可以设置一个初始CDN下载概率,当客户端播放器初始启动后,可以从播放服务器获取初始CDN下载概率,先使用初始CDN下载概率选取P2P下载区内的某数据块中的视频数据是否从CDN服务器中下载。初始的CDN下载概率的取值可以根据实际应用状况进行设置,如可以设置为10%、15%等,对此不做具体限定。Specifically, the play server may set an initial CDN download probability. After the client player is initially started, the initial CDN download probability may be obtained from the play server, and the video in a data block in the P2P download area is first selected by using the initial CDN download probability. Whether the data is downloaded from the CDN server. The value of the initial CDN downloading probability can be set according to the actual application status, for example, it can be set to 10%, 15%, etc., which is not specifically limited.
具体地,P2P流量比率为:(P2P流量/视频流量)%,其中,P2P流量表示一定时间内的P2P下载量与P2P上传量之和,视频流量表示一定时间内的CDN下载量与P2P下载量之和。P2P上传率为(P2P上传量/视频流量)%。Specifically, the P2P traffic ratio is: (P2P traffic/video traffic)%, wherein the P2P traffic represents the sum of the P2P download amount and the P2P upload amount in a certain period of time, and the video traffic indicates the CDN download amount and the P2P download amount in a certain period of time. Sum. The P2P upload rate is (P2P upload amount/video traffic)%.
具体地,对初始P2P上传率、初始P2P流量比率和CDN下载概率更新比例进行初始化,是将初始P2P上传率、初始P2P流量比率和CDN下载概率更新比例设置为初始值,初始P2P上传率、初始P2P流量比率和CDN下载概率 更新比例的初始值可以根据实际应用状况进行设置,本实施例中初始P2P上传率、初始P2P流量比率的初始值设置为0,CDN下载概率更新比例的初始值设置为5%。Specifically, the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio are initialized, and the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio are set to initial values, an initial P2P upload rate, and an initial. P2P traffic ratio and CDN download probability The initial value of the update ratio may be set according to the actual application status. In this embodiment, the initial value of the initial P2P upload rate and the initial P2P traffic ratio is set to 0, and the initial value of the CDN download probability update ratio is set to 5%.
S101b:统计预设时间间隔内的当前P2P下载量、当前P2P上传量和当前CDN下载量。S101b: Statistics the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval.
其中,预设时间间隔可以根据实际应用状况进行设置,如设置为90秒、100秒、270秒等。并且,预设时间间隔不仅可以设置为一个固定的区间,也可以设置为一个可变化的。The preset time interval may be set according to actual application conditions, such as setting to 90 seconds, 100 seconds, 270 seconds, and the like. Moreover, the preset time interval can be set not only as a fixed interval but also as a changeable one.
具体地,在P2P引擎成功与播放服务器建立连接并确定可以进行p2p数据交互时开始统计,参见图3,本实施例统计预设时间间隔内的当前P2P下载量、当前P2P上传量和当前CDN下载量的方法如下:Specifically, the statistics are started when the P2P engine successfully establishes a connection with the play server and determines that the p2p data interaction can be performed. Referring to FIG. 3, the current P2P download amount, the current P2P upload amount, and the current CDN download in the preset time interval are counted in this embodiment. The method of quantity is as follows:
b1:在P2P引擎成功与播放服务器建立连接并确定可以进行p2p数据交互时,开始通过第一计时器和第二计时器统计时间。B1: When the P2P engine successfully establishes a connection with the play server and determines that p2p data interaction can be performed, the time is counted by the first timer and the second timer.
本实施例中设置了第一预设时间间隔和第二预设时间间隔,第二预设时间间隔大于第一预设时间间隔。在第一预设时间间隔达到后,不一定开始计算当前P2P下载量、当前P2P上传量和当前CDN下载量;在第二预设时间间隔达到后,一定开始计算当前P2P下载量、当前P2P上传量和当前CDN下载量。为便于记录比较不同的时间间隔,此处设置第一计时器和第二计时器同时启动进行计时。In this embodiment, the first preset time interval and the second preset time interval are set, and the second preset time interval is greater than the first preset time interval. After the first preset time interval is reached, the current P2P download amount, the current P2P upload amount, and the current CDN download amount are not necessarily calculated. After the second preset time interval is reached, the current P2P download amount and the current P2P upload must be calculated. Volume and current CDN downloads. In order to facilitate the recording to compare different time intervals, the first timer and the second timer are set to start timing at the same time.
b2:当第一计时器的统计时间达到第一预设时间间隔时,通过预设统计结束概率确定是否结束第一计时器的统计,如果确定结束第一计时器的统计,则执行b6;否则,执行b3。B2: When the statistics time of the first timer reaches the first preset time interval, determine whether to end the statistics of the first timer by using a preset statistical end probability, and if it is determined to end the statistics of the first timer, execute b6; otherwise , execute b3.
具体地,第一预设时间间隔可以根据实际应用状况进行设置,对此不做限定,本实施例将其设置为90秒。Specifically, the first preset time interval may be set according to an actual application condition, which is not limited thereto, and is set to 90 seconds in this embodiment.
具体地,预设统计结束概率用于决定是否结束第一计时器的统计,预设统计结束概率可以根据实际应用状况进行设置,对此不做限定,本实施例将其设置为50%。Specifically, the preset statistical end probability is used to determine whether to end the statistics of the first timer. The preset statistical end probability may be set according to the actual application status, which is not limited, and is set to 50% in this embodiment.
b3:判断第二计时器的时间是否大于等于第二预设时间间隔,如果大于 等于第二预设时间间隔,则执行b5;否则,执行b4。B3: determining whether the time of the second timer is greater than or equal to the second preset time interval, if greater than Equal to the second preset time interval, then b5 is performed; otherwise, b4 is executed.
具体地,第二预设时间间隔大于第一预设时间间隔,第二预设时间间隔可以根据实际应用状况进行设置,对此不做限定,本实施例将其设置为270秒。Specifically, the second preset time interval is greater than the first preset time interval, and the second preset time interval may be set according to the actual application condition, which is not limited thereto, and is set to 270 seconds in this embodiment.
b4:将第一计时器的统计时间清零,第一计时器重新开始统计时间,然后执行b2。B4: The statistical time of the first timer is cleared, the first timer restarts the counting time, and then b2 is executed.
b5:第二计时器结束统计,然后执行b6。B5: The second timer ends the statistics, and then b6 is executed.
b6:计算第二计时器的统计时间内的当前P2P下载量、当前P2P上传量和当前CDN下载量。B6: Calculate the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the statistical time of the second timer.
S101c:根据当前P2P下载量、当前P2P上传量和当前CDN下载量,计算当前P2P上传率、当前P2P流量比率。S101c: Calculate the current P2P upload rate and the current P2P traffic ratio according to the current P2P download amount, the current P2P upload amount, and the current CDN download amount.
具体地,P2P流量比率为:(P2P流量/视频流量)%,其中,P2P流量表示一定时间内的P2P下载量与P2P上传量之和,视频流量表示一定时间内的CDN下载量与P2P下载量之和。从而将当前P2P下载量和当前P2P上传量求和得到当前P2P流量,将当前P2P下载量和当前CDN下载量求和得到当前视频流量,通过当前P2P流量和当前视频流量得到当前P2P流量比率。将当前P2P下载量和当前P2P上传量求和得到当前P2P流量,将当前P2P下载量和当前CDN下载量求和得到当前视频流量,根据当前P2P流量和当前视频流量得到当前P2P流量比率。Specifically, the P2P traffic ratio is: (P2P traffic/video traffic)%, wherein the P2P traffic represents the sum of the P2P download amount and the P2P upload amount in a certain period of time, and the video traffic indicates the CDN download amount and the P2P download amount in a certain period of time. Sum. Therefore, the current P2P download amount and the current P2P upload amount are summed to obtain the current P2P traffic, the current P2P download amount and the current CDN download amount are summed to obtain the current video traffic, and the current P2P traffic ratio is obtained through the current P2P traffic and the current video traffic. The current P2P traffic is summed to obtain the current P2P traffic, and the current P2P traffic and the current CDN download are summed to obtain the current video traffic, and the current P2P traffic ratio is obtained according to the current P2P traffic and the current video traffic.
具体地,P2P上传率为(P2P上传量/视频流量)%。从而根据当前P2P上传量和上面得到的当前视频流量,得到当前P2P上传率。Specifically, the P2P upload rate is (P2P upload amount/video traffic)%. Therefore, according to the current P2P upload amount and the current video traffic obtained above, the current P2P upload rate is obtained.
S101d:根据当前P2P下载量、当前CDN下载量和初始CDN下载概率,计算CDN预取数据量。S101d: Calculate the CDN prefetch data amount according to the current P2P download amount, the current CDN download amount, and the initial CDN download probability.
具体地,CDN预取数据量表示一定时间内通过CDN下载概率选取从CDN下载的数据量,CDN预取数据量为:CDN下载概率*视频流量。从而将当前P2P下载量和当前CDN下载量求和得到当前视频流量,初始的CDN预取数据量为:初始CDN下载概率*当前视频流量。Specifically, the CDN prefetch data amount indicates that the amount of data downloaded from the CDN is selected by the CDN download probability within a certain period of time, and the CDN prefetch data amount is: CDN download probability* video traffic. Thus, the current P2P download amount and the current CDN download amount are summed to obtain the current video traffic, and the initial CDN prefetch data amount is: initial CDN download probability* current video traffic.
本实施例所述的P2P数据下载的方法,根据网络状况设置CDN下载概率, 使得网络带宽大网速高的客户端播放器有更大机会从CDN服务器下载更多的视频数据、网络带宽小网速低的客户端播放器从CDN服务器下载很少的视频数据,可以平衡不同的网络带宽网速的客户端播放器,可以更好地进行P2P分享数据;并且,不同的客户端播放器的CDN下载概率根据之前的CDN下载概率进行动态改变,不容易造成从CDN服务器下载过多的视频数据,可以实现P2P下载率的进一步提高。初始网络状况参数包括初始P2P上传率、初始P2P流量比率和CDN预取数据量,当前网络状况参数包括当前P2P上传率、当前P2P流量比率和当前P2P上传量,P2P上传率、P2P流量比率、P2P上传量和CDN预取数据量获取方便,便于实现本发明。The P2P data downloading method described in this embodiment sets the CDN download probability according to the network condition. The client player with high network bandwidth and high network speed has a greater chance of downloading more video data from the CDN server, and the network player with low network speed and low network speed downloads a small amount of video data from the CDN server, which can balance different The network bandwidth network speed client player can better perform P2P sharing data; and the CDN download probability of different client players is dynamically changed according to the previous CDN download probability, which is not easy to be downloaded from the CDN server. More video data can further improve the P2P download rate. The initial network status parameters include the initial P2P upload rate, the initial P2P traffic ratio, and the CDN prefetch data volume. The current network status parameters include the current P2P upload rate, the current P2P traffic ratio, and the current P2P upload amount, the P2P upload rate, the P2P traffic ratio, and the P2P. The amount of uploading and the amount of CDN prefetched data are conveniently obtained, and the present invention is facilitated.
实施例三Embodiment 3
在本发明的一优选实施例中,参见图4,S102将当前网络状况参数与初始网络状况参数进行比较,根据比较结果,对初始CDN下载概率进行更新得到当前CDN下载概率,包括:In a preferred embodiment of the present invention, referring to FIG. 4, S102 compares the current network status parameter with the initial network status parameter, and updates the initial CDN download probability according to the comparison result to obtain the current CDN download probability, including:
S102a:将当前P2P上传率、当前P2P流量比率和当前P2P上传量,分别与初始P2P上传率、初始P2P流量比率和CDN预取数据量进行比较,如果当前P2P上传率大于初始P2P上传率、当前P2P流量比率大于等于初始P2P流量比率并且当前P2P上传量大于等于CDN预取数据量,则执行S102b;如果当前P2P上传率小于初始P2P上传率的预设比例、或者当前P2P上传量小于CDN预取数据量,则执行S101a;如果当前P2P上传率小于初始P2P上传率且大于初始P2P上传率的预设比例,则执行S102c。S102a: Compare the current P2P upload rate, the current P2P traffic ratio, and the current P2P upload amount with the initial P2P upload rate, the initial P2P traffic ratio, and the CDN prefetch data amount, respectively, if the current P2P upload rate is greater than the initial P2P upload rate, current If the P2P traffic ratio is greater than or equal to the initial P2P traffic ratio and the current P2P upload amount is greater than or equal to the CDN prefetch data volume, execute S102b; if the current P2P upload rate is less than the preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch For the amount of data, S101a is performed; if the current P2P upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate, then S102c is performed.
具体地,初始P2P上传率的预设比例,即初始P2P上传率的一部分,如预设比例为80%,则当前P2P上传率小于初始P2P上传率的80%。预设比例并不限于取值为80%,可以根据实际应用状况进行设置,对此不做具体限定。Specifically, the preset ratio of the initial P2P upload rate, that is, a part of the initial P2P upload rate, if the preset ratio is 80%, the current P2P upload rate is less than 80% of the initial P2P upload rate. The preset ratio is not limited to 80%, and can be set according to the actual application. This is not specifically limited.
具体地,如果当前P2P上传率小于初始P2P上传率的预设比例、或者当前P2P上传量小于CDN预取数据量,则执行S101a,即重新获取初始CDN下载概率,并初始化初始网络状况参数,初始化CDN下载概率更新比例为预设值。 Specifically, if the current P2P upload rate is less than the preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch data amount, execute S101a, that is, re-acquire the initial CDN download probability, and initialize the initial network status parameter, and initialize The CDN download probability update ratio is a preset value.
S102b:将初始CDN下载概率,按照CDN下载概率更新比例进行增加,得到当前CDN下载概率,并将当前P2P上传率做为初始P2P上传率、当前P2P流量比率做为初始P2P流量,然后执行S103。S102b: The initial CDN download probability is increased according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio is used as the initial P2P traffic, and then S103 is performed.
例如:初始CDN下载概率为10%、CDN下载概率更新比例为5%,则当前CDN下载概率为:10%+5%=15%。For example, if the initial CDN download probability is 10% and the CDN download probability update ratio is 5%, the current CDN download probability is: 10%+5%=15%.
S102c:将初始CDN下载概率,按照CDN下载概率更新比例进行减小,得到当前CDN下载概率,并将当前P2P上传率做为初始P2P上传率、当前P2P流量比率做为初始P2P流量,然后执行S103。S102c: The initial CDN download probability is reduced according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio is used as the initial P2P traffic, and then S103 is performed. .
例如:初始CDN下载概率为10%、CDN下载概率更新比例为5%,则当前CDN下载概率为:10%-5%=5%。For example, if the initial CDN download probability is 10% and the CDN download probability update ratio is 5%, the current CDN download probability is: 10%-5%=5%.
具体地,CDN下载概率更新比例为预先设定,或在当前P2P上传率小于初始P2P上传率且大于初始P2P上传率的预设比例时按照预设比例减小而获得。其中,按照预设比例减小多少可以根据实际应用状况进行设置,如可以设置为减小为原来的1/2、1/3等,对此不做具体限定。Specifically, the CDN download probability update ratio is preset, or is obtained according to a preset ratio decrease when the current P2P upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate. The reduction according to the preset ratio may be set according to the actual application status, for example, it may be set to be reduced to 1/2, 1/3, etc., which is not specifically limited.
其中,CDN下载概率更新比例按照预设比例减小时,至少可以通过下面2种方法实现:Wherein, when the CDN download probability update ratio is reduced according to a preset ratio, at least the following two methods can be implemented:
1)CDN下载概率更新比例先按照预设比例减小,然后再将初始CDN下载概率,按照CDN下载概率更新比例进行减小。1) The CDN download probability update ratio is first reduced according to the preset ratio, and then the initial CDN download probability is reduced according to the CDN download probability update ratio.
例如:预设比例为1/2,则CDN下载概率更新比例deta先按照预设比例减小为:deta=deta/2;然后再将初始CDN下载概率C,按照CDN下载概率更新比例进行减小为:C=C-deta。For example, if the preset ratio is 1/2, the CDN download probability update ratio deta is first reduced to: deta=deta/2; then the initial CDN download probability C is reduced according to the CDN download probability update ratio. Is: C=C-deta.
2)初始CDN下载概率先按照CDN下载概率更新比例进行减小,然后CDN下载概率更新比例再按照预设比例减小。例如:预设比例为1/2,初始CDN下载概率C,先按照CDN下载概率更新比例进行减小为:C=C-deta;然后CDN下载概率更新比例deta再按照预设比例减小为:deta=deta/2。2) The initial CDN download probability is first reduced according to the CDN download probability update ratio, and then the CDN download probability update ratio is further reduced according to the preset ratio. For example, the preset ratio is 1/2, and the initial CDN download probability C is first reduced according to the CDN download probability update ratio: C=C-deta; then the CDN download probability update ratio deta is further reduced according to the preset ratio: Deta=deta/2.
并且,需要说明的是,初始CDN下载概率预先设定且小于等于50%,设置最大为50%是因为理论上p2p数据下载的实现最少需要两个节点,50%的概率就能保证在两个节点时可以下载到对方所需的数据并相互分享给对方。 当预先设置了CDN下载概率的范围,则在执行S 102b、S102d得到当前CDN下载概率后,还需要判断当前CDN下载概率是否在CDN下载概率的范围内,如果没有在CDN下载概率的范围内,则需要将当前CDN下载概率限制在CDN下载概率的范围内后,再执行后续的操作。将当前CDN下载概率限制在CDN下载概率的范围内,如当前CDN下载概率大于CDN下载概率的最大者,则可以将当前CDN下载概率取值为CDN下载概率的最大者,如当前CDN下载概率大于CDN下载概率的最小者,则可以将当前CDN下载概率取值为CDN下载概率的最小者。CDN下载概率的范围并不限于上述的取值范围,可以根据实际应用状况进行设置,对此不做限定。Moreover, it should be noted that the initial CDN download probability is preset and is 50% or less, and the maximum setting is 50% because theoretically, the implementation of p2p data download requires at least two nodes, and the 50% probability can be guaranteed in two. Nodes can download the data needed by the other party and share it with each other. When the range of the CDN download probability is set in advance, after the current CDN download probability is obtained by performing S102b, S102d, it is also required to determine whether the current CDN download probability is within the range of the CDN download probability, if not within the range of the CDN download probability, Then, the current CDN download probability needs to be limited to the range of the CDN download probability, and then the subsequent operations are performed. Limiting the current CDN download probability to the range of the CDN download probability. If the current CDN download probability is greater than the CDN download probability, the current CDN download probability may be the largest of the CDN download probabilities, such as the current CDN download probability is greater than The smallest CDN download probability can take the current CDN download probability as the smallest of the CDN download probabilities. The range of the CDN downloading probability is not limited to the above-mentioned range of values, and may be set according to actual application conditions, which is not limited thereto.
本实施例所述的P2P数据下载的方法,根据网络状况设置CDN下载概率,使得网络带宽大网速高的客户端播放器有更大机会从CDN服务器下载更多的视频数据、网络带宽小网速低的客户端播放器从CDN服务器下载很少的视频数据,可以平衡不同的网络带宽网速的客户端播放器,可以更好地进行P2P分享数据;并且,不同的客户端播放器的CDN下载概率根据之前的CDN下载概率进行动态改变,不容易造成从CDN服务器下载过多的视频数据,可以实现P2P下载率的进一步提高。可以预先设置CDN下载概率的范围,将CDN下载概率控制在一定范围内,避免从CDN服务器下载过多的视频数据。The P2P data downloading method described in this embodiment sets the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance to download more video data from the CDN server, and the network bandwidth is small. The low-speed client player downloads very little video data from the CDN server, can balance different network bandwidth network speed client players, can better P2P share data; and, different client player CDN The download probability is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved. The range of CDN download probabilities can be preset, and the CDN download probability can be controlled within a certain range to avoid downloading too much video data from the CDN server.
实施例四Embodiment 4
在本发明的一优选实施例中,参见图5,S103根据当前CDN下载概率,选取P2P下载区内的数据块中的视频数据从CDN服务器中下载之后,还包括:In a preferred embodiment of the present invention, referring to FIG. 5, after the video data in the data block in the P2P download area is downloaded from the CDN server according to the current CDN download probability, the S103 further includes:
S104:将当前CDN下载概率作为初始CDN下载概率、当前网络状况参数作为初始网络状况参数,然后执行S101获取初始CDN下载概率、初始网络状况参数和当前网络状况参数的步骤。S104: The current CDN download probability is used as the initial CDN download probability and the current network status parameter as the initial network status parameter, and then the step of acquiring the initial CDN download probability, the initial network status parameter, and the current network status parameter is performed by S101.
即后续不断重复进行操作,以根据网络状况随时对CDN下载概率进行调整,使CDN下载概率That is, the operation is repeated repeatedly to adjust the CDN download probability at any time according to the network condition, so that the CDN download probability
本实施例所述的P2P数据下载的方法,根据网络状况设置CDN下载概率,使得网络带宽大网速高的客户端播放器有更大机会从CDN服务器下载更多的 视频数据、网络带宽小网速低的客户端播放器从CDN服务器下载很少的视频数据,可以平衡不同的网络带宽网速的客户端播放器,可以更好地进行P2P分享数据;并且,不同的客户端播放器的CDN下载概率根据之前的CDN下载概率进行动态改变,不容易造成从CDN服务器下载过多的视频数据,可以实现P2P下载率的进一步提高。不断重复进行操作,动态实时改变CDN下载概率,更好地利用客户端播放器当前的网络状况。The P2P data downloading method described in this embodiment sets the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance to download more from the CDN server. Video data, network bandwidth, low network speed, low-speed client player downloads very little video data from CDN server, can balance different network bandwidth network speed client player, can better P2P share data; and, different The CDN download probability of the client player is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved. Repeated operations, dynamically change the CDN download probability in real time, and make better use of the current network status of the client player.
实施例五Embodiment 5
本发明实施例五提供了一种P2P数据下载的装置,参见图6,其可以具体包括:The fifth embodiment of the present invention provides a device for downloading P2P data. Referring to FIG. 6, the method may specifically include:
获取模块201,用于获取初始CDN下载概率、初始网络状况参数和当前网络状况参数;其中,初始CDN下载概率表示初始设定的P2P下载区内的数据块中的视频数据被选取从CDN服务器中下载的概率;The obtaining module 201 is configured to obtain an initial CDN download probability, an initial network status parameter, and a current network status parameter, where the initial CDN download probability indicates that the video data in the data block in the initially set P2P download area is selected from the CDN server. Probability of downloading;
处理模块202,用于将当前网络状况参数与初始网络状况参数进行比较,根据比较结果,对初始CDN下载概率进行更新得到当前CDN下载概率;The processing module 202 is configured to compare the current network status parameter with the initial network status parameter, and update the initial CDN download probability according to the comparison result to obtain a current CDN download probability;
下载模块203,用于根据当前CDN下载概率,选取P2P下载区内的数据块中的视频数据从CDN服务器中下载。The downloading module 203 is configured to select video data in the data block in the P2P download area to be downloaded from the CDN server according to the current CDN download probability.
进一步地,当前网络状况参数包括当前P2P上传率、当前P2P流量比率和当前P2P上传量;获取模块201进一步包括:统计单元和计算单元;Further, the current network status parameter includes a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload amount; the obtaining module 201 further includes: a statistics unit and a calculating unit;
统计单元,用于统计预设时间间隔内的当前P2P下载量、当前P2P上传量和当前CDN下载量;The statistics unit is configured to count the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval;
计算单元,用于根据当前P2P下载量、当前P2P上传量和当前CDN下载量,计算当前P2P上传率、当前P2P流量比率。The calculating unit is configured to calculate a current P2P upload rate and a current P2P traffic ratio according to the current P2P download amount, the current P2P upload amount, and the current CDN download amount.
进一步地,初始网络状况参数包括初始P2P上传率、初始P2P流量比率和CDN预取数据量,CDN预取数据量根据当前P2P下载量、当前CDN下载量和初始CDN下载概率计算得到,处理模块202进一步包括:概率调节单元,Further, the initial network condition parameter includes an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount, and the CDN prefetch data amount is calculated according to the current P2P download amount, the current CDN download amount, and the initial CDN download probability, and the processing module 202 Further comprising: a probability adjustment unit,
概率调节单元,用于如果当前P2P上传率大于初始P2P上传率、当前P2P 流量比率大于等于初始P2P流量比率并且当前P2P上传量大于等于CDN预取数据量,则将初始CDN下载概率,按照CDN下载概率更新比例进行增加,得到当前CDN下载概率,并将当前P2P上传率做为初始P2P上传率、当前P2P流量比率做为初始P2P流量;Probabilistic adjustment unit, if the current P2P upload rate is greater than the initial P2P upload rate, the current P2P If the traffic ratio is greater than or equal to the initial P2P traffic ratio and the current P2P upload amount is greater than or equal to the CDN prefetch data volume, the initial CDN download probability is increased according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is made. The initial P2P upload rate and the current P2P traffic ratio are used as initial P2P traffic;
概率调节单元,还用于如果当前P2P上传率小于初始P2P上传率的预设比例、或者当前P2P上传量小于CDN预取数据量,则重新获取初始CDN下载概率,并初始化初始网络状况参数,初始化CDN下载概率更新比例为预设值;The probability adjustment unit is further configured to: if the current P2P upload rate is less than a preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than the CDN prefetch data amount, re-acquire the initial CDN download probability, and initialize the initial network status parameter, and initialize The CDN download probability update ratio is a preset value;
概率调节单元,还用于如果当前P2P上传率小于初始P2P上传率且大于初始P2P上传率的预设比例,则将初始CDN下载概率,按照CDN下载概率更新比例进行减小,得到当前CDN下载概率,并将当前P2P上传率做为初始P2P上传率、当前P2P流量比率做为初始P2P流量。The probability adjustment unit is further configured to: if the current P2P upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate, reduce the initial CDN download probability according to the CDN download probability update ratio, and obtain the current CDN download probability. And the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio as the initial P2P traffic.
进一步地,CDN下载概率更新比例为预先设定,或在当前P2P上传率小于初始P2P上传率且大于初始P2P上传率的预设比例时按照预设比例减小而获得。Further, the CDN download probability update ratio is preset, or is obtained according to a preset ratio decrease when the current P2P upload rate is less than the initial P2P upload rate and greater than the preset ratio of the initial P2P upload rate.
进一步地,初始CDN下载概率预先设定且小于等于50%。Further, the initial CDN download probability is preset and is 50% or less.
本实施例所述的P2P数据下载的装置,根据网络状况设置CDN下载概率,使得网络带宽大网速高的客户端播放器有更大机会从CDN服务器下载更多的视频数据、网络带宽小网速低的客户端播放器从CDN服务器下载很少的视频数据,可以平衡不同的网络带宽网速的客户端播放器,可以更好地进行P2P分享数据;并且,不同的客户端播放器的CDN下载概率根据之前的CDN下载概率进行动态改变,不容易造成从CDN服务器下载过多的视频数据,可以实现P2P下载率的进一步提高。初始网络状况参数包括初始P2P上传率、初始P2P流量比率和CDN预取数据量,当前网络状况参数包括当前P2P上传率、当前P2P流量比率和当前P2P上传量,P2P上传率、P2P流量比率、P2P上传量和CDN预取数据量获取方便,便于实现本发明。不断重复进行操作,动态实时改变CDN下载概率,更好地利用客户端播放器当前的网络状况。The device for downloading P2P data according to the embodiment sets the CDN download probability according to the network condition, so that the client player with high network bandwidth and high network speed has a greater chance of downloading more video data and network bandwidth from the CDN server. The low-speed client player downloads very little video data from the CDN server, can balance different network bandwidth network speed client players, can better P2P share data; and, different client player CDN The download probability is dynamically changed according to the previous CDN download probability, and it is not easy to cause excessive video data to be downloaded from the CDN server, and the P2P download rate can be further improved. The initial network status parameters include the initial P2P upload rate, the initial P2P traffic ratio, and the CDN prefetch data volume. The current network status parameters include the current P2P upload rate, the current P2P traffic ratio, and the current P2P upload amount, the P2P upload rate, the P2P traffic ratio, and the P2P. The amount of uploading and the amount of CDN prefetched data are conveniently obtained, and the present invention is facilitated. Repeated operations, dynamically change the CDN download probability in real time, and make better use of the current network status of the client player.
所述装置与前述的方法流程描述对应,不足之处参考上述方法流程的叙述,不再一一赘述。 The device corresponds to the foregoing method flow description, and the deficiencies refer to the description of the above method flow, and will not be further described.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。A person skilled in the art can understand that all or part of the steps of implementing the above method embodiments may be completed by using hardware related to the program instructions. The foregoing program may be stored in a computer readable storage medium, and the program is executed when executed. The foregoing steps include the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。 Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that The technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the technical solutions of the embodiments of the present invention. range.

Claims (19)

  1. 一种P2P数据下载的方法,其特征在于,所述方法包括:A method for downloading P2P data, characterized in that the method comprises:
    获取初始CDN下载概率、初始网络状况参数和当前网络状况参数;其中,所述初始CDN下载概率表示初始设定的P2P下载区内的数据块中的视频数据被选取从CDN服务器中下载的概率;Obtaining an initial CDN download probability, an initial network status parameter, and a current network status parameter; wherein the initial CDN download probability indicates a probability that video data in the initially set data block in the P2P download area is selected to be downloaded from the CDN server;
    将所述当前网络状况参数与所述初始网络状况参数进行比较,根据比较结果,对所述初始CDN下载概率进行更新得到当前CDN下载概率;Comparing the current network status parameter with the initial network status parameter, and updating the initial CDN download probability according to the comparison result to obtain a current CDN download probability;
    根据所述当前CDN下载概率,选取所述P2P下载区内的数据块中的视频数据从所述CDN服务器中下载。2、如权利要求1所述的方法,其特征在于,所述当前网络状况参数包括当前P2P上传率、当前P2P流量比率和当前P2P上传量;获取当前网络状况参数,包括:And selecting video data in the data block in the P2P download area to be downloaded from the CDN server according to the current CDN download probability. The method of claim 1, wherein the current network status parameter comprises a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload amount; and the current network status parameter is obtained, including:
    统计预设时间间隔内的当前P2P下载量、所述当前P2P上传量和当前CDN下载量;Counting the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval;
    根据所述当前P2P下载量、所述当前P2P上传量和所述当前CDN下载量,计算所述当前P2P上传率、所述当前P2P流量比率。And calculating the current P2P upload rate and the current P2P traffic ratio according to the current P2P download amount, the current P2P upload amount, and the current CDN download amount.
  2. 如权利要求2所述的方法,其特征在于,所述初始网络状况参数包括初始P2P上传率、初始P2P流量比率和CDN预取数据量,所述CDN预取数据量根据所述当前P2P下载量、所述当前CDN下载量和所述初始CDN下载概率计算得到;The method according to claim 2, wherein said initial network condition parameter comprises an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount, said CDN prefetch data amount being based on said current P2P download amount Calculating the current CDN download amount and the initial CDN download probability;
    获取初始CDN下载概率、初始网络状况参数包括:获取播放服务器返回的初始CDN下载概率,并对初始P2P上传率、初始P2P流量比率和CDN下载概率更新比例进行初始化。Obtaining the initial CDN download probability and the initial network condition parameter includes: obtaining an initial CDN download probability returned by the play server, and initializing the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio.
  3. 如权利要求3所述的方法,其特征在于,将所述当前网络状况参数与所述初始网络状况参数进行比较,根据比较结果,对所述初始CDN下载概率进行更新得到当前CDN下载概率,包括:The method according to claim 3, wherein the current network status parameter is compared with the initial network status parameter, and the initial CDN download probability is updated according to the comparison result to obtain a current CDN download probability, including :
    如果所述当前P2P上传率大于所述初始P2P上传率、所述当前P2P流量比率大于等于所述初始P2P流量比率并且所述当前P2P上传量大于等于所述CDN预取数据量,则将所述初始CDN下载概率,按照CDN下载概率更新比例进 行增加,得到所述当前CDN下载概率,并将所述当前P2P上传率做为所述初始P2P上传率、所述当前P2P流量比率做为所述初始P2P流量。And if the current P2P upload rate is greater than the initial P2P upload rate, the current P2P traffic ratio is greater than or equal to the initial P2P traffic ratio, and the current P2P upload amount is greater than or equal to the CDN prefetched data amount, Initial CDN download probability, according to the CDN download probability update ratio The line is incremented to obtain the current CDN download probability, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio as the initial P2P traffic.
  4. 如权利要求2所述的方法,其特征在于,统计预设时间间隔内的当前P2P下载量、所述当前P2P上传量和当前CDN下载量,具体包括如下步骤:The method of claim 2, wherein the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval are specifically included in the following steps:
    b1:在P2P引擎成功与播放服务器建立连接并确定可以进行p2p数据交互时,开始通过第一计时器和第二计时器统计时间;B1: when the P2P engine successfully establishes a connection with the play server and determines that the p2p data interaction can be performed, the time is counted by the first timer and the second timer;
    b2:当第一计时器的统计时间达到第一预设时间间隔时,通过预设统计结束概率确定是否结束所述第一计时器的统计,如果确定结束所述第一计时器的统计,则执行b6;否则,执行b3;B2: when the statistical time of the first timer reaches the first preset time interval, determining whether to end the statistics of the first timer by using a preset statistical end probability, and if it is determined to end the statistics of the first timer, Execute b6; otherwise, execute b3;
    b3:判断所述第二计时器的时间是否大于等于第二预设时间间隔,如果大于等于所述第二预设时间间隔,则执行b5;否则,执行b4;B3: determining whether the time of the second timer is greater than or equal to a second preset time interval, if greater than or equal to the second preset time interval, executing b5; otherwise, executing b4;
    b4:将所述第一计时器的统计时间清零,所述第一计时器重新开始统计时间,然后执行b2;B4: clear the statistical time of the first timer, the first timer restarts the statistical time, and then executes b2;
    b5:所述第二计时器结束统计,然后执行b6;B5: the second timer ends the statistics, and then executes b6;
    b6:计算所述第二计时器的统计时间内的当前P2P下载量、当前P2P上传量和当前CDN下载量。B6: Calculate the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the statistical time of the second timer.
  5. 如权利要求3所述的方法,其特征在于,所述CDN下载概率更新比例为预先设定,或在所述当前P2P上传率小于所述初始P2P上传率且大于所述初始P2P上传率的预设比例时按照预设比例减小而获得。The method according to claim 3, wherein the CDN download probability update ratio is preset, or the pre-P2P upload rate is smaller than the initial P2P upload rate and greater than the initial P2P upload rate. When the ratio is set, it is obtained by reducing the preset ratio.
  6. 如权利要求4所述的方法,其特征在于,将所述当前网络状况参数与所述初始网络状况参数进行比较,根据比较结果,对所述初始CDN下载概率进行更新得到当前CDN下载概率,还包括:The method according to claim 4, wherein the current network status parameter is compared with the initial network status parameter, and the initial CDN download probability is updated according to the comparison result to obtain a current CDN download probability, include:
    如果所述当前P2P上传率小于所述初始P2P上传率的预设比例、或者所述当前P2P上传量小于所述CDN预取数据量,则重新获取所述初始CDN下载概率,并初始化所述初始网络状况参数,初始化所述CDN下载概率更新比例为预设值。If the current P2P upload rate is less than a preset ratio of the initial P2P upload rate, or the current P2P upload amount is smaller than the CDN prefetch data amount, re-acquiring the initial CDN download probability, and initializing the initial The network status parameter initializes the CDN download probability update ratio to a preset value.
  7. 如权利要求4所述的方法,其特征在于,将所述当前网络状况参数与所述初始网络状况参数进行比较,根据比较结果,对所述初始CDN下载概率 进行更新得到当前CDN下载概率,还包括:The method according to claim 4, wherein the current network status parameter is compared with the initial network status parameter, and the initial CDN download probability is obtained according to the comparison result. Update to get the current CDN download probability, including:
    如果所述当前P2P上传率小于所述初始P2P上传率且大于所述初始P2P上传率的预设比例,则将所述初始CDN下载概率,按照所述CDN下载概率更新比例进行减小,得到所述当前CDN下载概率,并将所述当前P2P上传率做为所述初始P2P上传率、所述当前P2P流量比率做为所述初始P2P流量。If the current P2P upload rate is smaller than the initial P2P upload rate and greater than a preset ratio of the initial P2P upload rate, the initial CDN download probability is reduced according to the CDN download probability update ratio, and the obtained The current CDN download probability is described, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic ratio is used as the initial P2P traffic.
  8. 如权利要求1所述的方法,其特征在于,所述初始CDN下载概率预先设定且小于等于50%。The method of claim 1, wherein the initial CDN download probability is preset and less than or equal to 50%.
  9. 如权利要求1所述的方法,其特征在于,选取所述P2P下载区内的数据块中的视频数据从所述CDN服务器中下载之后,进一步包括:The method of claim 1, wherein after the video data in the data block in the P2P download area is downloaded from the CDN server, the method further comprises:
    将所述当前CDN下载概率作为初始CDN下载概率、所述当前网络状况参数作为初始网络状况参数。The current CDN download probability is used as an initial CDN download probability and the current network status parameter as an initial network status parameter.
  10. 一种P2P数据下载的装置,其特征在于,所述装置包括:A device for downloading P2P data, characterized in that the device comprises:
    获取模块,用于获取初始CDN下载概率、初始网络状况参数和当前网络状况参数;其中,所述初始CDN下载概率表示初始设定的P2P下载区内的数据块中的视频数据被选取从CDN服务器中下载的概率;An obtaining module, configured to obtain an initial CDN download probability, an initial network status parameter, and a current network status parameter; wherein the initial CDN download probability indicates that video data in a data block in an initially set P2P download area is selected from a CDN server The probability of downloading;
    处理模块,用于将所述当前网络状况参数与所述初始网络状况参数进行比较,根据比较结果,对所述初始CDN下载概率进行更新得到当前CDN下载概率;a processing module, configured to compare the current network status parameter with the initial network status parameter, and update the initial CDN download probability according to the comparison result to obtain a current CDN download probability;
    下载模块,用于根据所述当前CDN下载概率,选取所述P2P下载区内的数据块中的视频数据从所述CDN服务器中下载。And a downloading module, configured to select video data in the data block in the P2P download area to be downloaded from the CDN server according to the current CDN download probability.
  11. 如权利要求11所述的装置,其特征在于,所述当前网络状况参数包括当前P2P上传率、当前P2P流量比率和当前P2P上传量;所述获取模块进一步包括:统计单元和计算单元;The device according to claim 11, wherein the current network status parameter comprises a current P2P upload rate, a current P2P traffic ratio, and a current P2P upload amount; the obtaining module further comprising: a statistics unit and a calculating unit;
    所述统计单元,用于统计预设时间间隔内的当前P2P下载量、所述当前P2P上传量和当前CDN下载量;The statistics unit is configured to count the current P2P download amount, the current P2P upload amount, and the current CDN download amount in the preset time interval;
    所述计算单元,用于根据所述当前P2P下载量、所述当前P2P上传量和所述当前CDN下载量,计算所述当前P2P上传率、所述当前P2P流量比率。 The calculating unit is configured to calculate the current P2P upload rate and the current P2P traffic ratio according to the current P2P download amount, the current P2P upload amount, and the current CDN download amount.
  12. 如权利要求12所述的装置,其特征在于,所述初始网络状况参数包括初始P2P上传率、初始P2P流量比率和CDN预取数据量,所述CDN预取数据量根据所述当前P2P下载量、所述当前CDN下载量和所述初始CDN下载概率计算得到;The apparatus according to claim 12, wherein said initial network condition parameter comprises an initial P2P upload rate, an initial P2P traffic ratio, and a CDN prefetch data amount, said CDN prefetch data amount being based on said current P2P download amount Calculating the current CDN download amount and the initial CDN download probability;
    获取初始CDN下载概率、初始网络状况参数包括:获取播放服务器返回的初始CDN下载概率,并对初始P2P上传率、初始P2P流量比率和CDN下载概率更新比例进行初始化。Obtaining the initial CDN download probability and the initial network condition parameter includes: obtaining an initial CDN download probability returned by the play server, and initializing the initial P2P upload rate, the initial P2P traffic ratio, and the CDN download probability update ratio.
  13. 如权利要求13所述的装置,其特征在于,所述处理模块进一步包括:概率调节单元,The apparatus according to claim 13, wherein said processing module further comprises: a probability adjustment unit,
    所述概率调节单元,用于如果所述当前P2P上传率大于所述初始P2P上传率、所述当前P2P流量比率大于等于所述初始P2P流量比率并且所述当前P2P上传量大于等于所述CDN预取数据量,则将所述初始CDN下载概率,按照所述CDN下载概率更新比例进行增加,得到所述当前CDN下载概率,并将所述当前P2P上传率做为所述初始P2P上传率、所述当前P2P流量比率做为所述初始P2P流量。The probability adjustment unit is configured to: if the current P2P upload rate is greater than the initial P2P upload rate, the current P2P traffic ratio is greater than or equal to the initial P2P traffic ratio, and the current P2P upload amount is greater than or equal to the CDN pre- Taking the amount of data, the initial CDN download probability is increased according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate. The current P2P traffic ratio is used as the initial P2P traffic.
  14. 如权利要求12所述的装置,其特征在于,所述统计单元进一步还用于执行如下步骤:The device according to claim 12, wherein the statistical unit is further configured to perform the following steps:
    b1:在P2P引擎成功与播放服务器建立连接并确定可以进行p2p数据交互时,开始通过第一计时器和第二计时器统计时间;B1: when the P2P engine successfully establishes a connection with the play server and determines that the p2p data interaction can be performed, the time is counted by the first timer and the second timer;
    b2:当第一计时器的统计时间达到第一预设时间间隔时,通过预设统计结束概率确定是否结束所述第一计时器的统计,如果确定结束所述第一计时器的统计,则执行b6;否则,执行b3;B2: when the statistical time of the first timer reaches the first preset time interval, determining whether to end the statistics of the first timer by using a preset statistical end probability, and if it is determined to end the statistics of the first timer, Execute b6; otherwise, execute b3;
    b3:判断所述第二计时器的时间是否大于等于第二预设时间间隔,如果大于等于所述第二预设时间间隔,则执行b5;否则,执行b4;B3: determining whether the time of the second timer is greater than or equal to a second preset time interval, if greater than or equal to the second preset time interval, executing b5; otherwise, executing b4;
    b4:将所述第一计时器的统计时间清零,所述第一计时器重新开始统计时间,然后执行b2;B4: clear the statistical time of the first timer, the first timer restarts the statistical time, and then executes b2;
    b5:所述第二计时器结束统计,然后执行b6;B5: the second timer ends the statistics, and then executes b6;
    b6:计算所述第二计时器的统计时间内的当前P2P下载量、当前P2P上 传量和当前CDN下载量。B6: Calculating the current P2P download amount in the statistical time of the second timer, and currently on the P2P Volume and current CDN downloads.
  15. 如权利要求13所述的装置,其特征在于,所述CDN下载概率更新比例为预先设定,或在所述当前P2P上传率小于所述初始P2P上传率且大于所述初始P2P上传率的预设比例时按照预设比例减小而获得。The apparatus according to claim 13, wherein the CDN download probability update ratio is preset, or the pre-P2P upload rate is smaller than the initial P2P upload rate and greater than the initial P2P upload rate. When the ratio is set, it is obtained by reducing the preset ratio.
  16. 如权利要求14所述的装置,其特征在于,所述概率调节单元,还用于如果所述当前P2P上传率小于所述初始P2P上传率的预设比例、或者所述当前P2P上传量小于所述CDN预取数据量,则重新获取所述初始CDN下载概率,并初始化所述初始网络状况参数,初始化所述CDN下载概率更新比例为预设值。The apparatus according to claim 14, wherein the probability adjustment unit is further configured to: if the current P2P upload rate is less than a preset ratio of the initial P2P upload rate, or the current P2P upload amount is less than When the CDN prefetches the data amount, the initial CDN download probability is re-acquired, and the initial network condition parameter is initialized, and the CDN download probability update ratio is initialized to a preset value.
  17. 如权利要求14所述的装置,其特征在于,所述概率调节单元,还用于如果所述当前P2P上传率小于所述初始P2P上传率且大于所述初始P2P上传率的预设比例,则将所述初始CDN下载概率,按照所述CDN下载概率更新比例进行减小,得到所述当前CDN下载概率,并将所述当前P2P上传率做为所述初始P2P上传率、所述当前P2P流量比率做为所述初始P2P流量。The device according to claim 14, wherein the probability adjustment unit is further configured to: if the current P2P upload rate is less than the initial P2P upload rate and greater than a preset ratio of the initial P2P upload rate, The initial CDN download probability is reduced according to the CDN download probability update ratio, and the current CDN download probability is obtained, and the current P2P upload rate is used as the initial P2P upload rate and the current P2P traffic. The ratio is taken as the initial P2P traffic.
  18. 如权利要求11所述的装置,其特征在于,所述初始CDN下载概率预先设定且小于等于50%。The apparatus according to claim 11, wherein said initial CDN download probability is preset and is 50% or less.
  19. 如权利要求11所述的装置,其特征在于,所述获取模块进一步用于,The apparatus according to claim 11, wherein said acquisition module is further configured to:
    在下载模块选取所述P2P下载区内的数据块中的视频数据从所述CDN服务器中下载之后,将所述当前CDN下载概率作为初始CDN下载概率、所述当前网络状况参数作为初始网络状况参数。 After the downloading module selects the video data in the data block in the P2P download area to be downloaded from the CDN server, the current CDN download probability is used as the initial CDN download probability and the current network status parameter as the initial network status parameter. .
PCT/CN2016/076065 2015-05-15 2016-03-10 P2p data downloading method and apparatus WO2016184230A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510250676.0A CN105721889A (en) 2015-05-15 2015-05-15 P2P data download method and device
CN201510250676.0 2015-05-15

Publications (1)

Publication Number Publication Date
WO2016184230A1 true WO2016184230A1 (en) 2016-11-24

Family

ID=56144724

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/076065 WO2016184230A1 (en) 2015-05-15 2016-03-10 P2p data downloading method and apparatus

Country Status (2)

Country Link
CN (1) CN105721889A (en)
WO (1) WO2016184230A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111372100A (en) * 2020-04-21 2020-07-03 白杨 End-to-end content distribution network system and distribution method based on distributed election
CN112469008A (en) * 2020-11-27 2021-03-09 重庆电讯职业学院 Content distribution method and device based on D2D reliability
CN114666609A (en) * 2022-03-31 2022-06-24 北京奇艺世纪科技有限公司 Video data downloading method and device, electronic equipment and storage medium
CN116320507A (en) * 2023-05-26 2023-06-23 湖南快乐阳光互动娱乐传媒有限公司 Video data downloading method and device

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107979644B (en) * 2017-11-30 2019-02-26 掌阅科技股份有限公司 Prevent packet method for down loading, electronic equipment, the storage medium of high concurrent
CN109412959B (en) * 2018-09-10 2022-08-16 广州小鹏汽车科技有限公司 Vehicle OTA (over the air) upgrading current-limiting control method, system and device
CN114390349A (en) * 2020-10-22 2022-04-22 武汉斗鱼鱼乐网络科技有限公司 Video playing control method, device, terminal and storage medium
CN114827649B (en) * 2022-04-22 2024-02-23 上海哔哩哔哩科技有限公司 Method and device for constructing live peer-to-peer network, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102882925A (en) * 2011-08-05 2013-01-16 新游网络科技有限公司 Device and method for distributed control of file downloading network
US20140172979A1 (en) * 2012-12-19 2014-06-19 Peerialism AB Multiple Requests for Content Download in a Live Streaming P2P Network
CN104348647A (en) * 2013-07-31 2015-02-11 腾讯科技(深圳)有限公司 Multisource bandwidth scheduling method, device, and system
CN104506929A (en) * 2014-12-26 2015-04-08 电子科技大学 Hybrid data scheduling method for P2P (peer to peer) systems

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101841556B (en) * 2010-02-23 2013-01-30 中国科学院计算技术研究所 Method and system for placing resources replication in CDN-P2P (Content Distribution Network-Peer-to-Peer) network
CN101895577B (en) * 2010-07-06 2013-02-13 中国科学院计算技术研究所 Distribution method of network sharing resources
CN102333106B (en) * 2010-07-13 2015-07-29 中国移动通信集团公司 A kind of P2P system resource dispatching method and device thereof and system
PT2697954E (en) * 2011-10-05 2015-04-09 Peerialism AB Method and device for arranging peers in a live streaming p2p network
CN103049452B (en) * 2011-10-14 2017-12-26 百度在线网络技术(北京)有限公司 It is a kind of based on estimate download rate carry out using sequence method and apparatus
CN103179145B (en) * 2011-12-20 2016-04-06 中国电信股份有限公司 Based on the data transmission method of cloud computing, system and implicit content server
CN103997522B (en) * 2014-05-16 2018-01-23 广州金山网络科技有限公司 A kind of content delivery network flow control method and terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102882925A (en) * 2011-08-05 2013-01-16 新游网络科技有限公司 Device and method for distributed control of file downloading network
US20140172979A1 (en) * 2012-12-19 2014-06-19 Peerialism AB Multiple Requests for Content Download in a Live Streaming P2P Network
CN104348647A (en) * 2013-07-31 2015-02-11 腾讯科技(深圳)有限公司 Multisource bandwidth scheduling method, device, and system
CN104506929A (en) * 2014-12-26 2015-04-08 电子科技大学 Hybrid data scheduling method for P2P (peer to peer) systems

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111372100A (en) * 2020-04-21 2020-07-03 白杨 End-to-end content distribution network system and distribution method based on distributed election
CN112469008A (en) * 2020-11-27 2021-03-09 重庆电讯职业学院 Content distribution method and device based on D2D reliability
CN112469008B (en) * 2020-11-27 2022-07-05 重庆电讯职业学院 Content distribution method and device based on D2D reliability
CN114666609A (en) * 2022-03-31 2022-06-24 北京奇艺世纪科技有限公司 Video data downloading method and device, electronic equipment and storage medium
CN116320507A (en) * 2023-05-26 2023-06-23 湖南快乐阳光互动娱乐传媒有限公司 Video data downloading method and device
CN116320507B (en) * 2023-05-26 2023-08-08 湖南快乐阳光互动娱乐传媒有限公司 Video data downloading method and device

Also Published As

Publication number Publication date
CN105721889A (en) 2016-06-29

Similar Documents

Publication Publication Date Title
WO2016184230A1 (en) P2p data downloading method and apparatus
US10455013B2 (en) Peer-to-peer upload scheduling
US10659832B1 (en) Dynamic bitrate selection for streaming media
US8930559B2 (en) Adaptive hypertext transfer protocol (“HTTP”) media streaming systems and methods
KR102472155B1 (en) How to Broadcast Streaming Content in a Peer to Peer (P2P) Network
US10827183B2 (en) System and method for optimal variable bit rate packing
WO2017071228A1 (en) Hls protocol-based method and system for live broadcast and client
CN110198495B (en) Method, device, equipment and storage medium for downloading and playing video
US10440082B1 (en) Adjusting parameter settings for bitrate selection algorithms
US20120324122A1 (en) Method and apparatus for server-side adaptive streaming
US11005975B2 (en) Rapid optimization of media stream bitrate
WO2014143631A1 (en) Playback stall avoidance in adaptive media streaming
EP3207686B1 (en) Adaptive bit rates during broadcast transmission in distributed content delivery networks
US9871716B2 (en) Broadcast readiness testing in distributed content delivery networks
EP2963896B1 (en) Method for operating a cache arranged along a transmission path between client terminals and at least one server, and corresponding cache
CN106105145B (en) Method for operating a buffer arranged along a transmission path between a client terminal and at least one server, and corresponding buffer
US10972761B2 (en) Minimizing stall duration tail probability in over-the-top streaming systems
CN114389959A (en) Network congestion control method and device, electronic equipment and storage medium
Li et al. Measurement-based study on the relation between users’ watching behavior and network sharing in P2P VoD systems
CN113676739B (en) Video playing method, device, equipment and storage medium
WO2019114956A1 (en) Controlling playout of advertisement content during video-on-demand video streaming on an en-user terminal
EP4104451A1 (en) Low latency content delivery
US11102535B1 (en) Adjusting parameter settings for bitrate selection algorithms
Ma et al. Q-learning for Waiting Time Control in CDN/V2V Live streaming
CN112640373A (en) Improved congestion response

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: 16795717

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.03.2018)

122 Ep: pct application non-entry in european phase

Ref document number: 16795717

Country of ref document: EP

Kind code of ref document: A1