WO2016070720A1 - Method and apparatus for downloading file, computing device and non-transitory machine readable storage medium - Google Patents

Method and apparatus for downloading file, computing device and non-transitory machine readable storage medium Download PDF

Info

Publication number
WO2016070720A1
WO2016070720A1 PCT/CN2015/092606 CN2015092606W WO2016070720A1 WO 2016070720 A1 WO2016070720 A1 WO 2016070720A1 CN 2015092606 W CN2015092606 W CN 2015092606W WO 2016070720 A1 WO2016070720 A1 WO 2016070720A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
download
downloading
network
connection
Prior art date
Application number
PCT/CN2015/092606
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 WO2016070720A1 publication Critical patent/WO2016070720A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications

Definitions

  • the present invention relates to the field of file downloading technologies, and in particular, to a file downloading method and apparatus, a computing device, and a non-transitory machine readable storage medium.
  • the breakpoint continuous transmission mode can effectively avoid repeated downloads, make full use of bandwidth, and effectively improve the download speed. Therefore, the breakpoint resume transmission mode is widely used.
  • the file In the download mode of the resume of the breakpoint, the file is divided into a number of fixed-size file blocks.
  • the traditional breakpoint download mechanism is to download only one fixed-size block per request.
  • the process In the normal download, the process is: establish 3 connection requests for the first 3 blocks, and download one of the blocks. After the completion, the connection request of the fourth block is established, and so on, until all the blocks are downloaded, and the entire download task is completed.
  • the download process of each block generally includes five steps of scheduling start downloading, initializing the network, sending a request, receiving data, and scheduling to complete the download.
  • the steps of receiving data consume more time
  • other steps consume less time (not related to network speed, generally can be regarded as a fixed value)
  • the time required to receive data is The ratio of time required for other steps is larger. Since the step of receiving data is actually performing the downloading action, the larger the ratio, the higher the downloading efficiency.
  • the process of receiving data is greatly reduced in time for a block download process (it may be reduced to be time-consuming equivalent to other steps, or even less than other steps).
  • the ratio of the time required to receive the data to the time required for the other steps is greatly reduced, resulting in a decrease in download efficiency.
  • the step of receiving data may take 5 s, the other steps take a total of 100 ms, the ratio of the two is 50:1, the actual download time The ratio of the time to perform other steps is large, and the download efficiency at this time Higher.
  • the step of receiving data will be reduced to 1 s or even shorter for each block download process.
  • the time consumption of other steps is basically the same (100ms). )
  • the ratio of the time when the actual download is performed to the time when the other steps are performed is only 10:1, that is, in the download process of each block, there is nearly ten minutes in the download preparation stage, so that the network speed cannot be fully utilized. , resulting in reduced download efficiency.
  • the traditional breakpoint download method is faster when the network speed is close to or larger than the fixed block size, the actual download efficiency is reduced, and the download speed cannot reach the maximum network speed.
  • the technical problem to be solved by the present invention is to provide a method and device for downloading files, a computing device, and a non-transitory machine-readable storage medium, which can reasonably utilize network bandwidth and effectively improve downloading efficiency.
  • a file downloading method is provided.
  • the file is composed of a plurality of fixed-size files, the method includes: acquiring a current network speed of the network; determining, according to the current network speed of the network, The size of the downloaded file fragment is connected, the file fragment includes at least one file partition; a new connection for downloading one of the file fragments is initiated to download the file.
  • the step of determining the size of the file segment currently suitable for downloading by one connection according to the current network speed of the network may include: determining, according to the current network speed of the network, a file partition currently suitable for downloading by one connection. Number; determines the size of the file fragment based on the number of file partitions and the size of each file partition.
  • the size of the file fragment may be the number of file partitions multiplied by the size of each file partition, wherein the size of each file partition may be equal.
  • the number of blocks currently suitable for being blocked by a downloaded file can be obtained by the following formula:
  • n is the coefficient
  • the current network speed refers to the amount of data that the network can currently transmit per second.
  • the method may further include: after the step of initiating a new connection for downloading a file segment to download the file, determining whether the number of connections currently connected for downloading the file reaches a preset upper limit value; If so, wait for the current connection download to complete; if not, return to the step of determining the size of the file segment currently suitable for download by a connection based on the current network speed of the network.
  • the method may further include: after the current connection download is completed, determining whether all file partitioning of the file is completed; if no download is completed, returning according to the current network speed of the network, determining that the current configuration is suitable for being connected by a connection.
  • the step of downloading the size of the file fragment; if the download is complete, the download of the file is ended.
  • the method may further include: when starting the downloading, initiating a first connection for downloading a file partition to download the file, and acquiring the current network speed of the network comprises: determining, according to the download process of the first connection The current network speed of the network.
  • the method may further include: determining, according to the message returned in the download process of the first connection, whether to support the resume of the breakpoint, wherein, in the case of supporting the resume of the breakpoint, performing the current network speed of acquiring the network A step of.
  • the step of obtaining the current network speed of the network comprises: determining the current network speed of the network according to the download process of the connection just completed downloading during the downloading process.
  • a file downloading apparatus is provided.
  • the file is composed of a plurality of fixed-size files
  • the device includes: an obtaining module, configured to acquire a current network speed of the network; and a determining module, configured to The current network speed, determining the size of the file segment currently suitable for downloading by a connection, the file segment including at least one file partition; a download module for initiating a new connection for downloading a file segment to download Document.
  • the determining module may include: a first determining module, configured to determine, according to a current network speed of the network, a number of the file partitions currently suitable for downloading by one connection; and a second determining module, configured to The number of chunks and the size of each file chunk determine the size of the file fragment.
  • the size of the file partition may be the number of file partitions multiplied by the size of each file partition, wherein each file partition is equal in size.
  • the number of files currently suitable for downloading by one connection can be determined by the following formula obtain:
  • n is the coefficient
  • the current network speed refers to the amount of data that the network can currently transmit per second.
  • the device may further include: a first determining module, configured to determine, after the downloading module initiates a new connection for downloading a file segment to download the file, whether the number of connections currently connected for downloading the file is reached The upper limit is preset; if it is reached, the current connection download in the download module is completed; if not, the determination module is returned.
  • a first determining module configured to determine, after the downloading module initiates a new connection for downloading a file segment to download the file, whether the number of connections currently connected for downloading the file is reached The upper limit is preset; if it is reached, the current connection download in the download module is completed; if not, the determination module is returned.
  • the device may further include: a second determining module, configured to determine whether all file partitioning of the file is completed after the current connection downloading in the downloading module is completed; if the downloading is not completed, returning to the determining module; if the downloading is completed , then download the module to end the download of the file.
  • a second determining module configured to determine whether all file partitioning of the file is completed after the current connection downloading in the downloading module is completed; if the downloading is not completed, returning to the determining module; if the downloading is completed , then download the module to end the download of the file.
  • the device may further include: a first block downloading module, configured to initiate a first connection for downloading a file block to download a file, and the obtaining module downloads the module according to the first block downloading module when starting the downloading The process determines the current network speed of the network.
  • a first block downloading module configured to initiate a first connection for downloading a file block to download a file
  • the obtaining module downloads the module according to the first block downloading module when starting the downloading The process determines the current network speed of the network.
  • the device may further include: a third determining module, determining, according to the message returned during the downloading process of the first block downloading module, whether to support the resume of the breakpoint, wherein, in the case of supporting the resume of the breakpoint, Perform the steps to get the current network speed of the network.
  • a third determining module determining, according to the message returned during the downloading process of the first block downloading module, whether to support the resume of the breakpoint, wherein, in the case of supporting the resume of the breakpoint, Perform the steps to get the current network speed of the network.
  • the obtaining module may determine the current network speed of the network according to the downloading process of the connection that just completed the download.
  • a non-transitory machine readable storage medium having stored thereon executable code for causing a processor to perform a method according to the present invention when executable code is executed by a processor.
  • a computing device capable of downloading a file, the file consisting of a plurality of fixed-size file blocks, the computing device comprising: a memory; a network communication module for connecting to the network; Connected to the network communication module and the memory, used to obtain the current network speed of the network through the network communication module, determine the size of the file segment currently suitable for downloading by a connection according to the current network speed of the network, and initiate a download for downloading A new connection of the file fragment to download the file via a network communication module and save the downloaded file fragment on a memory, the file fragment including at least one file partition.
  • the method and device for downloading a file provided by the embodiment of the present invention can be seen by the above technical solutions.
  • Obtain the current network speed of the network and determine the size of the file segment currently suitable for downloading by one connection according to the current network speed of the network, and initiate a new connection to download the file for the download task target by the size of the file segment.
  • the number of file partitions that can be connected and downloaded can be dynamically allocated, thereby rationally utilizing network bandwidth and effectively improving download efficiency.
  • FIG. 1 is a flow chart showing an embodiment of a file downloading method according to the present invention
  • step S120 shown in FIG. 1 is a schematic flow chart of sub-steps that can be included in step S120 shown in FIG. 1;
  • FIG. 3 is a schematic flow chart of another embodiment of a file downloading method according to the present invention.
  • FIG. 4 is a first flow chart of a file downloading method in a specific downloading task according to the present invention.
  • Figure 5 is a second flow chart of a file downloading method in a specific downloading task according to the present invention.
  • FIG. 6 is a third flowchart of a file downloading method in a specific downloading task according to the present invention.
  • FIG. 7 is a fourth flow chart of a file downloading method in a specific downloading task according to the present invention.
  • Figure 8 is a fifth flow chart of a file downloading method in a specific downloading task according to the present invention.
  • FIG. 9 is a sixth flowchart of a file downloading method in a specific downloading task according to the present invention.
  • FIG. 10 is a seventh flowchart of a file downloading method in a specific downloading task according to the present invention.
  • FIG. 11 is a schematic structural diagram of an embodiment of a file downloading apparatus according to the present invention.
  • FIG. 12 is a schematic structural diagram of an optional unit that can be included in the determining module shown in FIG. 11;
  • FIG. 13 is a schematic structural diagram of another embodiment of a file downloading apparatus according to the present invention.
  • FIG. 14 is a block diagram showing an embodiment of a computing device capable of downloading files in accordance with the present invention.
  • FIG. 1 is a schematic flowchart of an embodiment of a file downloading method according to the present invention, wherein a file is composed of a plurality of fixed-size file blocks, for example, a file of 25600 KB in size and divided into 100 files. Blocking, each file is 256KB in size.
  • step S110 the current network speed of the network is acquired.
  • Network speed that is, network speed, generally refers to the length of time it takes to request and return data when uploading and downloading data when a computer or mobile phone is online.
  • the way to obtain the current network speed of the network may be calculated by dividing the sum of the data processed by the network over a period of time by the length of the time period. In the calculation formula below, the current network speed can be expressed in terms of the amount of data that the network can currently transmit per second.
  • step S120 the size of the file segment currently suitable for downloading by one connection is determined according to the current network speed of the network, and the file segment includes at least one file partition.
  • the size of the file segment depends on the current network speed.
  • the determined file segment may include multiple file segments (when the network speed is high), or may be a file block (the network speed is low). under).
  • step S130 a new connection for downloading a file segment is initiated to download the file.
  • the present invention proposes a method for improving download efficiency by performing optimization in the process without changing the block division. That is to say, the size of the file downloaded by each connection is not fixed to a block, but a file segment composed of multiple consecutive blocks can be dynamically allocated through actual network conditions such as network speed and network type, and the file segment is handed over to the file segment.
  • the program can be simplified by directly discarding and re-downloading the block.
  • the division of the block should not be too large, otherwise the cost of abandonment will be too high, but it should not be too small, because it will increase the overhead of scheduling, generally use the same block size as the traditional breakpoint download.
  • this kind of downloading method is essentially continuous downloading, with the upper layer scheduling and Appropriate caching can ensure that the file is still continuously written to the file, which can effectively alleviate the efficiency problem caused by the inefficient file IO of the mobile device.
  • FIG. 2 is a schematic flow chart of sub-steps that can be included in step S120 shown in FIG. 1.
  • step S1210 based on the current network speed of the network, the number of file partitions currently suitable for downloading by one connection is determined.
  • the number of file partitions that the current network is suitable for downloading and downloading may be more than one, if the current network speed of the network is far less than or equal to a single file partition.
  • the size, the number of files that the current network is suitable for connection to download should be one.
  • the number of file partitions that the current network is suitable for downloading and downloading may be determined according to the current network speed of the network being a multiple of the size of a single file partition, or may be based on measurement experiments to obtain an empirical rule, and determining the current network according to an empirical rule.
  • the number of blocks that are connected to the downloaded file or can be determined by other methods.
  • the current network speed of the network dynamically allocate the number of files that the network can currently connect to download, thereby rationally utilizing the network bandwidth and effectively improving the download speed.
  • the current network speed of the network is 256 KB
  • the size of each file partition is 256 KB
  • the number of file partitions that the current network is suitable for downloading and downloading may be one.
  • step S1210 based on the number of file partitions and the size of each file partition, the size of the file segment that the network is currently suitable for connection to download is determined.
  • the size of the file segment that the network is currently suitable for connection to download can be determined.
  • the size of the file segment currently suitable for connection and downloading by the network is the number of file partitions multiplied by the size of each file chunk, wherein each file chunk is equal in size.
  • the determined number of file partitions is four, and the size of each file partition is 256 KB, and the total file fragment currently suitable for connection downloading by the network is 1024 KB.
  • the embodiment of the present invention determines the number of file partitions that the network can currently connect to and download according to the current network speed of the network, and according to the number of file partitions and each file.
  • the size of the block determines the size of the file segment that the network is currently suitable for connection to download; initiates a new connection to download the file for the download task target of a single connection with the size of the file fragment.
  • the current network speed of the network determine the number of file partitions that the network is currently suitable for connecting to download, thereby determining to initiate a new connection to download the file for the download task target of the single connection by the size of the file fragment currently connected to the network. In this way, it is possible to dynamically allocate the current connection.
  • the number of downloaded files is divided into blocks, so that the network bandwidth can be reasonably utilized, and the download speed can be effectively improved.
  • FIG. 3 is a schematic flowchart of another embodiment of a file downloading method according to the present invention.
  • the embodiment is basically the same as the embodiment of FIG. 1.
  • FIG. 1 please refer to FIG. 1 and corresponding text descriptions.
  • step S210 a first connection for downloading a file partition is initiated to download a file.
  • the download task of the first connection is targeted to a file partition.
  • step S220 the download process is monitored, and when the download is completed, the current network speed of the network is acquired.
  • step S210 and step S220 are mainly for obtaining the current accurate and real-time network speed of the network.
  • the report may also be returned according to the returned report.
  • the text determines whether the current download supports the resume of the breakpoint (ie, step S215 in the figure), and if it is determined that the current download does not support the resume of the breakpoint, the first connection download file can be kept until the completion (ie, step S217 in the figure),
  • Embodiments of the invention are implemented with support for breakpoint retransmission.
  • step S230 based on the current network speed of the network, the number of files that are currently suitable for downloading by one connection is determined.
  • the number of file partitions that the network is currently suitable for connection to download is obtained by the following formula:
  • n is the coefficient
  • the current network speed refers to the amount of data that the network can currently transmit per second.
  • the current network speed can be updated in real time, and the impact of network fluctuations caused by network fluctuations should be removed in order to reflect the most realistic current network speed.
  • the coefficient n varies depending on the size of the file block block, and only It only makes sense. The value of the specific coefficient n can be obtained through a large number of experimental tests according to the block size and the network condition of the service area, and the coefficient n can also be an empirical value obtained according to the actual measurement.
  • step S240 the size of the file segment currently suitable for download by one connection is determined according to the number of file partitions and the size of each file partition.
  • step S250 a new connection for downloading a file segment is initiated to download the file.
  • step S260 it is determined whether the number of connections of the connection for downloading the file that has been currently initiated reaches a preset upper limit value. If yes, go to step S270; if not, go back to step S230.
  • step S270 it waits for the current connection download to be completed.
  • step S280 it is judged whether all the file partitioning of the file is completed; if no download is completed, the process returns to step S230; if the download is completed, the process proceeds to step S290.
  • step S290 the download of the file is ended.
  • step S260 and step S280 have no obvious sequence when executed.
  • the network speed may be reacquired in step S285.
  • the current network speed of the network can be determined based on the download process of the connection that just completed the download.
  • the next operation can be performed according to the new current network speed acquired in step S285.
  • the network speed can be monitored at any time, so that the size of the file segments downloaded by a single connection can be updated at any time.
  • obtaining the current network speed of the network determining, according to the current network speed of the network, the number of file partitions that the network is currently suitable for connection to download; according to the number of file partitions and each file partitioning Size, determines the size of the file segment that the network is currently suitable for connection to download; initiates a new connection to download the file for the download task target for a single connection with the size of the file fragment. Since the number of file partitions that the network is currently suitable for connecting to the download is determined according to the current network speed of the network, it is determined that a new connection is initiated to download the file for the download task target of the single connection by the size of the file segment currently suitable for the connection to be downloaded. In this way, the number of file partitions currently suitable for connection downloading can be dynamically allocated, thereby rationally utilizing network bandwidth and effectively increasing the download speed.
  • the download task (shown in FIG. 4) of a file divided into 32 blocks is taken as an example to illustrate the method of the present invention.
  • the task supports breakpoint continuous transmission, and the concurrent connection preset upper limit value is 3, and the coefficient n is 5.
  • thread 1 initiates a connection, requesting to download the first file partition, see the 1 part of Figure 5.
  • Step 2 After the thread 1 is downloaded, if the current network speed of the acquired network is 1 ⁇ block size, according to the following formula:
  • the total file partition (ie, the file fragment) of the new connection request is 6 ⁇ block size, and the new connection request is initiated for the download task target.
  • the file part of the specific request is as shown in FIG. 6-2. 7 parts.
  • the third step According to the foregoing steps, it can be known that only thread 1 is in the download state, and the set concurrent connection upper limit value is 3, and the concurrent connection upper limit value has not been reached, so thread 2 and thread 3 are continuously started, corresponding to the request.
  • the file parts are as shown in parts 8-13 of Figure 7, as shown in parts 14-19 of Figure 8.
  • Step 4 After the thread 1 is downloaded again, if the network speed at this time is 2 ⁇ block size, according to the foregoing calculation method, a new connection can be obtained by taking 11 consecutive blocks, and the file part corresponding to the request is as shown in FIG. Section 20-30.
  • Step 5 When the thread 2 is downloaded, if the network speed is still 2 ⁇ block size, but there are less than 11 blocks not downloaded. Therefore, the last remaining blocks are taken to start a new connection, and the corresponding file portion of the request is as shown in parts 31-32 of FIG.
  • Step 6 When the thread 3 is downloaded, it is found that there is no block to download, so it can be closed directly.
  • Step 7 After the remaining threads are downloaded, the download task is completed.
  • FIG. 11 is a schematic structural diagram of an embodiment of a file downloading apparatus according to the present invention.
  • the apparatus of the present embodiment can perform the steps in the method shown in FIG.
  • the device includes an acquisition module 110, a determination module 120, and a download module 130.
  • the obtaining module 110 is configured to acquire the current network speed of the network.
  • Network speed that is, network speed, generally refers to the length of time it takes to request and return data when uploading and downloading data when a computer or mobile phone is online.
  • the way to obtain the current network speed of the network may be calculated by dividing the sum of the data processed by the network over a period of time by the length of the time period.
  • the current network speed can be expressed in terms of the amount of data that the network can currently transmit per second.
  • the determining module 120 is configured to determine, according to the current network speed of the network, a size of a file segment currently suitable for downloading by a connection, wherein the file segment includes at least one file partition.
  • the download module 130 is for initiating a new connection for downloading a file fragment to download the file.
  • FIG. 12 is a schematic structural diagram of an optional unit that the determination module shown in FIG. 11 can include.
  • the determination module 120 can optionally include a first determination module 1210 and a second determination module 1220.
  • the first determining module 1210 is configured to determine, according to the current network speed of the network, the number of file partitions currently suitable for downloading by one connection.
  • a file consists of multiple files of fixed size. For example, a 25600KB file is divided into 100 file partitions, each of which is 256KB in size.
  • the number of files that the current network is suitable for downloading by one connection may be more than one, if the current network speed of the network is far less than or equal to a single file.
  • the size of the block, the number of files that the current network is suitable for downloading by one connection should be one.
  • the number of files that the current network is suitable for downloading by one connection can be determined according to the current network speed of the network is a multiple of the size of a single file block; or the experience rule can be obtained according to the measurement test, and the current network is determined according to the empirical rule.
  • the second determining module 1220 is configured to determine, according to the number of file partitions and the size of each file partition, the size of the file segment that the network is currently suitable for connection to download.
  • the size of the file partition that the network is currently suitable for connection to download can be determined.
  • the size of the file segment currently suitable for connection and downloading by the network is the number of file partitions multiplied by the size of each file chunk, wherein each file chunk is equal in size.
  • obtaining the current network speed of the network determining, according to the current network speed of the network, the number of file partitions that the network is currently suitable for connection to download; according to the number of file partitions and each file partitioning Size, determine the size of the total file partition that the network is currently suitable for connection downloading; A new connection is initiated for the download task target to download the file at the size of the total file chunk.
  • determine the number of file partitions that the network can currently connect to download thereby determining to initiate a new connection to download the file for the download task target by the size of the total file partition currently downloaded and connected by the network.
  • FIG. 13 is a schematic structural diagram of another embodiment of a file downloading apparatus according to the present invention.
  • the apparatus of this embodiment may perform the steps in the method shown in FIG.
  • the device of the present embodiment is basically the same as the device shown in FIG. 11, and the same applies to FIG. 11 and the corresponding text description.
  • the device includes: an obtaining module 201, a first determining module 202, a second determining module 203, a downloading module 204, a first determining module 205, a second determining module 206, a third determining module 207, and a first blocking download module 208.
  • the obtaining module 201 is configured to acquire the current network speed of the network.
  • the first determining module 202 is configured to determine, according to the current network speed of the network, the number of file partitions currently suitable for downloading by one connection, wherein the file is composed of a plurality of file blocks of fixed size.
  • the number of blocks that the network is currently suitable for downloading by a connection can be obtained by the following formula:
  • n is the coefficient, and the current network speed refers to the amount of data that the network can currently transmit per second.
  • the current network speed can be updated in real time, and the impact of network fluctuations caused by network fluctuations should be removed in order to reflect the most realistic current network speed.
  • the coefficient n varies depending on the size of the file block block, and only It only makes sense. The value of the specific coefficient n can be obtained through a large number of experimental tests according to the block size and the network condition of the service area, and the coefficient n can also be an empirical value obtained according to the actual measurement.
  • the second determining module 203 is configured to determine, according to the number of file partitions and the size of each file partition, the size of the file segment that the network is currently suitable for downloading by one connection.
  • the download module 204 is for initiating a new connection for downloading a file fragment to download the file.
  • the obtaining module 201 can obtain the current network speed by using the first blocking download module 208.
  • the first block download module 208 can divide the file into one file when starting the download.
  • the size of the block initiates a first connection for the download task target of the single connection (the first connection is used to download a block) to download the file, and the obtaining module 201 can determine the current network of the network according to the download process of the first block download module 208. speed.
  • the obtaining module 201 can also determine the current network speed of the network according to the download process of just completing the download monochrome connection.
  • the third determining module 207 can determine whether to support the resume transmission according to the message returned in the downloading process of the first blocking download module 208. In the case of determining that the resume transmission is supported, the obtaining module 201 can execute the acquiring network. Current network speed operation.
  • the first determining module 205 is configured to determine whether the number of connections that have been initiated for downloading the file has reached a preset upper limit. If so, the current connection download in the download module 204 is awaited; if not, the first determination module 202 is returned.
  • the second determining module 206 is configured to determine whether all file partitioning of the file is completed. If no download is completed, the first determination module 202 is returned; if the download is completed, the download module 204 ends the download of the file.
  • the first determining module 205 and the second determining module 206 are connected to the first determining module 202.
  • the first judging module 205 and/or the second judging module 206 may also be connected to the obtaining module 201.
  • the obtaining module may be used. 201 re-determines the network speed currently sent by the network according to the download process of the connection that just completed the download. As a result, the network speed can be monitored at any time, so that the size of the file segments downloaded by a single connection can be updated at any time.
  • the current network speed of the network is obtained; according to the current network speed of the network, the number of files currently suitable for downloading by one connection is determined; according to the number of file partitions and each file partition The size determines the size of the total file partition currently suitable for download by a connection; initiates a new connection to download the file for the download task target at the size of the total file partition.
  • determining the number of file partitions that the network is currently suitable for connection to download thereby determining to initiate a new connection to download the file for the download task target by the size of the total file partition currently suitable for connection downloading. In this way, it is possible to dynamically allocate the currently available downloaded files.
  • the number of blocks is divided, so that the network bandwidth is rationally utilized, and the download speed is effectively improved.
  • FIG. 14 is a block diagram showing one embodiment of a computing device capable of downloading files in accordance with the present invention.
  • the computing device includes a memory 30, a network communication module 10, and a processor 20.
  • the network communication module 10 is used to connect to a network.
  • the processor 20 is connected to the network communication module 10 and the memory 30.
  • the processor 20 obtains the current network speed of the network through the network communication module 10, determines the size of the file segment currently suitable for downloading by one connection according to the current network speed of the network, and initiates a new connection for downloading a file segment,
  • the file is downloaded by the network communication module 10, and the downloaded file segment is saved on the memory 30.
  • the file fragment may include at least one file partition.
  • processor 20 can also perform other steps in the methods described above, and details are not described herein again.
  • the technology in the embodiments of the present invention can be implemented by means of software plus necessary general hardware including general-purpose integrated circuits, general-purpose CPUs, general-purpose memories, general-purpose components, and the like. It can be implemented by dedicated hardware including an application specific integrated circuit, a dedicated CPU, a dedicated memory, a dedicated component, etc., but in many cases the former is a better implementation. Based on such understanding, the technical solution in the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product, which may be stored in a storage medium such as a read-only memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • CD Compact Disc
  • the above technical concept of the present invention can also be embodied as a non-transitory machine readable storage medium having executable code stored thereon.
  • the processor When the executable code is executed by the processor, the processor is caused to perform the method described above.
  • the above technical concept of the present invention can also be embodied as a computing device including a processor and a non-transitory machine readable storage medium.
  • the non-transitory machine readable storage medium stores executable code thereon.
  • the processor is caused to perform the method described above.
  • the method according to the invention can also be implemented as a computer program comprising computer program code instructions for performing the various steps defined above in the above method of the invention.
  • the method according to the invention may also be embodied as a computer program product comprising a computer readable medium on which is stored a computer for performing the above-described functions defined in the above method of the invention program.
  • the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both.
  • each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Executable instructions.
  • the functions noted in the blocks may also occur in a different order than the ones in the drawings. For example, two consecutive blocks may be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented in a dedicated hardware-based system that performs the specified function or operation. Or it can be implemented by a combination of dedicated hardware and computer instructions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

Disclosed in the present invention are a method and an apparatus for downloading files, a computing device and a non-transitory machine readable storage medium, the file is composed of multiple file blocks with a fixed size, and the method includes: obtaining the current network speed of a network; determining, according to the current network speed, the size of a file segment that is suitable for being downloaded through one link currently, and the file segment includes at least one file block; and initiating a new link for downloading the file segment to download the file. By the above manner, the present invention can make use of network bandwidth reasonably and improve the efficiency of file downloading effectively.

Description

文件下载的方法及装置、计算设备及非暂时性机器可读存储介质File downloading method and device, computing device and non-transitory machine readable storage medium 技术领域Technical field
本发明涉及文件下载技术领域,特别是涉及一种文件下载的方法及装置、计算设备及非暂时性机器可读存储介质。The present invention relates to the field of file downloading technologies, and in particular, to a file downloading method and apparatus, a computing device, and a non-transitory machine readable storage medium.
背景技术Background technique
目前文件下载方式只有两种,一种是非断点续传,另一种则是断点续传。断点续传方式能有效避免重复下载,充分利用带宽,有效提高下载速度,因此,断点续传方式被广泛应用。At present, there are only two ways to download files, one is non-breakpoint continuous transmission, and the other is a resume. The breakpoint continuous transmission mode can effectively avoid repeated downloads, make full use of bandwidth, and effectively improve the download speed. Therefore, the breakpoint resume transmission mode is widely used.
在断点续传的下载方式中,文件分割成很多固定大小的文件分块(block)。移动平台上,传统的断点续传下载机制是每个请求仅下载一个固定大小的block,在一般的下载中,过程是:对前3个block建立3个连接请求,当其中的一个block下载完毕后,建立第4个block的连接请求,以此类推,直至将所有block下载完毕,整个下载任务完成。In the download mode of the resume of the breakpoint, the file is divided into a number of fixed-size file blocks. On the mobile platform, the traditional breakpoint download mechanism is to download only one fixed-size block per request. In the normal download, the process is: establish 3 connection requests for the first 3 blocks, and download one of the blocks. After the completion, the connection request of the fourth block is established, and so on, until all the blocks are downloaded, and the entire download task is completed.
其中,每一个block的下载过程一般都包括调度开始下载、初始化网络、发送请求、接收数据以及调度完成下载五个步骤。在网络速度不是很高的情况下,接收数据的步骤消耗时间较多,其它步骤消耗时间较少(与网络速度关系不大,一般可认为是固定值),接收数据的步骤所需的时间与其它步骤所需的时间的比值较大。由于接收数据的步骤是实际执行下载动作的,因此比值越大,下载效率就越高。The download process of each block generally includes five steps of scheduling start downloading, initializing the network, sending a request, receiving data, and scheduling to complete the download. In the case that the network speed is not very high, the steps of receiving data consume more time, other steps consume less time (not related to network speed, generally can be regarded as a fixed value), and the time required to receive data is The ratio of time required for other steps is larger. Since the step of receiving data is actually performing the downloading action, the larger the ratio, the higher the downloading efficiency.
但在处于高速网络环境下,对于一个block的下载过程来说,接收数据的步骤耗时会大大减少(有可能会减小到与其它步骤耗时相当,甚至于小于其它步骤耗时),此时接收数据的步骤所需的时间与其它步骤所需的时间的比值会大大减小,导致下载效率的降低。However, in a high-speed network environment, the process of receiving data is greatly reduced in time for a block download process (it may be reduced to be time-consuming equivalent to other steps, or even less than other steps). The ratio of the time required to receive the data to the time required for the other steps is greatly reduced, resulting in a decrease in download efficiency.
例如,在一个网络速度较低的情况下,对于每一个block的下载过程,接收数据的步骤可能耗时5s,其它步骤总共耗时100ms,二者的比值为50:1,实际执行下载的时间与执行其它步骤的时间的比值较大,此时的下载效率 较高。当网络速度提升到一个高度网络环境下时,对于每一个block的下载过程,接收数据的步骤耗时会减少至1s甚至更短,在这种情况下,其它步骤的耗时基本不变(100ms),此时实际执行下载的时间与执行其它步骤的时间的比值仅为10:1,即在每一个block的下载过程中,有接近十分之的时间处于下载准备阶段,使得不能充分利用网络速度,导致下载效率的降低。For example, in the case of a low network speed, for each block download process, the step of receiving data may take 5 s, the other steps take a total of 100 ms, the ratio of the two is 50:1, the actual download time The ratio of the time to perform other steps is large, and the download efficiency at this time Higher. When the network speed is increased to a high network environment, the step of receiving data will be reduced to 1 s or even shorter for each block download process. In this case, the time consumption of other steps is basically the same (100ms). ), the ratio of the time when the actual download is performed to the time when the other steps are performed is only 10:1, that is, in the download process of each block, there is nearly ten minutes in the download preparation stage, so that the network speed cannot be fully utilized. , resulting in reduced download efficiency.
综上,传统的断点续传下载方式在网络速度很快并接近或比固定的block大小还要大的时候,实际的下载效率降低,下载速度不能达到最大网速。In summary, the traditional breakpoint download method is faster when the network speed is close to or larger than the fixed block size, the actual download efficiency is reduced, and the download speed cannot reach the maximum network speed.
发明内容Summary of the invention
本发明主要解决的技术问题是提供一种文件下载的方法及装置、计算设备以及非暂时性机器可读存储介质,能够合理利用网络带宽,有效提高下载的效率。The technical problem to be solved by the present invention is to provide a method and device for downloading files, a computing device, and a non-transitory machine-readable storage medium, which can reasonably utilize network bandwidth and effectively improve downloading efficiency.
为了解决上述技术问题,本发明实施例公开了如下技术方案:In order to solve the above technical problem, the embodiment of the present invention discloses the following technical solutions:
根据本发明的一个方面,提供了一种文件下载方法,文件由多个大小固定的文件分块组成,该方法包括:获取网络当前的网络速度;根据网络当前的网络速度,确定适于由一个连接下载的文件片段的大小,文件片段包括至少一个文件分块;发起用于下载一个所述文件片段的新连接,以下载所述文件。According to an aspect of the present invention, a file downloading method is provided. The file is composed of a plurality of fixed-size files, the method includes: acquiring a current network speed of the network; determining, according to the current network speed of the network, The size of the downloaded file fragment is connected, the file fragment includes at least one file partition; a new connection for downloading one of the file fragments is initiated to download the file.
优选地,根据网络当前的网络速度确定当前适于由一个连接来下载的文件片段的大小的步骤可以包括:根据网络当前的网络速度,确定当前适于由一个连接来下载的文件分块的个数;根据文件分块的个数和每个文件分块的大小,确定文件片段的大小。Preferably, the step of determining the size of the file segment currently suitable for downloading by one connection according to the current network speed of the network may include: determining, according to the current network speed of the network, a file partition currently suitable for downloading by one connection. Number; determines the size of the file fragment based on the number of file partitions and the size of each file partition.
优选地,文件片段的大小可以为文件分块的个数乘以每个文件分块的大小,其中,每个文件分块的大小可以相等。Preferably, the size of the file fragment may be the number of file partitions multiplied by the size of each file partition, wherein the size of each file partition may be equal.
优选地,当前适于由一个下载的文件分块的个数可以是通过下述公式获得的:Preferably, the number of blocks currently suitable for being blocked by a downloaded file can be obtained by the following formula:
Figure PCTCN2015092606-appb-000001
Figure PCTCN2015092606-appb-000002
Figure PCTCN2015092606-appb-000001
And
Figure PCTCN2015092606-appb-000002
其中,n是系数,当前的网络速度是指网络当前每秒钟能够传输的数据量。Where n is the coefficient, and the current network speed refers to the amount of data that the network can currently transmit per second.
优选地,该方法还可以包括:在发起用于下载一个文件片段的新连接以下载文件的步骤之后,判断当前已经发起的用于下载文件的连接的连接个数是否达到预设上限值;如果达到,则等待当前的连接下载完成;如果没有达到,则返回根据网络当前的网络速度,确定当前适于由一个连接来下载的文件片段的大小的步骤。Preferably, the method may further include: after the step of initiating a new connection for downloading a file segment to download the file, determining whether the number of connections currently connected for downloading the file reaches a preset upper limit value; If so, wait for the current connection download to complete; if not, return to the step of determining the size of the file segment currently suitable for download by a connection based on the current network speed of the network.
优选地,该方法还可以包括:在当前的连接下载完成之后,判断文件的所有文件分块是否下载完成;如果没有下载完成,则返回根据网络当前的网络速度,确定当前适于由一个连接来下载的文件片段的大小的步骤;如果下载完成,则结束文件的下载。Preferably, the method may further include: after the current connection download is completed, determining whether all file partitioning of the file is completed; if no download is completed, returning according to the current network speed of the network, determining that the current configuration is suitable for being connected by a connection. The step of downloading the size of the file fragment; if the download is complete, the download of the file is ended.
优选地,该方法还可以包括:在开始下载时,发起用于下载一个文件分块的第一连接以下载文件,获取网络当前的网络速度的步骤包括:根据第一连接的下载过程来确定所述网络当前的网络速度。Preferably, the method may further include: when starting the downloading, initiating a first connection for downloading a file partition to download the file, and acquiring the current network speed of the network comprises: determining, according to the download process of the first connection The current network speed of the network.
优选地,该方法还可以包括:根据第一连接的下载过程中所返回的报文来判断是否支持断点续传,其中,在支持断点续传的情况下,执行获取网络当前的网络速度的步骤。Preferably, the method may further include: determining, according to the message returned in the download process of the first connection, whether to support the resume of the breakpoint, wherein, in the case of supporting the resume of the breakpoint, performing the current network speed of acquiring the network A step of.
优选地,获取网络当前的网络速度的步骤包括:在下载过程中,根据刚完成下载的连接的下载过程来确定网络当前的网络速度。Preferably, the step of obtaining the current network speed of the network comprises: determining the current network speed of the network according to the download process of the connection just completed downloading during the downloading process.
根据本发明的另一个方面,提供了一种文件下载装置,文件由多个大小固定的文件分块组成,装置包括:获取模块,用于获取网络当前的网络速度;确定模块,用于根据网络当前的网络速度,确定当前适于由一个连接来下载的文件片段的大小,文件片段包括至少一个文件分块;下载模块,用于发起用于下载一个所述文件片段的新连接,以下载所述文件。According to another aspect of the present invention, a file downloading apparatus is provided. The file is composed of a plurality of fixed-size files, and the device includes: an obtaining module, configured to acquire a current network speed of the network; and a determining module, configured to The current network speed, determining the size of the file segment currently suitable for downloading by a connection, the file segment including at least one file partition; a download module for initiating a new connection for downloading a file segment to download Document.
优选地,确定模块可以包括:第一确定模块,用于根据网络当前的网络速度,确定当前适于由一个连接来下载的所述文件分块的个数;第二确定模块,用于根据文件分块的个数和每个文件分块的大小,确定文件片段的大小。Preferably, the determining module may include: a first determining module, configured to determine, according to a current network speed of the network, a number of the file partitions currently suitable for downloading by one connection; and a second determining module, configured to The number of chunks and the size of each file chunk determine the size of the file fragment.
优选地,文件分块的大小可以为文件分块的个数乘以每个文件分块的大小,其中,每个文件分块的大小相等。Preferably, the size of the file partition may be the number of file partitions multiplied by the size of each file partition, wherein each file partition is equal in size.
其中,当前适于由一个连接下载的文件分块的个数可以是通过下述公式 获得:Wherein, the number of files currently suitable for downloading by one connection can be determined by the following formula obtain:
Figure PCTCN2015092606-appb-000003
Figure PCTCN2015092606-appb-000004
Figure PCTCN2015092606-appb-000003
And
Figure PCTCN2015092606-appb-000004
其中,n是系数,当前的网络速度是指网络当前每秒钟能够传输的数据量。Where n is the coefficient, and the current network speed refers to the amount of data that the network can currently transmit per second.
优选地,装置还可以包括:第一判断模块,用于在下载模块发起用于下载一个文件片段的新连接以下载文件之后,判断当前已经发起的用于下载文件的连接的连接个数是否达到预设上限值;如果达到,则等待下载模块中当前的连接下载完成;如果没有达到,则返回确定模块。Preferably, the device may further include: a first determining module, configured to determine, after the downloading module initiates a new connection for downloading a file segment to download the file, whether the number of connections currently connected for downloading the file is reached The upper limit is preset; if it is reached, the current connection download in the download module is completed; if not, the determination module is returned.
优选地,装置还可以包括:第二判断模块,用于在下载模块中当前的连接下载完成之后,判断文件的所有文件分块是否下载完成;如果没有下载完成,则返回确定模块;如果下载完成,则下载模块结束文件的下载。Preferably, the device may further include: a second determining module, configured to determine whether all file partitioning of the file is completed after the current connection downloading in the downloading module is completed; if the downloading is not completed, returning to the determining module; if the downloading is completed , then download the module to end the download of the file.
优选地,装置还可以包括:第一分块下载模块,用于在开始下载时,发起用于下载一个文件分块的第一连接,以下载文件,获取模块根据第一分块下载模块的下载过程来确定网络当前的网络速度。Preferably, the device may further include: a first block downloading module, configured to initiate a first connection for downloading a file block to download a file, and the obtaining module downloads the module according to the first block downloading module when starting the downloading The process determines the current network speed of the network.
优选地,装置还可以包括:第三判断模块,根据第一分块下载模块的下载过程中所返回的报文来判断是否支持断点续传,其中,在支持断点续传的情况下,执行获取网络当前的网络速度的步骤。Preferably, the device may further include: a third determining module, determining, according to the message returned during the downloading process of the first block downloading module, whether to support the resume of the breakpoint, wherein, in the case of supporting the resume of the breakpoint, Perform the steps to get the current network speed of the network.
优选地,在下载过程中,获取模块可以根据刚完成下载的连接的下载过程来确定网络当前的网络速度。Preferably, during the downloading process, the obtaining module may determine the current network speed of the network according to the downloading process of the connection that just completed the download.
根据本发明的另一个方面,提供了一种非暂时性机器可读存储介质,其上存储有可执行代码,当可执行代码被处理器执行时,使处理器执行根据本发明的方法。According to another aspect of the present invention, there is provided a non-transitory machine readable storage medium having stored thereon executable code for causing a processor to perform a method according to the present invention when executable code is executed by a processor.
根据本发明的另一个方面,提供了一种能够下载文件的计算设备,文件由多个大小固定的文件分块组成,该计算设备包括:存储器;网络通信模块,用于连接到网络;处理器,连接到网络通信模块和存储器,用于通过网络通信模块来获取网络当前的网络速度,根据网络当前的网络速度来确定当前适于由一个连接来下载的文件片段的大小,发起用于下载一个所述文件片段的新连接,以通过网络通信模块下载所述文件,并将所下载的文件片段保存在存储器上,文件片段包括至少一个文件分块。According to another aspect of the present invention, there is provided a computing device capable of downloading a file, the file consisting of a plurality of fixed-size file blocks, the computing device comprising: a memory; a network communication module for connecting to the network; Connected to the network communication module and the memory, used to obtain the current network speed of the network through the network communication module, determine the size of the file segment currently suitable for downloading by a connection according to the current network speed of the network, and initiate a download for downloading A new connection of the file fragment to download the file via a network communication module and save the downloaded file fragment on a memory, the file fragment including at least one file partition.
由以上技术方案可见,本发明实施例提供的文件下载的方法及装置,通 过获取网络当前的网络速度,并根据网络当前的网络速度,确定当前适于由一个连接来下载的文件片段的大小,以文件片段的大小为下载任务目标发起新连接以下载文件。通过这种方式,能够动态分配当前所能连接下载的文件分块的个数,从而合理利用网络带宽,有效提高下载效率。The method and device for downloading a file provided by the embodiment of the present invention can be seen by the above technical solutions. Obtain the current network speed of the network, and determine the size of the file segment currently suitable for downloading by one connection according to the current network speed of the network, and initiate a new connection to download the file for the download task target by the size of the file segment. In this way, the number of file partitions that can be connected and downloaded can be dynamically allocated, thereby rationally utilizing network bandwidth and effectively improving download efficiency.
附图说明DRAWINGS
通过结合附图对本公开示例性实施方式进行更详细的描述,本公开的上述以及其它目的、特征和优势将变得更加明显,其中,在本公开示例性实施方式中,相同的参考标号通常代表相同部件。The above and other objects, features, and advantages of the present invention will become more apparent from the aspects of the embodiments of the invention. The same parts.
图1是根据本发明文件下载方法一个实施例的流程示意图;1 is a flow chart showing an embodiment of a file downloading method according to the present invention;
图2是图1所示步骤S120可以包括的子步骤的流程示意图;2 is a schematic flow chart of sub-steps that can be included in step S120 shown in FIG. 1;
图3是根据本发明文件下载方法另一个实施例的流程示意图;3 is a schematic flow chart of another embodiment of a file downloading method according to the present invention;
图4是根据本发明文件下载方法在一具体下载任务中第一流程图;4 is a first flow chart of a file downloading method in a specific downloading task according to the present invention;
图5是根据本发明文件下载方法在一具体下载任务中第二流程图;Figure 5 is a second flow chart of a file downloading method in a specific downloading task according to the present invention;
图6是根据本发明文件下载方法在一具体下载任务中第三流程图;6 is a third flowchart of a file downloading method in a specific downloading task according to the present invention;
图7是根据本发明文件下载方法在一具体下载任务中第四流程图;7 is a fourth flow chart of a file downloading method in a specific downloading task according to the present invention;
图8是根据本发明文件下载方法在一具体下载任务中第五流程图;Figure 8 is a fifth flow chart of a file downloading method in a specific downloading task according to the present invention;
图9是根据本发明文件下载方法在一具体下载任务中第六流程图;9 is a sixth flowchart of a file downloading method in a specific downloading task according to the present invention;
图10是根据本发明文件下载方法在一具体下载任务中第七流程图;10 is a seventh flowchart of a file downloading method in a specific downloading task according to the present invention;
图11是根据本发明文件下载装置一实施方式的结构示意图;11 is a schematic structural diagram of an embodiment of a file downloading apparatus according to the present invention;
图12是图11所示确定模块可以包括的可选单元的结构示意图;12 is a schematic structural diagram of an optional unit that can be included in the determining module shown in FIG. 11;
图13是根据本发明文件下载装置另一实施方式的结构示意图;FIG. 13 is a schematic structural diagram of another embodiment of a file downloading apparatus according to the present invention; FIG.
图14是根据本发明能够下载文件的计算设备的一个实施例的结构示意图。14 is a block diagram showing an embodiment of a computing device capable of downloading files in accordance with the present invention.
具体实施方式detailed description
下面将参照附图更详细地描述本公开的优选实施方式。虽然附图中显示了本公开的优选实施方式,然而应该理解,可以以各种形式实现本公开而不应被这里阐述的实施方式所限制。相反,提供这些实施方式是为了使本公开更加透彻和完整,并且能够将本公开的范围完整地传达给本领域的 技术人员。Preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While the preferred embodiment of the present invention has been shown in the drawings, it is understood that Rather, these embodiments are provided so that this disclosure will be thorough and complete, and the scope of the disclosure can be Technical staff.
下面结合附图和实施方式对本发明进行详细说明。The invention will now be described in detail in conjunction with the drawings and embodiments.
参阅图1,图1是根据本发明文件下载方法一个实施例的流程示意图,其中,文件由多个大小固定的文件分块(block)组成,例如,一个25600KB大小的文件,分割为100个文件分块,每个文件分块的大小为256KB。Referring to FIG. 1, FIG. 1 is a schematic flowchart of an embodiment of a file downloading method according to the present invention, wherein a file is composed of a plurality of fixed-size file blocks, for example, a file of 25600 KB in size and divided into 100 files. Blocking, each file is 256KB in size.
如图1所示,在步骤S110,获取网络当前的网络速度。As shown in FIG. 1, in step S110, the current network speed of the network is acquired.
网络速度,即网速,一般是指电脑或手机上网时,上传和下载数据时,请求和返回数据所用的时间长短。获取网络当前的网络速度的方式可以是计算一段时间内网络处理的数据量总和除以该时间段长度得到的。在下文中的计算公式中,当前的网络速度可以以网络当前每秒钟能够传输的数据量来表示。Network speed, that is, network speed, generally refers to the length of time it takes to request and return data when uploading and downloading data when a computer or mobile phone is online. The way to obtain the current network speed of the network may be calculated by dividing the sum of the data processed by the network over a period of time by the length of the time period. In the calculation formula below, the current network speed can be expressed in terms of the amount of data that the network can currently transmit per second.
在步骤S120,根据网络当前的网络速度,确定当前适于由一个连接来下载的文件片段的大小,文件片段包括至少一个文件分块。In step S120, the size of the file segment currently suitable for downloading by one connection is determined according to the current network speed of the network, and the file segment includes at least one file partition.
其中,文件片段的大小根据当前的网络速度而定,确定好的文件片段可以包括多个文件分块(网络速度较高的情况下),也可以是一个文件分块(网络速度较低的情况下)。The size of the file segment depends on the current network speed. The determined file segment may include multiple file segments (when the network speed is high), or may be a file block (the network speed is low). under).
在步骤S130,发起用于下载一个文件片段的新连接,以下载文件。At step S130, a new connection for downloading a file segment is initiated to download the file.
此时,以确定好的文件片段的大小为单个连接的下载任务目标发起新连接以下载文件,而不是总是以单个文件分块的大小为单个连接的下载任务目标发起新连接以下载文件,通过这种方式,能够合理利用网络带宽,有效提高下载的速度。At this point, to determine the size of a good file fragment to initiate a new connection to download the file for a single connected download task target, instead of always launching a new connection to download the file for a single connected download task target in the size of a single file chunk. In this way, the network bandwidth can be reasonably utilized, and the download speed can be effectively improved.
综上,本发明提出了一种在不改变block划分的情况下,通过执行过程中的优化,以提高下载效率的方法。也就是说,每个连接下载的文件的大小并不是固定为一个block,而是可以通过网络速度、网络类型等实际网络情况,动态分配多个连续block组成的一个文件片段,将文件片段交由一个连接下载,以提高下载效率。这样,在不改变block划分的前提下,在遇到异常情况(如下载错误),可以通过直接抛弃并重新下载该block,以达到简化程序调度逻辑。block的划分不宜过大,否则需要抛弃时的代价会过高,但是也不能过小,因为会增大调度的开销,一般使用和传统断点续传下载一样的block大小即可。并且这种下载方式从本质上看还是连续下载,配合上层的调度和 适当缓存,可以保证文件依旧是连续写入文件,能有效缓解移动设备低效文件IO导致的效率问题。In summary, the present invention proposes a method for improving download efficiency by performing optimization in the process without changing the block division. That is to say, the size of the file downloaded by each connection is not fixed to a block, but a file segment composed of multiple consecutive blocks can be dynamically allocated through actual network conditions such as network speed and network type, and the file segment is handed over to the file segment. A connection download to improve download efficiency. In this way, without changing the block division, in case of an abnormal situation (such as a download error), the program can be simplified by directly discarding and re-downloading the block. The division of the block should not be too large, otherwise the cost of abandonment will be too high, but it should not be too small, because it will increase the overhead of scheduling, generally use the same block size as the traditional breakpoint download. And this kind of downloading method is essentially continuous downloading, with the upper layer scheduling and Appropriate caching can ensure that the file is still continuously written to the file, which can effectively alleviate the efficiency problem caused by the inefficient file IO of the mobile device.
图2是图1所示步骤S120可以包括的子步骤的流程示意图。FIG. 2 is a schematic flow chart of sub-steps that can be included in step S120 shown in FIG. 1.
在步骤S1210,根据网络当前的网络速度,确定当前适于由一个连接来下载的文件分块的个数。In step S1210, based on the current network speed of the network, the number of file partitions currently suitable for downloading by one connection is determined.
如果网络当前的网络速度接近或大于单个文件分块的大小,则当前网络适于连接下载的文件分块的个数可以是一个以上,如果网络当前的网络速度远远小于等于单个文件分块的大小,则当前网络适于连接下载的文件分块的个数应为一个。当前网络适于连接下载的文件分块的个数可以按照网络当前的网络速度是单个文件分块的大小的倍数来确定,也可以根据测量试验,来获取经验规律,根据经验规律确定当前网络适于连接下载的文件分块的个数,或者也可以通过其他方法确定等。根据网络当前的网络速度,动态分配网络当前所能连接下载的文件分块的个数,从而合理利用网络带宽,有效提高下载的速度。例如,网络当前的网络速度是256KB,每个文件分块的大小为256KB,则当前网络适于连接下载的文件分块的个数可以是一个。If the current network speed of the network is close to or larger than the size of a single file partition, the number of file partitions that the current network is suitable for downloading and downloading may be more than one, if the current network speed of the network is far less than or equal to a single file partition. The size, the number of files that the current network is suitable for connection to download should be one. The number of file partitions that the current network is suitable for downloading and downloading may be determined according to the current network speed of the network being a multiple of the size of a single file partition, or may be based on measurement experiments to obtain an empirical rule, and determining the current network according to an empirical rule. The number of blocks that are connected to the downloaded file, or can be determined by other methods. According to the current network speed of the network, dynamically allocate the number of files that the network can currently connect to download, thereby rationally utilizing the network bandwidth and effectively improving the download speed. For example, the current network speed of the network is 256 KB, and the size of each file partition is 256 KB, and the number of file partitions that the current network is suitable for downloading and downloading may be one.
在步骤S1210,根据文件分块的个数和每个文件分块的大小,确定网络当前适于连接下载的文件片段的大小。In step S1210, based on the number of file partitions and the size of each file partition, the size of the file segment that the network is currently suitable for connection to download is determined.
在已知文件分块的个数和每个文件分块的大小的情况下,即可确定网络当前适于连接下载的文件片段的大小。In the case where the number of file partitions and the size of each file partition are known, the size of the file segment that the network is currently suitable for connection to download can be determined.
其中,网络当前适于连接下载的文件片段的大小为文件分块的个数乘以每个文件分块的大小,其中,每个文件分块的大小相等。例如,确定的文件分块的个数是4个,每个文件分块的大小是256KB,则网络当前适于连接下载的总的文件片段的大小为1024KB。The size of the file segment currently suitable for connection and downloading by the network is the number of file partitions multiplied by the size of each file chunk, wherein each file chunk is equal in size. For example, the determined number of file partitions is four, and the size of each file partition is 256 KB, and the total file fragment currently suitable for connection downloading by the network is 1024 KB.
由上可知,本发明实施例通过获取网络当前的网络速度,根据网络当前的网络速度,确定网络当前所能连接下载的文件分块的个数,并根据文件分块的个数和每个文件分块的大小,确定网络当前适于连接下载的文件片段的大小;以文件片段的大小为单个连接的下载任务目标发起新连接以下载文件。由于根据网络当前的网络速度,确定网络当前适于连接下载的文件分块的个数,从而确定以网络当前所能连接下载的文件片段的大小为单个连接的下载任务目标发起新连接以下载文件,通过这种方式,能够动态分配当前所能连 接下载的文件分块的个数,从而合理利用网络带宽,有效提高下载的速度。As can be seen from the above, the embodiment of the present invention determines the number of file partitions that the network can currently connect to and download according to the current network speed of the network, and according to the number of file partitions and each file. The size of the block determines the size of the file segment that the network is currently suitable for connection to download; initiates a new connection to download the file for the download task target of a single connection with the size of the file fragment. According to the current network speed of the network, determine the number of file partitions that the network is currently suitable for connecting to download, thereby determining to initiate a new connection to download the file for the download task target of the single connection by the size of the file fragment currently connected to the network. In this way, it is possible to dynamically allocate the current connection. The number of downloaded files is divided into blocks, so that the network bandwidth can be reasonably utilized, and the download speed can be effectively improved.
参阅图3,图3是根据本发明文件下载方法另一个实施方式的流程示意图,本实施方式和图1的实施方式基本相同,相同之处请参见图1以及相应的文字说明。Referring to FIG. 3, FIG. 3 is a schematic flowchart of another embodiment of a file downloading method according to the present invention. The embodiment is basically the same as the embodiment of FIG. 1. For the similarities, please refer to FIG. 1 and corresponding text descriptions.
如图3所示,在步骤S210,发起用于下载一个文件分块的第一连接,以下载文件。该第一连接的下载任务目标为一个文件分块。As shown in FIG. 3, in step S210, a first connection for downloading a file partition is initiated to download a file. The download task of the first connection is targeted to a file partition.
在步骤S220,监控下载过程,在下载完成时,获取网络当前的网络速度。In step S220, the download process is monitored, and when the download is completed, the current network speed of the network is acquired.
步骤S210和步骤S220的作用主要是为了获取网络当前较准确、实时的网络速度,另外,在以一个文件分块的大小为下载任务目标发起第一连接以下载文件时,还可以根据返回的报文判断当前下载是否支持断点续传(即图中步骤S215),在判断当前下载不支持断点续传的情况下,可以保持第一连接下载文件直到完成(即图中步骤S217),本发明实施方式是在支持断点续传的情况下实施的。The functions of step S210 and step S220 are mainly for obtaining the current accurate and real-time network speed of the network. In addition, when the first connection is initiated to download the file by the size of a file block, the report may also be returned according to the returned report. The text determines whether the current download supports the resume of the breakpoint (ie, step S215 in the figure), and if it is determined that the current download does not support the resume of the breakpoint, the first connection download file can be kept until the completion (ie, step S217 in the figure), Embodiments of the invention are implemented with support for breakpoint retransmission.
在步骤S230,根据网络当前的网络速度,确定当前适于由一个连接下载的文件分块的个数。In step S230, based on the current network speed of the network, the number of files that are currently suitable for downloading by one connection is determined.
其中,网络当前适于连接下载的文件分块的个数是通过下述公式获得的:The number of file partitions that the network is currently suitable for connection to download is obtained by the following formula:
Figure PCTCN2015092606-appb-000005
Figure PCTCN2015092606-appb-000006
Figure PCTCN2015092606-appb-000005
And
Figure PCTCN2015092606-appb-000006
n是系数,当前的网络速度是指网络当前每秒钟能够传输的数据量。n is the coefficient, and the current network speed refers to the amount of data that the network can currently transmit per second.
当前的网络速度可以实时更新,并且计算时要去除网络波动带来的网络速度上下浮动的影响,以反应最真实的当前的网络速度。系数n根据文件分块block大小的不同而不同,且只有
Figure PCTCN2015092606-appb-000007
时才会有意义。具体系数n的取值则可以根据block大小和业务所在区域的网络情况,通过大量实验测试,获取表现最好的值;系数n也可以是根据实际测量得出的一个经验值。
The current network speed can be updated in real time, and the impact of network fluctuations caused by network fluctuations should be removed in order to reflect the most realistic current network speed. The coefficient n varies depending on the size of the file block block, and only
Figure PCTCN2015092606-appb-000007
It only makes sense. The value of the specific coefficient n can be obtained through a large number of experimental tests according to the block size and the network condition of the service area, and the coefficient n can also be an empirical value obtained according to the actual measurement.
在步骤S240,根据文件分块的个数和每个文件分块的大小,确定当前适于由一个连接下载的文件片段的大小。In step S240, the size of the file segment currently suitable for download by one connection is determined according to the number of file partitions and the size of each file partition.
在步骤S250,发起用于下载一个文件片段的新连接,以下载文件。At step S250, a new connection for downloading a file segment is initiated to download the file.
在步骤S260,判断当前已经发起的用于下载文件的连接的连接个数是否达到预设上限值。如果达到,进入步骤S270;如果没有达到,返回步骤S230。 In step S260, it is determined whether the number of connections of the connection for downloading the file that has been currently initiated reaches a preset upper limit value. If yes, go to step S270; if not, go back to step S230.
在步骤S270,等待当前的连接下载完成。At step S270, it waits for the current connection download to be completed.
判断当前已经发起的用于下载文件的连接的连接个数是否达到预设上限值,是为了防止并行发起过多的连接反而使得下载效率下降。It is determined whether the number of connections that have been initiated for downloading a file has reached a preset upper limit value, so as to prevent excessive connection from being initiated in parallel, thereby reducing download efficiency.
在步骤S280,判断文件的所有文件分块是否下载完成;如果没有下载完成,则返回步骤S230;如果下载完成,则进入步骤S290。In step S280, it is judged whether all the file partitioning of the file is completed; if no download is completed, the process returns to step S230; if the download is completed, the process proceeds to step S290.
在步骤S290,结束文件的下载。At step S290, the download of the file is ended.
需要说明的是,步骤S260和步骤S280在执行的时候没有明显的先后顺序。另外,在步骤S260和步骤S280之后返回步骤S230之前,还可以在步骤S285重新获取网络速度。It should be noted that step S260 and step S280 have no obvious sequence when executed. In addition, before returning to step S230 after step S260 and step S280, the network speed may be reacquired in step S285.
在步骤S285,可以根据刚完成下载的连接的下载过程来确定网络当前的网络速度。这样,在步骤S230就可以根据步骤S285获取的新的当前网络速度来进行接下来的操作。由此,可以随时监控网络速度,从而随时更新单个连接下载的文件片段的大小。At step S285, the current network speed of the network can be determined based on the download process of the connection that just completed the download. Thus, in step S230, the next operation can be performed according to the new current network speed acquired in step S285. As a result, the network speed can be monitored at any time, so that the size of the file segments downloaded by a single connection can be updated at any time.
在这一实施方式中,获取网络当前的网络速度;根据网络当前的网络速度,确定网络当前适于连接下载的文件分块的个数;根据文件分块的个数和每个文件分块的大小,确定网络当前适于连接下载的文件片段的大小;以文件片段的大小为单个连接的下载任务目标发起新连接以下载文件。由于根据网络当前的网络速度,确定网络当前适于连接下载的文件分块的个数,从而确定以网络当前适于连接下载的文件片段的大小为单个连接的下载任务目标发起新连接以下载文件,通过这种方式,能够动态分配当前适于连接下载的文件分块的个数,从而合理利用网络带宽,有效提高下载的速度。In this implementation manner, obtaining the current network speed of the network; determining, according to the current network speed of the network, the number of file partitions that the network is currently suitable for connection to download; according to the number of file partitions and each file partitioning Size, determines the size of the file segment that the network is currently suitable for connection to download; initiates a new connection to download the file for the download task target for a single connection with the size of the file fragment. Since the number of file partitions that the network is currently suitable for connecting to the download is determined according to the current network speed of the network, it is determined that a new connection is initiated to download the file for the download task target of the single connection by the size of the file segment currently suitable for the connection to be downloaded. In this way, the number of file partitions currently suitable for connection downloading can be dynamically allocated, thereby rationally utilizing network bandwidth and effectively increasing the download speed.
下面以一个分成32个block的文件的下载任务(如图4所示)为例来说明本发明的方法,该任务支持断点续传,并发连接预设上限值为3,系数n为5,以下具体说明整个下载流程:In the following, the download task (shown in FIG. 4) of a file divided into 32 blocks is taken as an example to illustrate the method of the present invention. The task supports breakpoint continuous transmission, and the concurrent connection preset upper limit value is 3, and the coefficient n is 5. The following details the entire download process:
第一步:线程1发起连接,请求下载第一个文件分块,参见图5的1部分。The first step: thread 1 initiates a connection, requesting to download the first file partition, see the 1 part of Figure 5.
第二步:当线程1下载完毕后,如果获取的网络当前的网络速度为1×block大小,根据下述公式:Step 2: After the thread 1 is downloaded, if the current network speed of the acquired network is 1×block size, according to the following formula:
Figure PCTCN2015092606-appb-000008
Figure PCTCN2015092606-appb-000009
Figure PCTCN2015092606-appb-000008
And
Figure PCTCN2015092606-appb-000009
代入数值计算后得到:网络当前所能连接下载的文件分块的个数为6; After substituting the numerical calculation, it is obtained that the number of files that can be connected and downloaded by the network is 6;
再根据公式:block大小×block个数,According to the formula: block size × block number,
代入数值计算后得到新连接请求的总的文件分块(即文件片段)的大小为6×block大小,以此大小为下载任务目标发起新连接请求,具体请求的文件部分如图6的2-7部分。After the numerical calculation is performed, the total file partition (ie, the file fragment) of the new connection request is 6×block size, and the new connection request is initiated for the download task target. The file part of the specific request is as shown in FIG. 6-2. 7 parts.
第三步:根据前述步骤可以知道目前只有线程1处于下载状态,而设定的并发连接上限值为3,还未达到并发连接上限值,所以继续启动线程2和线程3,对应请求的文件部分分别如图7的8-13部分、如图8的14-19部分。The third step: According to the foregoing steps, it can be known that only thread 1 is in the download state, and the set concurrent connection upper limit value is 3, and the concurrent connection upper limit value has not been reached, so thread 2 and thread 3 are continuously started, corresponding to the request. The file parts are as shown in parts 8-13 of Figure 7, as shown in parts 14-19 of Figure 8.
第四步:当线程1再次下载完成后,如果此时的网络速度为2×block大小,根据前述的计算方式可以得到取连续11个block发起新的连接,对应请求的文件部分如图9的20-30部分。Step 4: After the thread 1 is downloaded again, if the network speed at this time is 2×block size, according to the foregoing calculation method, a new connection can be obtained by taking 11 consecutive blocks, and the file part corresponding to the request is as shown in FIG. Section 20-30.
第五步:当线程2下载完毕后,如果此时网络速度还是为2×block大小,但由于未下载的block不足11个。因此取最后剩余的全部block开始新的连接,对应请求的文件部分如图10的31-32部分。Step 5: When the thread 2 is downloaded, if the network speed is still 2×block size, but there are less than 11 blocks not downloaded. Therefore, the last remaining blocks are taken to start a new connection, and the corresponding file portion of the request is as shown in parts 31-32 of FIG.
第六步:当线程3下载完毕后,发现已经没有block还能下载,因此可以直接关闭。Step 6: When the thread 3 is downloaded, it is found that there is no block to download, so it can be closed directly.
第七步:待剩余的线程下载完成后,下载任务完成。Step 7: After the remaining threads are downloaded, the download task is completed.
通过上述例子可以看到请求连接的次数从原来的32次,降低到6次,明显提高了高速网络下的下载效率。配合一定的缓存,还能保证文件写入是连续写入,以最优化文件IO调度。Through the above example, it can be seen that the number of request connections is reduced from the original 32 times to 6 times, which significantly improves the download efficiency under the high speed network. With a certain cache, it can also ensure that file writes are continuous writes to optimize file IO scheduling.
参阅图11,图11是根据本发明文件下载装置一个实施方式的结构示意图,本实施方式的装置可以执行上述图1所示方法中的步骤。该装置包括:获取模块110、确定模块120以及下载模块130。Referring to FIG. 11, FIG. 11 is a schematic structural diagram of an embodiment of a file downloading apparatus according to the present invention. The apparatus of the present embodiment can perform the steps in the method shown in FIG. The device includes an acquisition module 110, a determination module 120, and a download module 130.
获取模块110用于获取网络当前的网络速度。The obtaining module 110 is configured to acquire the current network speed of the network.
网络速度,即网速,一般是指电脑或手机上网时,上传和下载数据时,请求和返回数据所用的时间长短。获取网络当前的网络速度的方式可以是计算一段时间内网络处理的数据量总和除以该时间段长度得到的。在本公开的计算公式中,当前的网络速度可以以网络当前每秒钟能够传输的数据量来表示。Network speed, that is, network speed, generally refers to the length of time it takes to request and return data when uploading and downloading data when a computer or mobile phone is online. The way to obtain the current network speed of the network may be calculated by dividing the sum of the data processed by the network over a period of time by the length of the time period. In the calculation formula of the present disclosure, the current network speed can be expressed in terms of the amount of data that the network can currently transmit per second.
确定模块120用于根据网络当前的网络速度,确定网络当前适于由一个连接来下载的文件片段的大小,其中,文件片段包括至少一个文件分块。 The determining module 120 is configured to determine, according to the current network speed of the network, a size of a file segment currently suitable for downloading by a connection, wherein the file segment includes at least one file partition.
下载模块130用于发起用于下载一个文件片段的新连接,以下载文件。The download module 130 is for initiating a new connection for downloading a file fragment to download the file.
此时,以文件片段的大小为单个连接的下载任务目标发起新连接以下载文件,而不是总是以单个文件分块的大小为单个连接的下载任务目标发起新连接以下载文件,通过这种方式,能够合理利用网络带宽,有效提高下载的速度。At this point, a new connection is initiated to download the file for the download task target of a single connection with the size of the file fragment, instead of always starting a new connection to download the file for the download task target of a single connection in the size of a single file chunk. The way, the network bandwidth can be reasonably utilized, and the download speed can be effectively improved.
图12是图11所示的确定模块可以包括的可选单元的结构示意图。FIG. 12 is a schematic structural diagram of an optional unit that the determination module shown in FIG. 11 can include.
如图12所示,确定模块120可以可选地包括第一确定模块1210和第二确定模块1220。As shown in FIG. 12, the determination module 120 can optionally include a first determination module 1210 and a second determination module 1220.
第一确定模块1210用于根据网络当前的网络速度,确定当前适于由一个连接来下载的文件分块的个数。The first determining module 1210 is configured to determine, according to the current network speed of the network, the number of file partitions currently suitable for downloading by one connection.
文件由多个大小固定的文件分块组成,例如,一个25600KB大小的文件,分割为100个文件分块,每个文件分块的大小为256KB。A file consists of multiple files of fixed size. For example, a 25600KB file is divided into 100 file partitions, each of which is 256KB in size.
如果网络当前的网络速度接近或大于单个文件分块的大小,则当前网络适于由一个连接下载的文件分块的个数可以是一个以上,如果网络当前的网络速度远远小于等于单个文件分块的大小,则当前网络适于由一个连接下载的文件分块的个数应该是一个。当前网络适于由一个连接下载的文件分块的个数可以按照网络当前的网络速度是单个文件分块的大小的倍数来确定;也可以根据测量试验,获取经验规律,根据经验规律确定当前网络所能连接下载的文件分块的个数,或者其他方法等。根据网络当前的网络速度,动态分配网络当前所能连接下载的文件分块的个数,从而合理利用网络带宽,有效提高下载的速度。If the current network speed of the network is close to or larger than the size of a single file partition, the number of files that the current network is suitable for downloading by one connection may be more than one, if the current network speed of the network is far less than or equal to a single file. The size of the block, the number of files that the current network is suitable for downloading by one connection should be one. The number of files that the current network is suitable for downloading by one connection can be determined according to the current network speed of the network is a multiple of the size of a single file block; or the experience rule can be obtained according to the measurement test, and the current network is determined according to the empirical rule. The number of files that can be connected to the downloaded file, or other methods. According to the current network speed of the network, dynamically allocate the number of files that the network can currently connect to download, thereby rationally utilizing the network bandwidth and effectively improving the download speed.
第二确定模块1220用于根据文件分块的个数和每个文件分块的大小,确定网络当前适于连接下载的文件片段的大小。The second determining module 1220 is configured to determine, according to the number of file partitions and the size of each file partition, the size of the file segment that the network is currently suitable for connection to download.
在已知文件分块的个数和每个文件分块的大小的情况下,即可确定网络当前适于连接下载的文件分块的大小。In the case where the number of file partitions and the size of each file partition are known, the size of the file partition that the network is currently suitable for connection to download can be determined.
其中,网络当前适于连接下载的文件片段的大小为文件分块的个数乘以每个文件分块的大小,其中,每个文件分块的大小相等。The size of the file segment currently suitable for connection and downloading by the network is the number of file partitions multiplied by the size of each file chunk, wherein each file chunk is equal in size.
在这一实施方式中,获取网络当前的网络速度;根据网络当前的网络速度,确定网络当前适于连接下载的文件分块的个数;根据文件分块的个数和每个文件分块的大小,确定网络当前适于连接下载的总的文件分块的大小; 以总的文件分块的大小为下载任务目标发起新连接以下载文件。由于根据网络当前的网络速度,确定网络当前所能连接下载的文件分块的个数,从而确定以网络当前所能连接下载的总的文件分块的大小为下载任务目标发起新连接以下载文件,通过这种方式,能够动态分配当前所能连接下载的文件分块的个数,从而合理利用网络带宽,有效提高下载的速度。In this implementation manner, obtaining the current network speed of the network; determining, according to the current network speed of the network, the number of file partitions that the network is currently suitable for connection to download; according to the number of file partitions and each file partitioning Size, determine the size of the total file partition that the network is currently suitable for connection downloading; A new connection is initiated for the download task target to download the file at the size of the total file chunk. According to the current network speed of the network, determine the number of file partitions that the network can currently connect to download, thereby determining to initiate a new connection to download the file for the download task target by the size of the total file partition currently downloaded and connected by the network. In this way, the number of files that can be connected and downloaded can be dynamically allocated, so that the network bandwidth can be reasonably utilized, and the download speed can be effectively improved.
参阅图13,图13是本发明文件下载装置另一实施方式的结构示意图,本实施方式的装置可以执行上述图3所示方法中的步骤。本实施方式的装置和图11所示的装置基本相同,相同之处请参见图11和相应的文字说明。Referring to FIG. 13, FIG. 13 is a schematic structural diagram of another embodiment of a file downloading apparatus according to the present invention. The apparatus of this embodiment may perform the steps in the method shown in FIG. The device of the present embodiment is basically the same as the device shown in FIG. 11, and the same applies to FIG. 11 and the corresponding text description.
该装置包括:获取模块201、第一确定模块202、第二确定模块203、下载模块204、第一判断模块205、第二判断模块206、第三判断模块207以及第一分块下载模块208。The device includes: an obtaining module 201, a first determining module 202, a second determining module 203, a downloading module 204, a first determining module 205, a second determining module 206, a third determining module 207, and a first blocking download module 208.
获取模块201用于获取网络当前的网络速度。The obtaining module 201 is configured to acquire the current network speed of the network.
第一确定模块202用于根据网络当前的网络速度,确定当前适于由一个连接来下载的文件分块的个数,其中,文件由多个大小固定的文件分块组成。The first determining module 202 is configured to determine, according to the current network speed of the network, the number of file partitions currently suitable for downloading by one connection, wherein the file is composed of a plurality of file blocks of fixed size.
其中,网络当前适于由一个连接下载的文件分块的个数可以通过下述公式获得:The number of blocks that the network is currently suitable for downloading by a connection can be obtained by the following formula:
Figure PCTCN2015092606-appb-000010
Figure PCTCN2015092606-appb-000011
n是系数,当前的网络速度是指网络当前每秒钟能够传输的数据量。
Figure PCTCN2015092606-appb-000010
And
Figure PCTCN2015092606-appb-000011
n is the coefficient, and the current network speed refers to the amount of data that the network can currently transmit per second.
当前的网络速度可以实时更新,并且计算时要去除网络波动带来的网络速度上下浮动的影响,以反应最真实的当前的网络速度。系数n根据文件分块block大小的不同而不同,且只有
Figure PCTCN2015092606-appb-000012
时才会有意义。具体系数n的取值则可以根据block大小和业务所在区域的网络情况,通过大量实验测试,获取表现最好的值;系数n也可以是根据实际测量得出的一个经验值。
The current network speed can be updated in real time, and the impact of network fluctuations caused by network fluctuations should be removed in order to reflect the most realistic current network speed. The coefficient n varies depending on the size of the file block block, and only
Figure PCTCN2015092606-appb-000012
It only makes sense. The value of the specific coefficient n can be obtained through a large number of experimental tests according to the block size and the network condition of the service area, and the coefficient n can also be an empirical value obtained according to the actual measurement.
第二确定模块203用于根据文件分块的个数和每个文件分块的大小,确定网络当前适于由一个连接下载的文件片段的大小。The second determining module 203 is configured to determine, according to the number of file partitions and the size of each file partition, the size of the file segment that the network is currently suitable for downloading by one connection.
下载模块204用于发起用于下载一个文件片段的新连接,以下载文件。The download module 204 is for initiating a new connection for downloading a file fragment to download the file.
其中,获取模块201可以通过第一分块下载模块208来获取当前的网络速度。具体地说,第一分块下载模块208可以在开始下载时,以一个文件分 块的大小为单个连接的下载任务目标发起第一连接(第一连接用于下载一个分块)以下载文件,获取模块201可以根据第一分块下载模块208的下载过程来确定网络当前的网络速度。另外,获取模块201还可以根据刚完成下载单色连接的下载过程来确定网络当前的网络速度。The obtaining module 201 can obtain the current network speed by using the first blocking download module 208. Specifically, the first block download module 208 can divide the file into one file when starting the download. The size of the block initiates a first connection for the download task target of the single connection (the first connection is used to download a block) to download the file, and the obtaining module 201 can determine the current network of the network according to the download process of the first block download module 208. speed. In addition, the obtaining module 201 can also determine the current network speed of the network according to the download process of just completing the download monochrome connection.
第三判断模块207可以根据第一分块下载模块208的下载过程中所返回的报文来判断是否支持断点续传,在判断支持断点续传的情况下,获取模块201可以执行获取网络当前的网络速度的操作。The third determining module 207 can determine whether to support the resume transmission according to the message returned in the downloading process of the first blocking download module 208. In the case of determining that the resume transmission is supported, the obtaining module 201 can execute the acquiring network. Current network speed operation.
第一判断模块205用于判断当前已经发起的用于下载文件的连接的连接个数是否达到预设上限值。如果达到,则等待下载模块204中当前的连接下载完成;如果没有达到,则返回第一确定模块202。The first determining module 205 is configured to determine whether the number of connections that have been initiated for downloading the file has reached a preset upper limit. If so, the current connection download in the download module 204 is awaited; if not, the first determination module 202 is returned.
判断当前已经发起的用于下载文件的连接的连接个数是否达到预设上限值,是为了防止并行发起过多的连接反而使得下载效率下降。It is determined whether the number of connections that have been initiated for downloading a file has reached a preset upper limit value, so as to prevent excessive connection from being initiated in parallel, thereby reducing download efficiency.
第二判断模块206用于判断文件的所有文件分块是否下载完成。如果没有下载完成,则返回第一确定模块202;如果下载完成,则下载模块204结束文件的下载。The second determining module 206 is configured to determine whether all file partitioning of the file is completed. If no download is completed, the first determination module 202 is returned; if the download is completed, the download module 204 ends the download of the file.
在图13所示的实施方式中,第一判断模块205和第二判断模块206连接到第一确定模块202。In the embodiment shown in FIG. 13, the first determining module 205 and the second determining module 206 are connected to the first determining module 202.
应当理解,第一判断模块205和/或第二判断模块206也可以连接到获取模块201。这样,在下载过程中,例如在第一判断模块205判定连接个数尚未达到预设上限值时,或者在第二判断模块205判定尚未下载完成文件的所有文件分块时,可以由获取模块201根据刚完成下载的连接的下载过程来重新确定网络当前发的网络速度。由此,可以随时监控网络速度,从而随时更新单个连接下载的文件片段的大小。It should be understood that the first judging module 205 and/or the second judging module 206 may also be connected to the obtaining module 201. In this way, during the downloading process, for example, when the first determining module 205 determines that the number of connections has not reached the preset upper limit value, or when the second determining module 205 determines that all the file blocks of the completed file have not been downloaded, the obtaining module may be used. 201 re-determines the network speed currently sent by the network according to the download process of the connection that just completed the download. As a result, the network speed can be monitored at any time, so that the size of the file segments downloaded by a single connection can be updated at any time.
在这一实施方式中,获取网络当前的网络速度;根据网络当前的网络速度,确定当前适于由一个连接下载的文件分块的个数;根据文件分块的个数和每个文件分块的大小,确定当前适于由一个连接下载的总的文件分块的大小;以总的文件分块的大小为下载任务目标发起新连接以下载文件。由于根据网络当前的网络速度,确定网络当前适于连接下载的文件分块的个数,从而确定以网络当前适于连接下载的总的文件分块的大小为下载任务目标发起新连接以下载文件,通过这种方式,能够动态分配当前所能连接下载的文件 分块的个数,从而合理利用网络带宽,有效提高下载的速度。In this embodiment, the current network speed of the network is obtained; according to the current network speed of the network, the number of files currently suitable for downloading by one connection is determined; according to the number of file partitions and each file partition The size determines the size of the total file partition currently suitable for download by a connection; initiates a new connection to download the file for the download task target at the size of the total file partition. According to the current network speed of the network, determining the number of file partitions that the network is currently suitable for connection to download, thereby determining to initiate a new connection to download the file for the download task target by the size of the total file partition currently suitable for connection downloading. In this way, it is possible to dynamically allocate the currently available downloaded files. The number of blocks is divided, so that the network bandwidth is rationally utilized, and the download speed is effectively improved.
图14是根据本发明的能够下载文件的计算设备的一个实施例的结构示意图。14 is a block diagram showing one embodiment of a computing device capable of downloading files in accordance with the present invention.
如图14所示,该计算设备包括存储器30、网络通信模块10以及处理器20。As shown in FIG. 14, the computing device includes a memory 30, a network communication module 10, and a processor 20.
网络通信模块10用以连接到网络。The network communication module 10 is used to connect to a network.
处理器20连接到网络通信模块10和存储器30。处理器20通过网络通信模块10来获取网络当前的网络速度,根据网络当前的网络速度来确定当前适于由一个连接来下载的文件片段的大小,发起用于下载一个文件片段的新连接,以通过网络通信模块10下载文件,并将所下载的文件片段保存在存储器30上。这里,文件片段可以包括至少一个文件分块。The processor 20 is connected to the network communication module 10 and the memory 30. The processor 20 obtains the current network speed of the network through the network communication module 10, determines the size of the file segment currently suitable for downloading by one connection according to the current network speed of the network, and initiates a new connection for downloading a file segment, The file is downloaded by the network communication module 10, and the downloaded file segment is saved on the memory 30. Here, the file fragment may include at least one file partition.
另外,处理器20还可以执行上文所述的方法中的其它步骤,此处不再赘述。In addition, the processor 20 can also perform other steps in the methods described above, and details are not described herein again.
本领域的技术人员可以清楚地了解到本发明实施例中的技术可借助软件加必需的通用硬件的方式来实现,通用硬件包括通用集成电路、通用CPU、通用存储器、通用元器件等,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明实施例中的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。It will be apparent to those skilled in the art that the technology in the embodiments of the present invention can be implemented by means of software plus necessary general hardware including general-purpose integrated circuits, general-purpose CPUs, general-purpose memories, general-purpose components, and the like. It can be implemented by dedicated hardware including an application specific integrated circuit, a dedicated CPU, a dedicated memory, a dedicated component, etc., but in many cases the former is a better implementation. Based on such understanding, the technical solution in the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product, which may be stored in a storage medium such as a read-only memory. (ROM, Read-Only Memory), Random Access Memory (RAM), disk, CD, etc., including a number of instructions to make a computer device (can be a personal computer, server, or network device, etc.) The methods described in various embodiments of the invention or in certain portions of the embodiments are performed.
因此,本发明的上述技术构思还可以被实施为一种非暂时性机器可读存储介质,其上存储有可执行代码。当该可执行代码被处理器执行时,使该处理器执行上文所述的方法。Accordingly, the above technical concept of the present invention can also be embodied as a non-transitory machine readable storage medium having executable code stored thereon. When the executable code is executed by the processor, the processor is caused to perform the method described above.
另一方面,本发明的上述技术构思还可以被实施为一种计算设备,该计算设备包括处理器和非暂时性机器可读存储介质。该非暂时性机器可读存储介质上存储有可执行代码。当该可执行代码被该处理器执行时,使该处理器执行上文所述的方法。 In another aspect, the above technical concept of the present invention can also be embodied as a computing device including a processor and a non-transitory machine readable storage medium. The non-transitory machine readable storage medium stores executable code thereon. When the executable code is executed by the processor, the processor is caused to perform the method described above.
此外,根据本发明的方法还可以实现为一种计算机程序,该计算机程序包括用于执行本发明的上述方法中限定的上述各步骤的计算机程序代码指令。或者,根据本发明的方法还可以实现为一种计算机程序产品,该计算机程序产品包括计算机可读介质,在该计算机可读介质上存储有用于执行本发明的上述方法中限定的上述功能的计算机程序。本领域技术人员还将明白的是,结合这里的公开所描述的各种示例性逻辑块、模块、电路和算法步骤可以被实现为电子硬件、计算机软件或两者的组合。Furthermore, the method according to the invention can also be implemented as a computer program comprising computer program code instructions for performing the various steps defined above in the above method of the invention. Alternatively, the method according to the invention may also be embodied as a computer program product comprising a computer readable medium on which is stored a computer for performing the above-described functions defined in the above method of the invention program. The various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both.
附图中的流程图和框图显示了根据本发明的多个实施例的系统和方法的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标记的功能也可以以不同于附图中所标记的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality and operation of possible implementations of systems and methods in accordance with various embodiments of the present invention. In this regard, each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Executable instructions. It should also be noted that in some alternative implementations, the functions noted in the blocks may also occur in a different order than the ones in the drawings. For example, two consecutive blocks may be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts, can be implemented in a dedicated hardware-based system that performs the specified function or operation. Or it can be implemented by a combination of dedicated hardware and computer instructions.
以上已经描述了本发明的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。 The embodiments of the present invention have been described above, and the foregoing description is illustrative, not limiting, and not limited to the disclosed embodiments. Numerous modifications and changes will be apparent to those skilled in the art without departing from the scope of the invention. The choice of terms used herein is intended to best explain the principles, practical applications, or improvements of the techniques in the various embodiments of the embodiments, or to enable those of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (20)

  1. 一种文件下载方法,所述文件由多个大小固定的文件分块组成,其特征在于,所述方法包括:A file downloading method, the file consisting of a plurality of fixed-size file blocks, wherein the method comprises:
    获取网络当前的网络速度;Get the current network speed of the network;
    根据所述网络当前的网络速度,确定当前适于由一个连接来下载的文件片段的大小,所述文件片段包括至少一个所述文件分块;Determining, according to a current network speed of the network, a size of a file segment currently suitable for downloading by a connection, the file fragment including at least one of the file partitions;
    发起用于下载一个所述文件片段的新连接,以下载所述文件。A new connection for downloading one of the file fragments is initiated to download the file.
  2. 根据权利要求1所述的方法,其特征在于,所述根据网络当前的网络速度确定当前适于由一个连接来下载的文件片段的大小的步骤包括:The method according to claim 1, wherein the step of determining a size of a file segment currently suitable for downloading by a connection according to a current network speed of the network comprises:
    根据所述网络当前的网络速度,确定当前适于由一个连接来下载的所述文件分块的个数;Determining, according to the current network speed of the network, the number of the file partitions currently suitable for downloading by one connection;
    根据所述文件分块的个数和每个所述文件分块的大小,确定所述文件片段的大小。The size of the file fragment is determined according to the number of the file partitions and the size of each of the file partitions.
  3. 根据权利要求2所述的方法,其特征在于,所述文件片段的大小为所述文件分块的个数乘以每个所述文件分块的大小,其中,每个所述文件分块的大小相等。The method according to claim 2, wherein the size of the file fragment is the number of the file partitions multiplied by the size of each of the file partitions, wherein each of the files is chunked Equal in size.
  4. 根据权利要求2所述的方法,其特征在于,所述当前适于由一个连接来下载的文件分块的个数是通过下述公式获得的:The method according to claim 2, wherein the number of file partitions currently suitable for downloading by a connection is obtained by the following formula:
    Figure PCTCN2015092606-appb-100001
    Figure PCTCN2015092606-appb-100001
    其中,所述n是系数,所述当前的网络速度是指网络当前每秒钟能够传输的数据量。Wherein, the n is a coefficient, and the current network speed refers to the amount of data that the network can currently transmit per second.
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1 to 4, further comprising:
    在发起用于下载一个所述文件片段的新连接以下载所述文件的步骤之后,判断当前已经发起的用于下载所述文件的连接的连接个数是否达到预设上限值;After initiating a step of downloading a new connection of the file segment to download the file, determining whether the number of connections currently connected to download the file reaches a preset upper limit value;
    如果达到,则等待当前的连接下载完成;If it is reached, wait for the current connection download to complete;
    如果没有达到,则返回所述根据所述网络当前的网络速度,确定当前适于由一个连接来下载的文件片段的大小的步骤。 If not, returning to the step of determining the size of the file segment currently suitable for download by a connection based on the current network speed of the network.
  6. 根据权利要求1-4中任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1 to 4, further comprising:
    在当前的连接下载完成之后,判断所述文件的所有文件分块是否下载完成;After the current connection download is completed, it is determined whether all file partitions of the file are downloaded;
    如果没有下载完成,则返回所述根据所述网络当前的网络速度,确定当前适于由一个连接来下载的文件片段的大小的步骤;If no download is completed, returning to the step of determining a size of a file segment currently suitable for downloading by a connection according to a current network speed of the network;
    如果下载完成,则结束所述文件的下载。If the download is complete, the download of the file is ended.
  7. 根据权利要求1-4中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 4, wherein the method further comprises:
    在开始下载时,发起用于下载一个文件分块的第一连接,以下载所述文件,At the beginning of the download, a first connection for downloading a file partition is initiated to download the file,
    所述获取网络当前的网络速度的步骤包括:根据第一连接的下载过程来确定所述网络当前的网络速度。The step of acquiring the current network speed of the network includes determining a current network speed of the network according to a download process of the first connection.
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method of claim 7, wherein the method further comprises:
    根据所述第一连接的下载过程中所返回的报文来判断是否支持断点续传,Determining whether to support the resume of the breakpoint according to the message returned during the download process of the first connection,
    其中,在支持断点续传的情况下,执行所述获取网络当前的网络速度的步骤。Wherein, in the case of supporting the resume of the breakpoint, the step of acquiring the current network speed of the network is performed.
  9. 根据权利要求1-4中任一项所述的方法,其特征在于,所述获取网络当前的网络速度的步骤包括:The method according to any one of claims 1 to 4, wherein the step of acquiring the current network speed of the network comprises:
    在下载过程中,根据刚完成下载的连接的下载过程来确定网络当前的网络速度。During the download process, the current network speed of the network is determined based on the download process of the connection that just completed the download.
  10. 一种文件下载装置,所述文件由多个大小固定的文件分块组成,其特征在于,所述装置包括:A file downloading device, wherein the file is composed of a plurality of fixed-size files, wherein the device comprises:
    获取模块,用于获取网络当前的网络速度;Obtaining a module, configured to acquire a current network speed of the network;
    确定模块,用于根据所述网络当前的网络速度,确定当前适于由一个连接来下载的文件片段的大小,所述文件片段包括至少一个所述文件分块;a determining module, configured to determine, according to a current network speed of the network, a size of a file segment currently suitable for downloading by a connection, the file segment including at least one of the file segments;
    下载模块,用于发起用于下载一个所述文件片段的新连接,以下载所述文件。A download module for initiating a new connection for downloading a piece of the file to download the file.
  11. 根据权利要求10所述的装置,其特征在于,所述确定模块包括:The apparatus according to claim 10, wherein the determining module comprises:
    第一确定模块,用于根据所述网络当前的网络速度,确定当前适于由一个连接来下载的所述文件分块的个数; a first determining module, configured to determine, according to a current network speed of the network, a number of the file partitions currently suitable for downloading by one connection;
    第二确定模块,用于根据所述文件分块的个数和每个所述文件分块的大小,确定所述文件片段的大小。And a second determining module, configured to determine a size of the file segment according to the number of the file partitions and the size of each of the file partitions.
  12. 根据权利要求11所述的装置,其特征在于,所述文件片段的大小为所述文件分块的个数乘以每个所述文件分块的大小,其中,每个所述文件分块的大小相等。The apparatus according to claim 11, wherein the size of the file fragment is the number of the file partitions multiplied by the size of each of the file partitions, wherein each of the files is chunked Equal in size.
  13. 根据权利要求11所述的装置,其特征在于,所述当前适于由一个连接下载的文件分块的个数是通过下述公式获得的:The apparatus according to claim 11, wherein said number of files currently adapted to be downloaded by a connection is obtained by the following formula:
    Figure PCTCN2015092606-appb-100002
    Figure PCTCN2015092606-appb-100002
    其中,所述n是系数,所述当前的网络速度是指网络当前每秒钟能够传输的数据量。Wherein, the n is a coefficient, and the current network speed refers to the amount of data that the network can currently transmit per second.
  14. 根据权利要求10-13中任一项所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 10-13, wherein the device further comprises:
    第一判断模块,用于在所述下载模块发起用于下载一个所述文件片段的新连接以下载所述文件之后,判断当前已经发起的用于下载所述文件的连接的连接个数是否达到预设上限值;a first determining module, configured to determine, after the downloading module initiates a new connection for downloading a file segment to download the file, whether the number of connections currently connected to download the file is reached Preset upper limit value;
    如果达到,则等待所述下载模块中当前的连接下载完成;If so, waiting for the current connection download in the download module to be completed;
    如果没有达到,则返回所述确定模块。If not, the determination module is returned.
  15. 根据权利要求10-13任一项所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 10 to 13, wherein the device further comprises:
    第二判断模块,用于在所述下载模块中当前的连接下载完成之后,判断所述文件的所有文件分块是否下载完成;a second determining module, configured to determine whether all file partitions of the file are downloaded after the current connection downloading in the downloading module is completed;
    如果没有下载完成,则返回所述确定模块;Returning to the determining module if no download is completed;
    如果下载完成,则所述下载模块结束所述文件的下载。If the download is complete, the download module ends the download of the file.
  16. 根据权利要求10-13中任一项所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 10-13, wherein the device further comprises:
    第一分块下载模块,用于在开始下载时,发起用于下载一个文件分块的第一连接,以下载所述文件,a first block downloading module, configured to initiate a first connection for downloading a file block to download the file when starting the downloading,
    所述获取模块根据第一分块下载模块的下载过程来确定所述网络当前的网络速度。The obtaining module determines a current network speed of the network according to a download process of the first blocking download module.
  17. 根据权利要求16所述的装置,其特征在于,所述装置还包括: The device according to claim 16, wherein the device further comprises:
    第三判断模块,根据所述第一分块下载模块的下载过程中所返回的报文来判断是否支持断点续传,The third determining module determines whether to support the resume of the breakpoint according to the message returned during the downloading process of the first block downloading module.
    其中,在支持断点续传的情况下,执行所述获取网络当前的网络速度的步骤。Wherein, in the case of supporting the resume of the breakpoint, the step of acquiring the current network speed of the network is performed.
  18. 根据权利要求10-13中任一项所述的装置,其特征在于,在下载过程中,所述获取模块根据刚完成下载的连接的下载过程来确定网络当前的网络速度。The apparatus according to any one of claims 10-13, wherein in the downloading process, the obtaining module determines the current network speed of the network according to the downloading process of the connection that just completed the download.
  19. 一种非暂时性机器可读存储介质,其上存储有可执行代码,当所述可执行代码被处理器执行时,使所述处理器执行根据权利要求1-9中任何一项所述的方法。A non-transitory machine readable storage medium having stored thereon executable code that, when executed by a processor, causes the processor to perform the method of any of claims 1-9 method.
  20. 一种能够下载文件的计算设备,所述文件由多个大小固定的文件分块组成,该计算设备包括:A computing device capable of downloading a file, the file being composed of a plurality of fixed-size files, the computing device comprising:
    存储器;Memory
    网络通信模块,用于连接到网络;a network communication module for connecting to a network;
    处理器,连接到所述网络通信模块和所述存储器,用于通过所述网络通信模块来获取网络当前的网络速度,根据所述网络当前的网络速度来确定当前适于由一个连接来下载的文件片段的大小,发起用于下载一个所述文件片段的新连接,以通过所述网络通信模块下载所述文件,并将所下载的文件片段保存在所述存储器上,所述文件片段包括至少一个所述文件分块。 a processor, connected to the network communication module and the memory, configured to acquire a current network speed of the network by using the network communication module, and determine, according to the current network speed of the network, that the current network is suitable for downloading by one connection a size of the file fragment, initiating a new connection for downloading one of the file fragments to download the file via the network communication module and saving the downloaded file fragment on the memory, the file fragment including at least One of the files is chunked.
PCT/CN2015/092606 2014-11-03 2015-10-23 Method and apparatus for downloading file, computing device and non-transitory machine readable storage medium WO2016070720A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410613811.9A CN105635217B (en) 2014-11-03 2014-11-03 The method and device of file download
CN201410613811.9 2014-11-03

Publications (1)

Publication Number Publication Date
WO2016070720A1 true WO2016070720A1 (en) 2016-05-12

Family

ID=55908556

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/092606 WO2016070720A1 (en) 2014-11-03 2015-10-23 Method and apparatus for downloading file, computing device and non-transitory machine readable storage medium

Country Status (2)

Country Link
CN (1) CN105635217B (en)
WO (1) WO2016070720A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110620795A (en) * 2018-06-19 2019-12-27 优视科技有限公司 Method, device and terminal for interrupting and continuing file downloading

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105959159A (en) * 2016-06-30 2016-09-21 天脉聚源(北京)传媒科技有限公司 Network downloading method and device
CN107959700B (en) * 2016-10-18 2021-03-16 中国电信股份有限公司 Self-adaptive file downloading method and cloud storage gateway
CN110430285A (en) * 2019-08-27 2019-11-08 佛山职业技术学院 A kind of playback method of Baffle Box of Bluetooth and its online audio file

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020080774A1 (en) * 2000-09-08 2002-06-27 Avtec Systems, Inc. Methods and systems for interfacing wired/wireless hybrid systems
CN102484652A (en) * 2009-08-28 2012-05-30 苹果公司 Chunked downloads over a content delivery network
CN103391454A (en) * 2013-07-12 2013-11-13 三星电子(中国)研发中心 Multithreading downloading method and device
CN103631569A (en) * 2013-12-23 2014-03-12 百度在线网络技术(北京)有限公司 Download method and download device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101039309B (en) * 2006-03-16 2010-09-29 联想(北京)有限公司 Link sharing service apparatus and communication method thereof
CN101150595B (en) * 2007-11-13 2011-07-20 腾讯科技(深圳)有限公司 A real time file transmission method, system and device
CN101741890B (en) * 2008-11-19 2012-11-21 华为技术有限公司 Method, system and equipment for realizing rate control
CN101656756B (en) * 2009-09-17 2012-09-05 中国科学院声学研究所 File transferring method with self-adaptive control of transmission speed and system thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020080774A1 (en) * 2000-09-08 2002-06-27 Avtec Systems, Inc. Methods and systems for interfacing wired/wireless hybrid systems
CN102484652A (en) * 2009-08-28 2012-05-30 苹果公司 Chunked downloads over a content delivery network
CN103391454A (en) * 2013-07-12 2013-11-13 三星电子(中国)研发中心 Multithreading downloading method and device
CN103631569A (en) * 2013-12-23 2014-03-12 百度在线网络技术(北京)有限公司 Download method and download device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110620795A (en) * 2018-06-19 2019-12-27 优视科技有限公司 Method, device and terminal for interrupting and continuing file downloading

Also Published As

Publication number Publication date
CN105635217A (en) 2016-06-01
CN105635217B (en) 2019-07-26

Similar Documents

Publication Publication Date Title
WO2016070720A1 (en) Method and apparatus for downloading file, computing device and non-transitory machine readable storage medium
US10334047B2 (en) Remote direct memory access with reduced latency
US10666758B2 (en) Browser resource pre-pulling method, terminal and storage medium
CN109819039B (en) File acquisition method, file storage method, server and storage medium
CN108197160B (en) Picture loading method and device
US10771358B2 (en) Data acquisition device, data acquisition method and storage medium
US20160373545A1 (en) Method and apparatus for webpage resource acquisition
US8930632B2 (en) Methods and systems for application controlled pre-fetch
WO2017052991A1 (en) Technologies for managing data object requests in a storage node cluster
US9922036B2 (en) System and method for duplicating files on client device for cloud storage
CN112231101B (en) Memory allocation method and device and readable storage medium
US20200097314A1 (en) Method and Apparatus for Processing Request
CN110704084A (en) Method and device for dynamically allocating memory in firmware upgrade, computer equipment and storage medium
CN111371585A (en) Configuration method and device for CDN node
US9490988B2 (en) Continuous information transfer with reduced latency
CN110602229A (en) Terminal system version downloading method, device and system based on dynamic slicing
CN107491565B (en) Data synchronization method
US20130238871A1 (en) Data processing method and apparatus, pci-e bus system, and server
CN111767114B (en) Method and device for creating cloud host, computer system and readable storage medium
CN111414227B (en) Method and device for reading mirror image data and computing equipment
US10949353B1 (en) Data iterator with automatic caching
CN110610450B (en) Data processing method, electronic device, and computer-readable storage medium
CN107689979B (en) method and equipment for processing download request
US20130007768A1 (en) Atomic operations on multi-socket platforms
CN112231018B (en) Method, computing device, and computer-readable storage medium for offloading data

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15857474

Country of ref document: EP

Kind code of ref document: A1