WO2018036133A1 - File download method and device - Google Patents

File download method and device Download PDF

Info

Publication number
WO2018036133A1
WO2018036133A1 PCT/CN2017/075606 CN2017075606W WO2018036133A1 WO 2018036133 A1 WO2018036133 A1 WO 2018036133A1 CN 2017075606 W CN2017075606 W CN 2017075606W WO 2018036133 A1 WO2018036133 A1 WO 2018036133A1
Authority
WO
WIPO (PCT)
Prior art keywords
download
downloaded
thread
file
threads
Prior art date
Application number
PCT/CN2017/075606
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 WO2018036133A1 publication Critical patent/WO2018036133A1/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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Definitions

  • the present disclosure relates to the field of network communication technologies, and in particular, to a file download method and apparatus.
  • DownloadManager Download Manager
  • API9 application program interface
  • Android version the download principle is simple, but there are also problems with slow download speed and low performance
  • Multi-threaded downloading technology is an improvement on the first two methods. For a download task, segment downloading is performed, and multiple segments are separately downloaded by each thread, and then restored to a complete file, usually to be downloaded. The ratio of the overall file size to the total number of threads is expressed as the amount of data that a single thread needs to download to determine the workload of each thread.
  • the disadvantage of this scheme is that it is possible that the file length is not enough to be equally distributed to each thread. Some threads will have heavy tasks and long execution time, resulting in a long overall download time. It may also occur because the execution speed of each thread is not Equal, some threads are very fast, have been executed, but need to wait for the slowest thread, in the actual project has also encountered a certain thread due to stuck or suspended animation, the file has been unable to download completed The situation makes the overall download time prolonged, the download speed is slow, and even the download task cannot be completed.
  • the technical problem to be solved by the embodiments of the present disclosure is to provide a file downloading method and apparatus for reducing file downloading time, increasing file downloading speed, and maximizing avoiding file downloading failure due to problems of the multi-threaded downloading technology itself.
  • a file downloading method provided by an embodiment of the present disclosure includes:
  • the step of sending a download request to the server includes:
  • a hypertext transfer protocol http request is sent to the server according to the uniform resource locator URL of the file to be downloaded.
  • the step of receiving, by the receiving server, whether the file to be downloaded returned by the download request supports the identifier of the multi-thread download comprises:
  • the data packet header field further includes: a length of the file to be downloaded; the method further includes:
  • the step of starting multi-threading to download the file to be downloaded includes:
  • multiple threads concurrently send a download request to the server;
  • the method further includes:
  • the data content of the respective downloaded segments is written into a file storage system.
  • the obtaining, by the server, the data content of each download segment returned according to the download request of the multiple threads further includes:
  • the thread corresponding to the thread that has not completed the download task in the plurality of threads Downloading at least a portion of the segment, the thread assigned to the idle state to download, and continuing to send a download request to the server by the idle state thread;
  • the step of allocating at least a part of the to-be-downloaded segment corresponding to the thread that does not complete the download task in the plurality of threads to the idle state thread for downloading includes:
  • a file downloading apparatus comprising:
  • a sending module configured to send a download request to the server
  • a receiving module configured to receive, by the server, whether the file to be downloaded returned according to the download request supports an identifier of the multi-thread download
  • the sending module is specifically configured to:
  • a hypertext transfer protocol http request is sent to the server according to the uniform resource locator URL of the file to be downloaded.
  • the receiving module comprises:
  • a receiving submodule configured to receive a response message returned by the server according to the download request
  • the first obtaining submodule is configured to obtain, from a packet header field of the response message, an identifier of whether the file to be downloaded supports multi-thread downloading.
  • the receiving module further includes:
  • the second obtaining submodule is configured to obtain the length of the file to be downloaded from the packet header field of the response message.
  • the download module includes:
  • Determining a sub-module determining, according to the length of the file to be downloaded, a number of threads to be started and a size of a segment to be downloaded by each thread;
  • a first sending submodule according to the size of the segment to be downloaded by each thread, the plurality of threads concurrently sending a download request to the server;
  • the data content acquisition sub-module obtains data content of each download segment returned by the server according to the download request of the multiple threads.
  • the downloading module further includes:
  • the storage submodule is configured to, after obtaining the data content of each download segment returned by the server according to the download request of each thread, write the data content of each download segment into the file storage system.
  • the data content acquisition submodule includes:
  • the download unit is allocated, and the remaining download amount of the file to be downloaded is set to be greater than a preset threshold, and at least one of the plurality of threads completes the download segment corresponding to the thread, and when the idle state is changed, the multiple threads are not completed. Downloading at least a portion of the segment to be downloaded corresponding to the thread of the task, assigning the thread to the idle state to download, and continuing to send a download request to the server by the idle state thread;
  • the first obtaining unit is configured to obtain data content of each download segment returned by the server according to the download request of the thread that has not completed the download task and the download request sent by the thread in the idle state.
  • the allocating download unit comprises:
  • the first allocation download subunit is configured to determine, when BCount>FCount, one half of the respective segments to be downloaded of the Fcount threads in the threads of the plurality of incomplete download tasks, respectively allocated to the Fcount idle state threads for downloading , wherein BCount is the total number of threads in the plurality of threads that have not completed the download task; FCount is the total number of threads in the idle state; and the remaining amount of the segments to be downloaded of the FCount uncompleted download task is BCount.
  • the thread of the pre-FCount uncompleted download task with the largest remaining amount of the clip to be downloaded in the thread completing the download task;
  • the third allocation download subunit is set to be the remaining amount of the segment to be downloaded of the thread whose BCount has not completed the download task when BCount ⁇ FCount is divided into BCount+FCount shares, respectively allocated to the BCount uncompleted download task thread and FCount of the idle state threads are downloaded.
  • the file downloading method provided by the embodiment of the present disclosure has at least the following beneficial effects:
  • the thread resources in the idle state are reasonably utilized, thereby avoiding the phenomenon that the idleness of each thread is unequal, and the downloading is improved.
  • the download speed of the file reduces the download time of the file to be downloaded; at the same time, the resource consumption is reduced, and the resource is optimally utilized.
  • FIG. 1 is a schematic flowchart of a file downloading method according to an embodiment of the present disclosure
  • FIG. 2 is a schematic flowchart of a specific implementation process of a file downloading method according to an embodiment of the present disclosure
  • FIG. 3 is a schematic block diagram of a file downloading apparatus according to an embodiment of the present disclosure.
  • FIG. 4 is a schematic diagram of a specific implementation of a file downloading apparatus according to an embodiment of the present disclosure
  • the present disclosure provides a file downloading method, including the following steps:
  • Step 1 Send a download request to the server
  • Step 2 The identifier of the file to be downloaded returned by the server according to the download request supports multi-thread downloading
  • Step 3 When the identifier returned by the server indicates that the file to be downloaded supports multi-thread downloading, start more The thread downloads the file to be downloaded.
  • the download mode of the file to be downloaded is determined by the identifier of the file to be downloaded returned by the server, and the multi-thread download mode can reduce the time for downloading the file to be downloaded. Allocating at least a part of the to-be-downloaded segment of the thread that has not completed the download task to the thread in the idle state, so that the thread resources in the idle state are reasonably utilized, thereby avoiding the phenomenon that the idleness of each thread is uneven, and the file to be downloaded is improved.
  • the download speed reduces the download time of the files to be downloaded; at the same time, the resource consumption is reduced and the resources are optimally utilized.
  • a specific implementation process of the foregoing method shown in FIG. 1 includes:
  • Step 200 Send a download request to the server; specifically, the hypertext transfer protocol http request may be sent to the server according to the uniform resource locator URL of the file to be downloaded;
  • Step 201 Receive a response message returned by the server according to the download request.
  • Step 202 Obtain, from the packet header field of the response message, whether the file to be downloaded supports the identifier of the multi-thread download, and further, obtain the length of the file to be downloaded from the packet header field of the response message.
  • Step 203 Determine, according to the identifier returned by the server, whether the file to be downloaded supports multi-thread downloading;
  • Step 204 Determine, according to the identifier returned by the server, that the file to be downloaded does not support multi-thread downloading, and start a single-thread downloading of the file to be downloaded;
  • Step 205 When the identifier returned by the server determines that the file to be downloaded supports multi-thread downloading, determine the number of threads to be started and the size of the segment to be downloaded by each thread according to the length of the file to be downloaded;
  • Step 206 According to the size of the fragment to be downloaded by each thread, multiple threads concurrently send a download request to the server; multiple threads concurrently and independently send download requests to the server without mutual interference; and, each thread The download request initiated to the server is a http download request;
  • Step 207 Determine whether the remaining amount of the file to be downloaded is greater than a preset threshold; wherein the preset threshold is customized by the system;
  • Step 208 When the remaining download quantity of the file to be downloaded is less than or equal to the preset threshold, the thread that has not completed the download task continues to download the corresponding task to be downloaded.
  • Step 209 When the remaining download amount of the file to be downloaded is greater than a preset threshold, determine whether at least one of the plurality of threads completes the download segment corresponding to the thread and turns to an idle state; when it is determined that no thread is completed in the multiple threads When the corresponding download segment of the thread is converted to the idle state, go to step 208;
  • Step 210 When the remaining download amount of the file to be downloaded is greater than a preset threshold and at least one of the plurality of threads completes the download segment corresponding to the thread and transitions to the idle state, determining the total number of threads in the plurality of threads that have not completed the download task Whether BCount is greater than the total number of threads in the idle state FCount;
  • Step 211 When the remaining download quantity of the file to be downloaded is greater than a preset threshold and the total number of threads FCount of the plurality of threads that have not completed the download task is greater than the total number of threads FCount of the idle state, determining a plurality of the threads of the uncompleted download task Half of the respective segments to be downloaded of the Fcount threads are respectively allocated to the Fcount idle state threads for downloading, wherein BCount is the total number of threads in the plurality of threads that have not completed the download task; FCount is the total number of threads in the idle state. And the remaining amount of the segments to be downloaded of the thread of the FCount unfinished download task is BCount The thread of the pre-FCount uncompleted download task with the largest remaining amount of the clip to be downloaded in the thread completing the download task;
  • Step 212 When the remaining download amount of the file to be downloaded is greater than a preset threshold and the total number of threads FCount in the plurality of threads that have not completed the download task is not greater than the total number of threads FCount in the idle state, determine the total number of threads in the plurality of threads that have not completed the download task. Whether FCount is equal to the total number of threads in the idle state FCount;
  • Step 213 When the remaining download amount of the file to be downloaded is greater than a preset threshold and the total number of threads FCount in the plurality of threads that have not completed the download task is equal to the total number of threads FCount in the idle state, the remaining segments of the thread whose BCount has not completed the download task remain. Half of the amount is allocated to the FCount idle state thread for downloading;
  • Step 214 When the remaining download amount of the file to be downloaded is greater than a preset threshold and the total number of threads FCount of the uncompleted download task in the plurality of threads is smaller than the total number of threads FCount in the idle state, when the remaining download amount of the file to be downloaded is greater than a preset threshold and When the total number of threads in the multiple threads that have not completed the download task is smaller than the total number of threads in the idle state, FCount, the remaining amount of the segments to be downloaded of the thread whose BCount has not completed the download task is equally divided into BCount+FCount shares, which are respectively assigned to BCount. The thread completing the download task and the thread of the FCount idle state are downloaded;
  • Step 215 Obtain a download request of the thread according to the thread that has not completed the download task in step 208, and a download request of the thread of the Bcount uncompleted download task in steps 211, 212, 213, and 214, and a thread that is in the Fcount idle state. Download the data content of each download segment returned by the request;
  • Step 216 Write the obtained data content of each downloaded segment into the file storage system.
  • the download task in order to maximize the download speed of the download task and reduce the time required for downloading, when it is determined that the remaining download amount of the file to be downloaded is less than or equal to the preset threshold, the download task is not completed. The thread continues to download the corresponding clip to be downloaded.
  • the system first presets a minimum preset threshold (for example, 10%). As the remaining workload of the file to be downloaded decreases, the system may decrease the preset threshold according to the remaining workload of the file to be downloaded, for example, the system.
  • the preset threshold for determining the file to be downloaded is set to 80% for the first time, and the preset threshold for determining the file to be downloaded is set to 70% for the second time.
  • the system determines for the first time that the remaining download amount of the file to be downloaded is less than or equal to the first
  • the preset threshold is 80%
  • the system presets the second preset threshold, and compares the remaining download amount of the downloaded file with the second preset threshold.
  • the system again reduces the threshold value compared with the remaining workload of the file to be downloaded by 60%.
  • the system judges for the third time, it determines that the remaining workload of the file to be downloaded is greater than 60%, the system Repeating the workflow described in the above steps 209 to 215 again, when it is determined that the remaining download amount of the file to be downloaded is less than or equal to 10% of the system preset minimum preset threshold, Workflow is repeated according to step 208 until the end of the download file to be downloaded.
  • the system determines the download status of each thread according to the length of the data content of the length of the downloaded segment downloaded by each thread written in the file storage system, and updates the download amount of the file to be downloaded in real time.
  • the file downloading method provided by the present disclosure determines the downloading manner of the file to be downloaded according to the identifier of the file to be downloaded returned by the server, and avoids the situation that the file to be downloaded cannot be downloaded due to the wrong download mode.
  • the resource is utilized by the idle state of the downloaded task, and at least a part of the downloaded segment corresponding to the thread that has not completed the downloading task is allocated to the idle state thread for downloading, and
  • the process is cyclically executed according to the algorithm described in the text, thereby greatly reducing the download time of the file to be downloaded, increasing the download speed, and optimizing the utilization of idle thread resources.
  • the present disclosure further provides a file downloading apparatus, the apparatus comprising:
  • Sending module 1 configured to send a download request to the server
  • the receiving module 2 is configured to receive, by the server, whether the file to be downloaded returned according to the download request supports an identifier of the multi-thread download;
  • the downloading module 3 when the identifier indicates that the file to be downloaded supports multi-thread downloading, starts multi-threading to download the file to be downloaded.
  • the sending module is specifically configured to:
  • a hypertext transfer protocol http request is sent to the server according to the uniform resource locator URL of the file to be downloaded.
  • the receiving module 2 includes:
  • the receiving submodule 21 is configured to receive a response message returned by the server according to the download request;
  • the first obtaining sub-module 22 is configured to obtain, from the packet header field of the response message, whether an identifier of the file to be downloaded supports multi-thread downloading.
  • the receiving module 2 further includes:
  • the second obtaining submodule 23 is configured to obtain the length of the file to be downloaded from the packet header field of the response message.
  • the download module 3 includes:
  • Determining the sub-module 31 determining, according to the length of the file to be downloaded, the number of threads to be started and the size of the segment to be downloaded by each thread;
  • the first sending sub-module 32 according to the size of the segment to be downloaded by each thread, multiple threads concurrently send a download request to the server;
  • the data content obtaining sub-module 33 obtains data content of each download segment returned by the server according to the download request of the plurality of threads.
  • the downloading module further includes:
  • the storage sub-module 34 is configured to, after obtaining the data content of each download segment returned by the server according to the download request of each thread, write the data content of each download segment into the file storage system.
  • the data content obtaining submodule 33 includes:
  • the distribution download unit 331 is configured to: when the remaining download amount of the file to be downloaded is greater than a preset threshold, and at least one of the plurality of threads completes the download segment corresponding to the thread, and transitions to the idle state, the plurality of threads are not At least a portion of the segment to be downloaded corresponding to the thread completing the download task, assigned to the idle state thread, and by the idle state Thread continues to send a download request to the server;
  • the first obtaining unit 332 is configured to obtain data content of each download segment returned by the server according to the download request of the thread that has not completed the download task and the download request sent by the thread in the idle state.
  • the distribution download unit 331 includes:
  • the first allocation download sub-unit 3311 is configured to determine, when BCount>FCount, half of the respective segments to be downloaded of the Fcount threads in the plurality of threads that have not completed the download task, and respectively allocate them to the Fcount idle state threads. Download, wherein BCount is the total number of threads in the plurality of threads that have not completed the download task; FCount is the total number of threads in the idle state; and the remaining amount of the segments to be downloaded of the FCount incomplete download task is BCount The thread of the first FCount uncompleted download task with the largest remaining number of segments to be downloaded in the thread that has not completed the download task;
  • the third allocation download sub-unit 3313 is configured to divide the remaining amount of the to-be-downloaded segment of the thread whose BCount has not completed the download task into BCount+FCount shares when BCount ⁇ FCount, respectively, and allocate the BCount to the uncompleted download task. And FCount the idle state of the thread to download.
  • the device for downloading the file provided by the present disclosure can also allocate at least a part of the to-be-downloaded segment corresponding to the thread that has not completed the download task to the idle state thread, thereby improving the download speed of the file to be downloaded, and maximizing the utilization of the resource. .
  • the file downloading method provided by the embodiment of the present disclosure is applicable to a device or a terminal having a file downloading function, and is configured to be in an idle state by allocating at least a part of a segment of a thread to be downloaded of a thread that has not completed the download task to a thread in an idle state.
  • the thread resources are reasonably utilized to avoid the phenomenon of idleness and unequality of each thread, improve the download speed of the files to be downloaded, and reduce the downloading time of the files to be downloaded; at the same time, the resource consumption is reduced, and the resources are obtained the most. Optimized use.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

Provided in the present disclosure are a file download method and device. The file download method comprises: sending to a server a download request; receiving an identifier returned by the server according to the download request, the identifier indicating whether multi-thread download is supported for a file to be downloaded; and if the identifier returned by the server indicates that multi-thread download is supported for the file to be downloaded, then initiating multiple threads to download the file to be downloaded. The file download method provided in the present disclosure reduces a download time of a file to be downloaded, and reduces waste caused by idle thread resources.

Description

一种文件下载方法及装置File downloading method and device 技术领域Technical field
本公开涉及网络通信技术领域,尤其是一种文件下载方法及装置。The present disclosure relates to the field of network communication technologies, and in particular, to a file download method and apparatus.
背景技术Background technique
在实际项目中,发现使用android操作系统原生下载技术下载文件,速度和性能上很难让用户满意。In the actual project, it was found that downloading files using the native download technology of the android operating system is difficult to satisfy the user in terms of speed and performance.
目前,使用得比较多的Android主流下载方法主要有下面三种:At present, there are three main types of Android mainstream download methods that are used more:
(1)、文件流的读写方式下载,连接URL(统一资源定位符)的InputStream(输入流)一边读数据,一边写到Android的本地存储器文件中;(2)、用Android自带的DownloadManager(下载管理器)实现下载;(3)、多线程下载技术。(1), file stream read and write mode download, connect URL (uniform resource locator) InputStream (input stream) while reading data, while writing to Android's local memory file; (2), with Android's own DownloadManager (Download Manager) to achieve download; (3), multi-threaded download technology.
这三种主流的下载方法存在的缺陷主要如下:The main shortcomings of these three mainstream download methods are as follows:
(1)、通过文件流读写的方式下载的方法,下载速度很慢,花费时间长,不适合于大文件的下载,容易出现ANR(应用程序无响应)现象;(1) The method of downloading by means of file stream reading and writing, the downloading speed is very slow, takes a long time, is not suitable for downloading large files, and is prone to ANR (application no response) phenomenon;
(2)、DownloadManager(下载管理器)出现在API9(应用程序接口)及以后的Android版本中,下载原理简单,但也存在下载速度慢的问题,性能低下的问题;(2), DownloadManager (Download Manager) appears in API9 (application program interface) and later Android version, the download principle is simple, but there are also problems with slow download speed and low performance;
(3)、多线程下载技术是对前面两种方法的改进,针对一个下载任务,进行分段下载,由多个线程分别执行各个片段的下载,然后再恢复成完整的文件,通常采用待下载文件总体大小与线程总数的比值表示为单个线程需要下载的数据大小的方式来确定各个线程的工作量。(3) Multi-threaded downloading technology is an improvement on the first two methods. For a download task, segment downloading is performed, and multiple segments are separately downloaded by each thread, and then restored to a complete file, usually to be downloaded. The ratio of the overall file size to the total number of threads is expressed as the amount of data that a single thread needs to download to determine the workload of each thread.
这种方案的弊端是:有可能文件长度不足以刚好均分给每个线程,有的线程会任务繁重,执行时间很长,导致整体下载时间长;也可能出现由于每个线程执行速度是不均等的,有的线程速度很快,已经执行完了,却需要等待最慢的线程的情况,在实际项目中还遇到过由于某个线程出现卡顿或假死现象,导致该文件一直无法下载完成的情况,使得整体下载时间延长,下载速度慢,甚至无法完成本次下载任务。The disadvantage of this scheme is that it is possible that the file length is not enough to be equally distributed to each thread. Some threads will have heavy tasks and long execution time, resulting in a long overall download time. It may also occur because the execution speed of each thread is not Equal, some threads are very fast, have been executed, but need to wait for the slowest thread, in the actual project has also encountered a certain thread due to stuck or suspended animation, the file has been unable to download completed The situation makes the overall download time prolonged, the download speed is slow, and even the download task cannot be completed.
发明内容Summary of the invention
本公开实施例要解决的技术问题是提供一种文件下载方法及装置,用以实现缩短文件下载时间提高文件下载速度以及最大化避免由于多线程下载技术自身的问题导致的文件下载失败。The technical problem to be solved by the embodiments of the present disclosure is to provide a file downloading method and apparatus for reducing file downloading time, increasing file downloading speed, and maximizing avoiding file downloading failure due to problems of the multi-threaded downloading technology itself.
为解决上述技术问题,本公开实施例提供的一种文件下载方法,包括:To solve the above technical problem, a file downloading method provided by an embodiment of the present disclosure includes:
向服务器发送下载请求;Send a download request to the server;
接收服务器根据所述下载请求返回的待下载文件是否支持多线程下载的标识符;以及Receiving, by the server, whether the file to be downloaded returned according to the download request supports an identifier of the multi-thread download;
在所述服务器返回的标识符表示所述待下载文件支持多线程下载时,启动多线程对所 述待下载文件进行下载。When the identifier returned by the server indicates that the file to be downloaded supports multi-thread downloading, start multi-threaded Read the download file for download.
在一个实施例中,所述向服务器发送下载请求的步骤包括:In one embodiment, the step of sending a download request to the server includes:
根据待下载文件的统一资源定位符URL,向服务器发送超文本传输协议http请求。A hypertext transfer protocol http request is sent to the server according to the uniform resource locator URL of the file to be downloaded.
在一个实施例中,所述接收服务器根据所述下载请求返回的待下载文件是否支持多线程下载的标识符的步骤包括:In an embodiment, the step of receiving, by the receiving server, whether the file to be downloaded returned by the download request supports the identifier of the multi-thread download comprises:
接收服务器根据所述下载请求返回的响应消息;以及Receiving a response message returned by the server according to the download request;
从所述响应消息的数据包头字段,获得待下载文件是否支持多线程下载的标识符。From the packet header field of the response message, an identifier of whether the file to be downloaded supports multi-threaded download is obtained.
在一个实施例中,所述数据包头字段还包括:待下载文件的长度;所述方法还包括:In an embodiment, the data packet header field further includes: a length of the file to be downloaded; the method further includes:
从所述响应消息的数据包头字段,获得待下载文件的长度。Obtaining the length of the file to be downloaded from the packet header field of the response message.
在一个实施例中,所述在所述服务器返回的标识符表示所述待下载文件支持多线程下载时,启动多线程对所述待下载文件进行下载的步骤包括:In an embodiment, when the identifier returned by the server indicates that the file to be downloaded supports multi-thread downloading, the step of starting multi-threading to download the file to be downloaded includes:
根据所述待下载文件的长度,确定待启动的多个线程数目以及每个线程欲下载片段的大小;Determining, according to the length of the file to be downloaded, a number of threads to be started and a size of a segment to be downloaded by each thread;
根据所述每个线程欲下载片段的大小,多个线程并发向所述服务器发送下载请求;以及Depending on the size of the segment to be downloaded by each thread, multiple threads concurrently send a download request to the server;
获得所述服务器根据所述多个线程的下载请求返回的各个下载片段的数据内容。Obtaining data content of each download segment returned by the server according to the download request of the plurality of threads.
在一个实施例中,所述获得所述服务器根据所述多个线程的下载请求返回的各个下载片段的数据内容后还包括:In an embodiment, after obtaining the data content of each download segment returned by the server according to the download request of the multiple threads, the method further includes:
将所述各个下载片段的数据内容写入文件存储系统中。The data content of the respective downloaded segments is written into a file storage system.
在一个实施例中,所述获得所述服务器根据所述多个线程的下载请求返回的各个下载片段的数据内容过程中还包括:In an embodiment, the obtaining, by the server, the data content of each download segment returned according to the download request of the multiple threads further includes:
在待下载文件的剩余下载量大于预设阈值,且多个线程中有至少一个线程完成该线程对应的下载片段并转为空闲态时,将多个线程中未完成下载任务的线程对应的待下载片段的至少一部分,分配给所述空闲态的线程进行下载,并由所述空闲态的线程继续向所述服务器发送下载请求;以及When the remaining download amount of the file to be downloaded is greater than a preset threshold, and at least one of the plurality of threads completes the download segment corresponding to the thread and transitions to the idle state, the thread corresponding to the thread that has not completed the download task in the plurality of threads Downloading at least a portion of the segment, the thread assigned to the idle state to download, and continuing to send a download request to the server by the idle state thread;
获得所述服务器根据所述未完成下载任务的线程的下载请求以及所述空闲态的线程发送的下载请求返回的各个下载片段的数据内容。Obtaining, by the server, the data content of each download segment returned according to the download request of the thread that has not completed the download task and the download request sent by the idle state thread.
在一个实施例中,所述将多个线程中未完成下载任务的线程对应的待下载片段的至少一部分,分配给所述空闲态的线程进行下载的步骤包括:In an embodiment, the step of allocating at least a part of the to-be-downloaded segment corresponding to the thread that does not complete the download task in the plurality of threads to the idle state thread for downloading includes:
当BCount>FCount时,确定多个所述未完成下载任务的线程中的Fcount个线程的各自待下载片段的一半,分别分配给Fcount个空闲态的线程进行下载,其中,BCount为多个线程中未完成下载任务的线程的总数;FCount为所述空闲态的线程的总数;且所述FCount个未完成下载任务的线程的待下载片段剩余量是BCount个未完成下载任务的线程中待下载片段剩余量最多的前FCount个未完成下载任务的线程;When BCount>FCount, it is determined that half of the respective segments to be downloaded of the Fcount threads in the plurality of threads that have not completed the download task are respectively allocated to the Fcount idle state threads for downloading, wherein BCount is in multiple threads. The total number of threads that have not completed the download task; FCount is the total number of threads in the idle state; and the remaining amount of the segments to be downloaded of the FCount uncompleted download task is the segment to be downloaded in the thread of the BCount uncompleted download task The first remaining FCount threads that have not completed the download task;
当BCount=FCount时,将BCount未完成下载任务的线程的待下载片段剩余量的一半, 分别分配给FCount个空闲态的线程进行下载;以及When BCount=FCount, BCount will not complete half of the remaining amount of the segment to be downloaded of the thread of the download task, Threads assigned to FCount idle states for download;
当BCount<FCount时,将BCount未完成下载任务的线程的待下载片段剩余量,等分为BCount+FCount份,分别分配给BCount个未完成下载任务的线程和FCount个所述空闲态的线程进行下载。When BCount<FCount, the remaining amount of the segment to be downloaded of the thread whose BCount has not completed the download task is equally divided into BCount+FCount shares, which are respectively allocated to the BCount uncompleted download task and the FCount idle state threads. download.
根据本公开的另一方面,提供了一种文件下载装置,所述装置包括:According to another aspect of the present disclosure, a file downloading apparatus is provided, the apparatus comprising:
发送模块,设置为向服务器发送下载请求;a sending module, configured to send a download request to the server;
接收模块,设置为接收服务器根据所述下载请求返回的待下载文件是否支持多线程下载的标识符;以及a receiving module, configured to receive, by the server, whether the file to be downloaded returned according to the download request supports an identifier of the multi-thread download;
下载模块,在所述服务器返回的标识符表示所述待下载文件支持多线程下载时,启动多线程对所述待下载文件进行下载。And downloading, when the identifier returned by the server indicates that the file to be downloaded supports multi-thread downloading, starting multi-threading to download the file to be downloaded.
在一个实施例中,所述发送模块具体设置为:In an embodiment, the sending module is specifically configured to:
根据待下载文件的统一资源定位符URL,向服务器发送超文本传输协议http请求。A hypertext transfer protocol http request is sent to the server according to the uniform resource locator URL of the file to be downloaded.
在一个实施例中,所述接收模块包括:In an embodiment, the receiving module comprises:
接收子模块,设置为接收服务器根据所述下载请求返回的响应消息;以及a receiving submodule, configured to receive a response message returned by the server according to the download request;
第一获取子模块,设置为从所述响应消息的数据包头字段,获得待下载文件是否支持多线程下载的标识符。The first obtaining submodule is configured to obtain, from a packet header field of the response message, an identifier of whether the file to be downloaded supports multi-thread downloading.
在一个实施例中,所述接收模块还包括:In an embodiment, the receiving module further includes:
第二获取子模块,设置为从所述响应消息的数据包头字段,获得待下载文件的长度。The second obtaining submodule is configured to obtain the length of the file to be downloaded from the packet header field of the response message.
在一个实施例中,所述下载模块包括:In one embodiment, the download module includes:
确定子模块,根据所述待下载文件的长度,确定待启动的多个线程数目以及每个线程欲下载片段的大小;Determining a sub-module, determining, according to the length of the file to be downloaded, a number of threads to be started and a size of a segment to be downloaded by each thread;
第一发送子模块,根据所述每个线程欲下载片段的大小,多个线程并发向所述服务器发送下载请求;以及a first sending submodule, according to the size of the segment to be downloaded by each thread, the plurality of threads concurrently sending a download request to the server;
数据内容获取子模块,获得所述服务器根据所述多个线程的下载请求返回的各个下载片段的数据内容。The data content acquisition sub-module obtains data content of each download segment returned by the server according to the download request of the multiple threads.
在一个实施例中,所述下载模块还包括:In an embodiment, the downloading module further includes:
存储子模块,设置为获得所述服务器根据所述各线程的下载请求返回的各个下载片段的数据内容后,将所述各个下载片段的数据内容写入文件存储系统中。The storage submodule is configured to, after obtaining the data content of each download segment returned by the server according to the download request of each thread, write the data content of each download segment into the file storage system.
在一个实施例中,所述数据内容获取子模块包括:In an embodiment, the data content acquisition submodule includes:
分配下载单元,设置为在待下载文件的剩余下载量大于预设阈值,且多个线程中有至少一个线程完成该线程对应的下载片段,并转为空闲态时,将多个线程中未完成下载任务的线程对应的待下载片段的至少一部分,分配给所述空闲态的线程进行下载,并由所述空闲态的线程继续向所述服务器发送下载请求;以及The download unit is allocated, and the remaining download amount of the file to be downloaded is set to be greater than a preset threshold, and at least one of the plurality of threads completes the download segment corresponding to the thread, and when the idle state is changed, the multiple threads are not completed. Downloading at least a portion of the segment to be downloaded corresponding to the thread of the task, assigning the thread to the idle state to download, and continuing to send a download request to the server by the idle state thread;
第一获取单元,用于获得所述服务器根据所述未完成下载任务的线程的下载请求以及空闲态的线程发送的下载请求返回的各个下载片段的数据内容。 The first obtaining unit is configured to obtain data content of each download segment returned by the server according to the download request of the thread that has not completed the download task and the download request sent by the thread in the idle state.
在一个实施例中,所述分配下载单元包括:In an embodiment, the allocating download unit comprises:
第一分配下载子单元,设置为当BCount>FCount时,确定多个所述未完成下载任务的线程中的Fcount个线程的各自待下载片段的一半,分别分配给Fcount个空闲态的线程进行下载,其中,BCount为多个线程中未完成下载任务的线程的总数;FCount为所述空闲态的线程的总数;且所述FCount个未完成下载任务的线程的待下载片段剩余量是BCount个未完成下载任务的线程中待下载片段剩余量最多的前FCount个未完成下载任务的线程;The first allocation download subunit is configured to determine, when BCount>FCount, one half of the respective segments to be downloaded of the Fcount threads in the threads of the plurality of incomplete download tasks, respectively allocated to the Fcount idle state threads for downloading , wherein BCount is the total number of threads in the plurality of threads that have not completed the download task; FCount is the total number of threads in the idle state; and the remaining amount of the segments to be downloaded of the FCount uncompleted download task is BCount. The thread of the pre-FCount uncompleted download task with the largest remaining amount of the clip to be downloaded in the thread completing the download task;
第二分配下载子单元,设置为当BCount=FCount时,将BCount未完成下载任务的线程的待下载片段剩余量的一半,分别分配给FCount个空闲态的线程进行下载;以及a second allocation download subunit, configured to allocate, when BCount=FCount, half of the remaining amount of the segment to be downloaded of the thread whose BCount has not completed the download task, to the FCount idle state thread for downloading;
第三分配下载子单元,设置为当BCount<FCount时,将BCount未完成下载任务的线程的待下载片段剩余量,等分为BCount+FCount份,分别分配给BCount个未完成下载任务的线程和FCount个所述空闲态的线程进行下载。The third allocation download subunit is set to be the remaining amount of the segment to be downloaded of the thread whose BCount has not completed the download task when BCount<FCount is divided into BCount+FCount shares, respectively allocated to the BCount uncompleted download task thread and FCount of the idle state threads are downloaded.
与现有技术相比,本公开实施例提供的文件下载方法,至少具有以下有益效果:Compared with the prior art, the file downloading method provided by the embodiment of the present disclosure has at least the following beneficial effects:
通过将未完成下载任务的线程的待下载片段的至少一部分分配给处于空闲态的线程,使处于空闲态的线程资源得到合理的利用,避免出现各个线程闲忙不均等的现象,提高了待下载文件的下载速度,降低了对待下载文件的下载时间;同时,减少了资源的消耗,并使得资源得到最优化的利用。By assigning at least a part of the to-be-downloaded segment of the thread that has not completed the download task to the thread in the idle state, the thread resources in the idle state are reasonably utilized, thereby avoiding the phenomenon that the idleness of each thread is unequal, and the downloading is improved. The download speed of the file reduces the download time of the file to be downloaded; at the same time, the resource consumption is reduced, and the resource is optimally utilized.
附图说明DRAWINGS
图1为本公开实施例所述的文件下载方法的流程示意图;1 is a schematic flowchart of a file downloading method according to an embodiment of the present disclosure;
图2为本公开实施例所述的文件下载方法的一具体实现流程示意图;2 is a schematic flowchart of a specific implementation process of a file downloading method according to an embodiment of the present disclosure;
图3为本公开实施例所述的文件下载装置的模块示意图;FIG. 3 is a schematic block diagram of a file downloading apparatus according to an embodiment of the present disclosure;
图4为本公开实施例所述的文件下载装置的具体实现示意图;FIG. 4 is a schematic diagram of a specific implementation of a file downloading apparatus according to an embodiment of the present disclosure;
具体实施方式detailed description
为使本公开要解决的技术问题、技术方案和优点更加清楚,下面将结合附图及具体实施例进行详细描述。在下面的描述中,提供诸如具体的配置和组件的特定细节仅仅是为了帮助全面理解本公开的实施例。因此,本领域技术人员应该清楚,可以对这里描述的实施例进行各种改变和修改而不脱离本公开的范围和精神。另外,为了清楚和简洁,省略了对已知功能和构造的描述。The technical problems, the technical solutions, and the advantages of the present invention will be more clearly described in conjunction with the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to assist in a comprehensive understanding of the embodiments of the present disclosure. It will be apparent to those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the disclosure. In addition, descriptions of well-known functions and constructions are omitted for clarity and conciseness.
参照图1,本公开提供了一种文件下载方法,包括以下步骤:Referring to FIG. 1, the present disclosure provides a file downloading method, including the following steps:
步骤1:向服务器发送下载请求;Step 1: Send a download request to the server;
步骤2:接收服务器根据所述下载请求返回的待下载文件是否支持多线程下载的标识符;Step 2: The identifier of the file to be downloaded returned by the server according to the download request supports multi-thread downloading;
步骤3:在所述服务器返回的标识符表示所述待下载文件支持多线程下载时,启动多 线程对所述待下载文件进行下载。Step 3: When the identifier returned by the server indicates that the file to be downloaded supports multi-thread downloading, start more The thread downloads the file to be downloaded.
该实施例通过服务器返回的待下载文件的标识符确定对待下载文件的下载方式,多线程的下载方式能够减少对待下载文件下载的时间。将未完成下载任务的线程的待下载片段的至少一部分分配给处于空闲态的线程,使处于空闲态的线程资源得到合理的利用,避免出现各个线程闲忙不均等的现象,提高了待下载文件的下载速度,降低了对待下载文件的下载时间;同时,减少了资源的消耗,并使得资源得到最优化的利用。In this embodiment, the download mode of the file to be downloaded is determined by the identifier of the file to be downloaded returned by the server, and the multi-thread download mode can reduce the time for downloading the file to be downloaded. Allocating at least a part of the to-be-downloaded segment of the thread that has not completed the download task to the thread in the idle state, so that the thread resources in the idle state are reasonably utilized, thereby avoiding the phenomenon that the idleness of each thread is uneven, and the file to be downloaded is improved. The download speed reduces the download time of the files to be downloaded; at the same time, the resource consumption is reduced and the resources are optimally utilized.
参照图2,上述图1所示方法的一具体实现流程包括:Referring to FIG. 2, a specific implementation process of the foregoing method shown in FIG. 1 includes:
步骤200:向服务器发送下载请求;具体的,可以根据待下载文件的统一资源定位符URL,向服务器发送超文本传输协议http请求;Step 200: Send a download request to the server; specifically, the hypertext transfer protocol http request may be sent to the server according to the uniform resource locator URL of the file to be downloaded;
步骤201:接收服务器根据所述下载请求返回的响应消息;Step 201: Receive a response message returned by the server according to the download request.
步骤202:从所述响应消息的数据包头字段,获得待下载文件是否支持多线程下载的标识符,并进一步的,从所述响应消息的数据包头字段,获得待下载文件的长度;Step 202: Obtain, from the packet header field of the response message, whether the file to be downloaded supports the identifier of the multi-thread download, and further, obtain the length of the file to be downloaded from the packet header field of the response message.
步骤203:根据所述服务器返回的标识符判断待下载文件是否支持多线程下载;Step 203: Determine, according to the identifier returned by the server, whether the file to be downloaded supports multi-thread downloading;
步骤204:根据所述服务器返回的标识符判断出待下载文件不支持多线程下载时,启动单线程下载待下载文件;Step 204: Determine, according to the identifier returned by the server, that the file to be downloaded does not support multi-thread downloading, and start a single-thread downloading of the file to be downloaded;
步骤205:当所述服务器返回的标识符判断出待下载文件支持多线程下载时,根据所述待下载文件的长度,确定待启动的多个线程数目以及每个线程欲下载片段的大小;Step 205: When the identifier returned by the server determines that the file to be downloaded supports multi-thread downloading, determine the number of threads to be started and the size of the segment to be downloaded by each thread according to the length of the file to be downloaded;
步骤206:根据所述每个线程欲下载片段的大小,多个线程并发向所述服务器发送下载请求;多个线程并发且分别独立的向服务器发送下载请求,互不干扰;并且,每个线程分别向服务器发起的下载请求为http下载请求;Step 206: According to the size of the fragment to be downloaded by each thread, multiple threads concurrently send a download request to the server; multiple threads concurrently and independently send download requests to the server without mutual interference; and, each thread The download request initiated to the server is a http download request;
步骤207:判断待下载文件的剩余量是否大于预设阈值;其中,该预设阈值是系统自定义的;Step 207: Determine whether the remaining amount of the file to be downloaded is greater than a preset threshold; wherein the preset threshold is customized by the system;
步骤208:当待下载文件的剩余下载量小于或等于预设阈值时,由未完成下载任务的线程继续下载对应的待下载片段任务;Step 208: When the remaining download quantity of the file to be downloaded is less than or equal to the preset threshold, the thread that has not completed the download task continues to download the corresponding task to be downloaded.
步骤209:当待下载文件的剩余下载量大于预设阈值时,判断多个线程中是否有至少一个线程完成该线程对应的下载片段并转为空闲态;当判断出多个线程中没有线程完成该线程对应的下载片段并转为空闲态时,转到步骤208;Step 209: When the remaining download amount of the file to be downloaded is greater than a preset threshold, determine whether at least one of the plurality of threads completes the download segment corresponding to the thread and turns to an idle state; when it is determined that no thread is completed in the multiple threads When the corresponding download segment of the thread is converted to the idle state, go to step 208;
步骤210:当待下载文件的剩余下载量大于预设阈值且多个线程中有至少一个线程完成该线程对应的下载片段并转为空闲态时,判断多个线程中未完成下载任务的线程总数BCount是否大于空闲态的线程总数FCount;Step 210: When the remaining download amount of the file to be downloaded is greater than a preset threshold and at least one of the plurality of threads completes the download segment corresponding to the thread and transitions to the idle state, determining the total number of threads in the plurality of threads that have not completed the download task Whether BCount is greater than the total number of threads in the idle state FCount;
步骤211:当待下载文件的剩余下载量大于预设阈值且多个线程中未完成下载任务的线程总数FCount大于空闲态的线程总数FCount时,确定多个所述未完成下载任务的线程中的Fcount个线程的各自待下载片段的一半,分别分配给Fcount个空闲态的线程进行下载,其中,BCount为多个线程中未完成下载任务的线程的总数;FCount为所述空闲态的线程的总数;且所述FCount个未完成下载任务的线程的待下载片段剩余量是BCount个未 完成下载任务的线程中待下载片段剩余量最多的前FCount个未完成下载任务的线程;Step 211: When the remaining download quantity of the file to be downloaded is greater than a preset threshold and the total number of threads FCount of the plurality of threads that have not completed the download task is greater than the total number of threads FCount of the idle state, determining a plurality of the threads of the uncompleted download task Half of the respective segments to be downloaded of the Fcount threads are respectively allocated to the Fcount idle state threads for downloading, wherein BCount is the total number of threads in the plurality of threads that have not completed the download task; FCount is the total number of threads in the idle state. And the remaining amount of the segments to be downloaded of the thread of the FCount unfinished download task is BCount The thread of the pre-FCount uncompleted download task with the largest remaining amount of the clip to be downloaded in the thread completing the download task;
步骤212:当待下载文件的剩余下载量大于预设阈值且多个线程中未完成下载任务的线程总数FCount不大于空闲态的线程总数FCount时,判断多个线程中未完成下载任务的线程总数FCount是否等于空闲态的线程总数FCount;Step 212: When the remaining download amount of the file to be downloaded is greater than a preset threshold and the total number of threads FCount in the plurality of threads that have not completed the download task is not greater than the total number of threads FCount in the idle state, determine the total number of threads in the plurality of threads that have not completed the download task. Whether FCount is equal to the total number of threads in the idle state FCount;
步骤213:当待下载文件的剩余下载量大于预设阈值且多个线程中未完成下载任务的线程总数FCount等于空闲态的线程总数FCount时,将BCount未完成下载任务的线程的待下载片段剩余量的一半,分别分配给FCount个空闲态的线程进行下载;Step 213: When the remaining download amount of the file to be downloaded is greater than a preset threshold and the total number of threads FCount in the plurality of threads that have not completed the download task is equal to the total number of threads FCount in the idle state, the remaining segments of the thread whose BCount has not completed the download task remain. Half of the amount is allocated to the FCount idle state thread for downloading;
步骤214:当待下载文件的剩余下载量大于预设阈值且多个线程中未完成下载任务的线程总数FCount小于空闲态的线程总数FCount时,当待下载文件的剩余下载量大于预设阈值且多个线程中未完成下载任务的线程总数FCount小于空闲态的线程总数FCount时,将BCount未完成下载任务的线程的待下载片段剩余量,等分为BCount+FCount份,分别分配给BCount个未完成下载任务的线程和FCount个所述空闲态的线程进行下载;Step 214: When the remaining download amount of the file to be downloaded is greater than a preset threshold and the total number of threads FCount of the uncompleted download task in the plurality of threads is smaller than the total number of threads FCount in the idle state, when the remaining download amount of the file to be downloaded is greater than a preset threshold and When the total number of threads in the multiple threads that have not completed the download task is smaller than the total number of threads in the idle state, FCount, the remaining amount of the segments to be downloaded of the thread whose BCount has not completed the download task is equally divided into BCount+FCount shares, which are respectively assigned to BCount. The thread completing the download task and the thread of the FCount idle state are downloaded;
步骤215:获得服务器根据步骤208中的未完成下载任务的线程的下载请求以及步骤211、212、213和214中的Bcount个未完成下载任务的线程的下载请求以及Fcount个空闲态的线程发送的下载请求返回的各个下载片段的数据内容;Step 215: Obtain a download request of the thread according to the thread that has not completed the download task in step 208, and a download request of the thread of the Bcount uncompleted download task in steps 211, 212, 213, and 214, and a thread that is in the Fcount idle state. Download the data content of each download segment returned by the request;
步骤216:将获得的各个下载片段的数据内容写入到文件存储系统中。Step 216: Write the obtained data content of each downloaded segment into the file storage system.
本公开的该实施例中,为了尽可能提高对待下载任务的下载速度以及减少所需下载的时间,当判断出待下载文件的剩余下载量小于或等于预设阈值时,由未完成下载任务的线程继续执行下载对应的待下载片段。In this embodiment of the present disclosure, in order to maximize the download speed of the download task and reduce the time required for downloading, when it is determined that the remaining download amount of the file to be downloaded is less than or equal to the preset threshold, the download task is not completed. The thread continues to download the corresponding clip to be downloaded.
当判断出待下载文件的剩余下载量大于预设阈值并且未完成下载任务的线程总数大于空闲态的线程总数时,通过将未完成下载任务的待下载片段的一部分分配给空闲态的线程,不但实现了对处于空闲态的线程的资源利用,同时还减少了对待下载文件的所需下载时间。When it is determined that the remaining download amount of the file to be downloaded is greater than the preset threshold and the total number of threads that have not completed the download task is greater than the total number of threads in the idle state, by assigning a part of the to-be-downloaded segment of the uncompleted download task to the idle state thread, not only Resource utilization for threads in idle state is achieved, while reducing the required download time for files to be downloaded.
本公开中,系统首先预设一个最低预设阈值(例如10%),随着待下载文件的剩余工作量的减少,系统可根据待下载文件的剩余工作量降低该预设阈值,例如:系统第一次判断待下载文件的预设阈值设置为80%,第二次判断待下载文件的预设阈值设置为70%,当系统第一次判断待下载文件的剩余下载量小于或等于第一预设阈值80%时,系统重新预设第二预设阈值,再对待下载文件的剩余下载量与第二预设阈值进行比较,第二次判断时,判断出待下载文件的剩余工作量小于或等于70%时,系统再次下调与待下载文件的剩余工作量相比较的阈值为60%,此时,若系统第三次判断时,判断出待下载文件的剩余工作量大于60%,系统再次重复进行上述步骤209至步骤215记载的工作流程,当判断出待下载文件的剩余下载量小于或等于系统预设的最低预设阈值10%时,系统则重复进行步骤208记载的工作流程,直至对待下载文件的下载结束。In the present disclosure, the system first presets a minimum preset threshold (for example, 10%). As the remaining workload of the file to be downloaded decreases, the system may decrease the preset threshold according to the remaining workload of the file to be downloaded, for example, the system. The preset threshold for determining the file to be downloaded is set to 80% for the first time, and the preset threshold for determining the file to be downloaded is set to 70% for the second time. When the system determines for the first time that the remaining download amount of the file to be downloaded is less than or equal to the first When the preset threshold is 80%, the system presets the second preset threshold, and compares the remaining download amount of the downloaded file with the second preset threshold. When the second judgment is performed, it is determined that the remaining workload of the file to be downloaded is smaller than Or equal to 70%, the system again reduces the threshold value compared with the remaining workload of the file to be downloaded by 60%. At this time, if the system judges for the third time, it determines that the remaining workload of the file to be downloaded is greater than 60%, the system Repeating the workflow described in the above steps 209 to 215 again, when it is determined that the remaining download amount of the file to be downloaded is less than or equal to 10% of the system preset minimum preset threshold, Workflow is repeated according to step 208 until the end of the download file to be downloaded.
系统根据写入到文件存储系统中的各个线程下载的下载片段长度的数据内容的长度大小判断各个线程所处的下载状态,实时更新待下载文件的下载量。 The system determines the download status of each thread according to the length of the data content of the length of the downloaded segment downloaded by each thread written in the file storage system, and updates the download amount of the file to be downloaded in real time.
通过本公开提供的文件下载方法,根据服务器返回的待下载文件的标识符确定对待下载文件的下载方式,避免因选错下载方式导致待下载文件无法下载的情况出现。The file downloading method provided by the present disclosure determines the downloading manner of the file to be downloaded according to the identifier of the file to be downloaded returned by the server, and avoids the situation that the file to be downloaded cannot be downloaded due to the wrong download mode.
在对待下载文件进行多线程下载时,通过对已完成下载任务的处于空闲态的线程进行资源利用,将未完成下载任务的线程对应的下载片段的至少一部分分配给空闲态的线程协助下载,并且根据文中描述的算法循环执行该过程,进而可以大幅度的减少待下载文件的下载时间,提高下载速度,并且使得空闲态的线程资源得到最优化的利用。When the multi-threaded downloading of the downloaded file is performed, the resource is utilized by the idle state of the downloaded task, and at least a part of the downloaded segment corresponding to the thread that has not completed the downloading task is allocated to the idle state thread for downloading, and The process is cyclically executed according to the algorithm described in the text, thereby greatly reducing the download time of the file to be downloaded, increasing the download speed, and optimizing the utilization of idle thread resources.
如图3所示,根据本公开的另一方面,本公开还提供了一种文件下载装置,所述装置包括:As shown in FIG. 3, according to another aspect of the present disclosure, the present disclosure further provides a file downloading apparatus, the apparatus comprising:
发送模块1,设置为向服务器发送下载请求;Sending module 1, configured to send a download request to the server;
接收模块2,设置为接收服务器根据所述下载请求返回的待下载文件是否支持多线程下载的标识符;The receiving module 2 is configured to receive, by the server, whether the file to be downloaded returned according to the download request supports an identifier of the multi-thread download;
下载模块3,在所述标识符表示所述待下载文件支持多线程下载时,启动多线程对所述待下载文件进行下载。The downloading module 3, when the identifier indicates that the file to be downloaded supports multi-thread downloading, starts multi-threading to download the file to be downloaded.
进一步的,所述发送模块具体设置为:Further, the sending module is specifically configured to:
根据待下载文件的统一资源定位符URL,向服务器发送超文本传输协议http请求。A hypertext transfer protocol http request is sent to the server according to the uniform resource locator URL of the file to be downloaded.
进一步的,所述接收模块2包括:Further, the receiving module 2 includes:
接收子模块21,设置为接收服务器根据所述下载请求返回的响应消息;The receiving submodule 21 is configured to receive a response message returned by the server according to the download request;
第一获取子模块22,设置为从所述响应消息的数据包头字段,获得待下载文件是否支持多线程下载的标识符。The first obtaining sub-module 22 is configured to obtain, from the packet header field of the response message, whether an identifier of the file to be downloaded supports multi-thread downloading.
进一步的,所述接收模块2还包括:Further, the receiving module 2 further includes:
第二获取子模块23,设置为从所述响应消息的数据包头字段,获得待下载文件的长度。The second obtaining submodule 23 is configured to obtain the length of the file to be downloaded from the packet header field of the response message.
进一步的,所述下载模块3包括:Further, the download module 3 includes:
确定子模块31,根据所述待下载文件的长度,确定待启动的多个线程数目以及每个线程欲下载片段的大小;Determining the sub-module 31, determining, according to the length of the file to be downloaded, the number of threads to be started and the size of the segment to be downloaded by each thread;
第一发送子模块32,根据所述每个线程欲下载片段的大小,多个线程并发向所述服务器发送下载请求;The first sending sub-module 32, according to the size of the segment to be downloaded by each thread, multiple threads concurrently send a download request to the server;
数据内容获取子模块33,获得所述服务器根据所述多个线程的下载请求返回的各个下载片段的数据内容。The data content obtaining sub-module 33 obtains data content of each download segment returned by the server according to the download request of the plurality of threads.
进一步的,所述下载模块还包括:Further, the downloading module further includes:
存储子模块34,设置为获得所述服务器根据所述各线程的下载请求返回的各个下载片段的数据内容后,将所述各个下载片段的数据内容写入文件存储系统中。The storage sub-module 34 is configured to, after obtaining the data content of each download segment returned by the server according to the download request of each thread, write the data content of each download segment into the file storage system.
进一步的,所述数据内容获取子模块33包括:Further, the data content obtaining submodule 33 includes:
分配下载单元331,设置为在待下载文件的剩余下载量大于预设阈值,且多个线程中有至少一个线程完成该线程对应的下载片段,并转为空闲态时,将多个线程中未完成下载任务的线程对应的待下载片段的至少一部分,分配给所述空闲态的线程,并由所述空闲态 的线程继续向所述服务器发送下载请求;The distribution download unit 331 is configured to: when the remaining download amount of the file to be downloaded is greater than a preset threshold, and at least one of the plurality of threads completes the download segment corresponding to the thread, and transitions to the idle state, the plurality of threads are not At least a portion of the segment to be downloaded corresponding to the thread completing the download task, assigned to the idle state thread, and by the idle state Thread continues to send a download request to the server;
第一获取单元332,设置为获得所述服务器根据所述未完成下载任务的线程的下载请求以及空闲态的线程发送的下载请求返回的各个下载片段的数据内容。The first obtaining unit 332 is configured to obtain data content of each download segment returned by the server according to the download request of the thread that has not completed the download task and the download request sent by the thread in the idle state.
进一步的,所述分配下载单元331包括:Further, the distribution download unit 331 includes:
第一分配下载子单元3311,设置为当BCount>FCount时,确定多个所述未完成下载任务的线程中的Fcount个线程的各自待下载片段的一半,分别分配给Fcount个空闲态的线程进行下载,其中,BCount为多个线程中未完成下载任务的线程的总数;FCount为所述空闲态的线程的总数;且所述FCount个未完成下载任务的线程的待下载片段剩余量是BCount个未完成下载任务的线程中待下载片段剩余量最多的前FCount个未完成下载任务的线程;The first allocation download sub-unit 3311 is configured to determine, when BCount>FCount, half of the respective segments to be downloaded of the Fcount threads in the plurality of threads that have not completed the download task, and respectively allocate them to the Fcount idle state threads. Download, wherein BCount is the total number of threads in the plurality of threads that have not completed the download task; FCount is the total number of threads in the idle state; and the remaining amount of the segments to be downloaded of the FCount incomplete download task is BCount The thread of the first FCount uncompleted download task with the largest remaining number of segments to be downloaded in the thread that has not completed the download task;
第二分配下载子单元3312,设置为当BCount=FCount时,将BCount未完成下载任务的线程的待下载片段剩余量的一半,分别分配给FCount个空闲态的线程进行下载;The second allocation download sub-unit 3312 is configured to allocate, when BCount=FCount, half of the remaining amount of the segment to be downloaded of the thread whose BCount has not completed the download task, to the FCount idle state thread for downloading;
第三分配下载子单元3313,用于当BCount<FCount时,将BCount未完成下载任务的线程的待下载片段剩余量,等分为BCount+FCount份,分别分配给BCount个未完成下载任务的线程和FCount个所述空闲态的线程进行下载。The third allocation download sub-unit 3313 is configured to divide the remaining amount of the to-be-downloaded segment of the thread whose BCount has not completed the download task into BCount+FCount shares when BCount<FCount, respectively, and allocate the BCount to the uncompleted download task. And FCount the idle state of the thread to download.
本公开提供的文件下载的装置,同样可以将未完成下载任务的线程对应的待下载片段的至少一部分分配给空闲态的线程,可以提高待下载文件的下载速度,并且可以实现对资源的最大利用。The device for downloading the file provided by the present disclosure can also allocate at least a part of the to-be-downloaded segment corresponding to the thread that has not completed the download task to the idle state thread, thereby improving the download speed of the file to be downloaded, and maximizing the utilization of the resource. .
以上所述是本公开的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本公开所述原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本公开的保护范围。The above is a preferred embodiment of the present disclosure, and it should be noted that those skilled in the art can also make several improvements and refinements without departing from the principles of the present disclosure. It should also be considered as the scope of protection of the present disclosure.
工业实用性Industrial applicability
本公开实施例提供的文件下载方法,可应用于具有文件下载功能的设备或终端中,通过将未完成下载任务的线程的待下载片段的至少一部分分配给处于空闲态的线程,使处于空闲态的线程资源得到合理的利用,避免出现各个线程闲忙不均等的现象,提高了待下载文件的下载速度,降低了对待下载文件的下载时间;同时,减少了资源的消耗,并使得资源得到最优化的利用。 The file downloading method provided by the embodiment of the present disclosure is applicable to a device or a terminal having a file downloading function, and is configured to be in an idle state by allocating at least a part of a segment of a thread to be downloaded of a thread that has not completed the download task to a thread in an idle state. The thread resources are reasonably utilized to avoid the phenomenon of idleness and unequality of each thread, improve the download speed of the files to be downloaded, and reduce the downloading time of the files to be downloaded; at the same time, the resource consumption is reduced, and the resources are obtained the most. Optimized use.

Claims (16)

  1. 一种文件下载方法,包括:A file download method, including:
    向服务器发送下载请求;Send a download request to the server;
    接收服务器根据所述下载请求返回的待下载文件是否支持多线程下载的标识符;以及Receiving, by the server, whether the file to be downloaded returned according to the download request supports an identifier of the multi-thread download;
    在所述服务器返回的标识符表示所述待下载文件支持多线程下载时,启动多线程对所述待下载文件进行下载。When the identifier returned by the server indicates that the file to be downloaded supports multi-thread downloading, the multi-thread is started to download the file to be downloaded.
  2. 根据权利要求1所述的文件下载方法,其中,所述向服务器发送下载请求的步骤包括:The file downloading method according to claim 1, wherein said step of transmitting a download request to the server comprises:
    根据待下载文件的统一资源定位符URL,向服务器发送超文本传输协议http请求。A hypertext transfer protocol http request is sent to the server according to the uniform resource locator URL of the file to be downloaded.
  3. 根据权利要求1所述的文件下载方法,其中,所述接收服务器根据所述下载请求返回的待下载文件是否支持多线程下载的标识符的步骤包括:The file downloading method according to claim 1, wherein the step of receiving, by the receiving server, whether the file to be downloaded returned according to the download request supports the identifier of the multi-thread download comprises:
    接收服务器根据所述下载请求返回的响应消息;以及Receiving a response message returned by the server according to the download request;
    从所述响应消息的数据包头字段,获得待下载文件是否支持多线程下载的标识符。From the packet header field of the response message, an identifier of whether the file to be downloaded supports multi-threaded download is obtained.
  4. 根据权利要求3所述的文件下载方法,其中,所述数据包头字段还包括:待下载文件的长度;所述方法还包括:The file downloading method according to claim 3, wherein the data packet header field further includes: a length of the file to be downloaded; the method further includes:
    从所述响应消息的数据包头字段,获得待下载文件的长度。Obtaining the length of the file to be downloaded from the packet header field of the response message.
  5. 根据权利要求4所述的文件下载方法,其中,所述在所述服务器返回的标识符表示所述待下载文件支持多线程下载时,启动多线程对所述待下载文件进行下载的步骤包括:The file downloading method according to claim 4, wherein the step of initiating multi-threading to download the file to be downloaded when the identifier returned by the server indicates that the file to be downloaded supports multi-thread downloading comprises:
    根据所述待下载文件的长度,确定待启动的多个线程数目以及每个线程欲下载片段的大小;Determining, according to the length of the file to be downloaded, a number of threads to be started and a size of a segment to be downloaded by each thread;
    根据所述每个线程欲下载片段的大小,多个线程并发向所述服务器发送下载请求;以及Depending on the size of the segment to be downloaded by each thread, multiple threads concurrently send a download request to the server;
    获得所述服务器根据所述多个线程的下载请求返回的各个下载片段的数据内容。Obtaining data content of each download segment returned by the server according to the download request of the plurality of threads.
  6. 根据权利要求5所述的文件下载方法,其中,所述获得所述服务器根据所述多个线程的下载请求返回的各个下载片段的数据内容后还包括:The file downloading method according to claim 5, wherein the obtaining the data content of each download segment returned by the server according to the download request of the plurality of threads further comprises:
    将所述各个下载片段的数据内容写入文件存储系统中。The data content of the respective downloaded segments is written into a file storage system.
  7. 根据权利要求5所述的文件下载方法,其中,所述获得所述服务器根据所述多个线程的下载请求返回的各个下载片段的数据内容过程中还包括:The file downloading method according to claim 5, wherein the obtaining the data content of each download segment returned by the server according to the download request of the plurality of threads further comprises:
    在待下载文件的剩余下载量大于预设阈值,且多个线程中有至少一个线程完成该线程对应的下载片段并转为空闲态时,将多个线程中未完成下载任务的线程对应的待下载片段的至少一部分,分配给所述空闲态的线程进行下载,并由所述空闲态的线程继续向所述服务器发送下载请求;以及When the remaining download amount of the file to be downloaded is greater than a preset threshold, and at least one of the plurality of threads completes the download segment corresponding to the thread and transitions to the idle state, the thread corresponding to the thread that has not completed the download task in the plurality of threads Downloading at least a portion of the segment, the thread assigned to the idle state to download, and continuing to send a download request to the server by the idle state thread;
    获得所述服务器根据所述未完成下载任务的线程的下载请求以及所述空闲态的线程发送的下载请求返回的各个下载片段的数据内容。 Obtaining, by the server, the data content of each download segment returned according to the download request of the thread that has not completed the download task and the download request sent by the idle state thread.
  8. 根据权利要求7所述的文件下载方法,其中,所述将多个线程中未完成下载任务的线程对应的待下载片段的至少一部分,分配给所述空闲态的线程进行下载的步骤包括:The file downloading method according to claim 7, wherein the step of allocating at least a part of the to-be-downloaded segment corresponding to the thread that has not completed the downloading task to the idle state thread for downloading comprises:
    当BCount>FCount时,确定多个所述未完成下载任务的线程中的Fcount个线程的各自待下载片段的一半,分别分配给Fcount个空闲态的线程进行下载,其中,BCount为多个线程中未完成下载任务的线程的总数;FCount为所述空闲态的线程的总数;且所述FCount个未完成下载任务的线程的待下载片段剩余量是BCount个未完成下载任务的线程中待下载片段剩余量最多的前FCount个未完成下载任务的线程;When BCount>FCount, it is determined that half of the respective segments to be downloaded of the Fcount threads in the plurality of threads that have not completed the download task are respectively allocated to the Fcount idle state threads for downloading, wherein BCount is in multiple threads. The total number of threads that have not completed the download task; FCount is the total number of threads in the idle state; and the remaining amount of the segments to be downloaded of the FCount uncompleted download task is the segment to be downloaded in the thread of the BCount uncompleted download task The first remaining FCount threads that have not completed the download task;
    当BCount=FCount时,将BCount未完成下载任务的线程的待下载片段剩余量的一半,分别分配给FCount个空闲态的线程进行下载;以及When BCount=FCount, half of the remaining amount of the segment to be downloaded of the thread whose BCount has not completed the download task is respectively allocated to the FCount idle state thread for downloading;
    当BCount<FCount时,将BCount未完成下载任务的线程的待下载片段剩余量,等分为BCount+FCount份,分别分配给BCount个未完成下载任务的线程和FCount个所述空闲态的线程进行下载。When BCount<FCount, the remaining amount of the segment to be downloaded of the thread whose BCount has not completed the download task is equally divided into BCount+FCount shares, which are respectively allocated to the BCount uncompleted download task and the FCount idle state threads. download.
  9. 一种文件下载装置,其中,所述装置包括:A file downloading device, wherein the device comprises:
    发送模块,设置为向服务器发送下载请求;a sending module, configured to send a download request to the server;
    接收模块,设置为接收服务器根据所述下载请求返回的待下载文件是否支持多线程下载的标识符;以及a receiving module, configured to receive, by the server, whether the file to be downloaded returned according to the download request supports an identifier of the multi-thread download;
    下载模块,在所述服务器返回的标识符表示所述待下载文件支持多线程下载时,启动多线程对所述待下载文件进行下载。And downloading, when the identifier returned by the server indicates that the file to be downloaded supports multi-thread downloading, starting multi-threading to download the file to be downloaded.
  10. 根据权利要求9所述的文件下载装置,其中,所述发送模块进一步设置为:The file downloading apparatus according to claim 9, wherein said transmitting module is further configured to:
    根据待下载文件的统一资源定位符URL,向服务器发送超文本传输协议http请求。A hypertext transfer protocol http request is sent to the server according to the uniform resource locator URL of the file to be downloaded.
  11. 根据权利要求9所述的文件下载装置,其中,所述接收模块包括:The file downloading apparatus according to claim 9, wherein the receiving module comprises:
    接收子模块,设置为接收服务器根据所述下载请求返回的响应消息;以及a receiving submodule, configured to receive a response message returned by the server according to the download request;
    第一获取子模块,设置为从所述响应消息的数据包头字段,获得待下载文件是否支持多线程下载的标识符。The first obtaining submodule is configured to obtain, from a packet header field of the response message, an identifier of whether the file to be downloaded supports multi-thread downloading.
  12. 根据权利要求11所述的文件下载装置,其中,所述接收模块还包括:The file downloading apparatus according to claim 11, wherein the receiving module further comprises:
    第二获取子模块,设置为从所述响应消息的数据包头字段,获得待下载文件的长度。The second obtaining submodule is configured to obtain the length of the file to be downloaded from the packet header field of the response message.
  13. 根据权利要求12所述的文件下载装置,其中,所述下载模块包括:The file downloading apparatus according to claim 12, wherein said downloading module comprises:
    确定子模块,根据所述待下载文件的长度,确定待启动的多个线程数目以及每个线程欲下载片段的大小;Determining a sub-module, determining, according to the length of the file to be downloaded, a number of threads to be started and a size of a segment to be downloaded by each thread;
    第一发送子模块,根据所述每个线程欲下载片段的大小,多个线程并发向所述服务器发送下载请求;以及a first sending submodule, according to the size of the segment to be downloaded by each thread, the plurality of threads concurrently sending a download request to the server;
    数据内容获取子模块,获得所述服务器根据所述多个线程的下载请求返回的各个下载片段的数据内容。The data content acquisition sub-module obtains data content of each download segment returned by the server according to the download request of the multiple threads.
  14. 根据权利要求13所述的文件下载装置,其中,所述下载模块还包括:The file downloading apparatus according to claim 13, wherein the downloading module further comprises:
    存储子模块,设置为获得所述服务器根据所述各线程的下载请求返回的各个下载片段 的数据内容后,将所述各个下载片段的数据内容写入文件存储系统中。a storage submodule, configured to obtain each download segment returned by the server according to the download request of each thread After the data content, the data content of each download segment is written into the file storage system.
  15. 根据权利要求13所述的文件下载装置,其中,所述数据内容获取子模块包括:The file downloading apparatus according to claim 13, wherein the data content obtaining submodule comprises:
    分配下载单元,设置为在待下载文件的剩余下载量大于预设阈值,且多个线程中有至少一个线程完成该线程对应的下载片段,并转为空闲态时,将多个线程中未完成下载任务的线程对应的待下载片段的至少一部分,分配给所述空闲态的线程进行下载,并由所述空闲态的线程继续向所述服务器发送下载请求;以及The download unit is allocated, and the remaining download amount of the file to be downloaded is set to be greater than a preset threshold, and at least one of the plurality of threads completes the download segment corresponding to the thread, and when the idle state is changed, the multiple threads are not completed. Downloading at least a portion of the segment to be downloaded corresponding to the thread of the task, assigning the thread to the idle state to download, and continuing to send a download request to the server by the idle state thread;
    第一获取单元,设置为获得所述服务器根据所述未完成下载任务的线程的下载请求以及空闲态的线程发送的下载请求返回的各个下载片段的数据内容。The first obtaining unit is configured to obtain data content of each download segment returned by the server according to the download request of the thread that has not completed the download task and the download request sent by the idle state thread.
  16. 根据权利要求15所述的文件下载装置,其中,所述分配下载单元包括:The file downloading apparatus according to claim 15, wherein said distribution downloading unit comprises:
    第一分配下载子单元,设置为当BCount>FCount时,确定多个所述未完成下载任务的线程中的Fcount个线程的各自待下载片段的一半,分别分配给Fcount个空闲态的线程进行下载,其中,BCount为多个线程中未完成下载任务的线程的总数;FCount为所述空闲态的线程的总数;且所述FCount个未完成下载任务的线程的待下载片段剩余量是BCount个未完成下载任务的线程中待下载片段剩余量最多的前FCount个未完成下载任务的线程;The first allocation download subunit is configured to determine, when BCount>FCount, one half of the respective segments to be downloaded of the Fcount threads in the threads of the plurality of incomplete download tasks, respectively allocated to the Fcount idle state threads for downloading , wherein BCount is the total number of threads in the plurality of threads that have not completed the download task; FCount is the total number of threads in the idle state; and the remaining amount of the segments to be downloaded of the FCount uncompleted download task is BCount. The thread of the pre-FCount uncompleted download task with the largest remaining amount of the clip to be downloaded in the thread completing the download task;
    第二分配下载子单元,设置为当BCount=FCount时,将BCount未完成下载任务的线程的待下载片段剩余量的一半,分别分配给FCount个空闲态的线程进行下载;以及a second allocation download subunit, configured to allocate, when BCount=FCount, half of the remaining amount of the segment to be downloaded of the thread whose BCount has not completed the download task, to the FCount idle state thread for downloading;
    第三分配下载子单元,设置为当BCount<FCount时,将BCount未完成下载任务的线程的待下载片段剩余量,等分为BCount+FCount份,分别分配给BCount个未完成下载任务的线程和FCount个所述空闲态的线程进行下载。 The third allocation download subunit is set to be the remaining amount of the segment to be downloaded of the thread whose BCount has not completed the download task when BCount<FCount is divided into BCount+FCount shares, respectively allocated to the BCount uncompleted download task thread and FCount of the idle state threads are downloaded.
PCT/CN2017/075606 2016-08-24 2017-03-03 File download method and device WO2018036133A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610716477.9 2016-08-24
CN201610716477.9A CN107786583A (en) 2016-08-24 2016-08-24 A kind of document down loading method and device

Publications (1)

Publication Number Publication Date
WO2018036133A1 true WO2018036133A1 (en) 2018-03-01

Family

ID=61245417

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/075606 WO2018036133A1 (en) 2016-08-24 2017-03-03 File download method and device

Country Status (2)

Country Link
CN (1) CN107786583A (en)
WO (1) WO2018036133A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110430279A (en) * 2019-08-14 2019-11-08 平安普惠企业管理有限公司 File download control method and device
CN110620795A (en) * 2018-06-19 2019-12-27 优视科技有限公司 Method, device and terminal for interrupting and continuing file downloading
CN114040380A (en) * 2021-11-08 2022-02-11 北京百度网讯科技有限公司 Data issuing method, device, electronic equipment, medium and product

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106550042B (en) * 2016-11-23 2019-08-23 广州优视网络科技有限公司 Multithreading method for down loading and device and calculating equipment
CN109040230B (en) * 2018-07-31 2021-06-04 优视科技新加坡有限公司 File downloading method, device, equipment/terminal/server and storage medium
CN110224863A (en) * 2019-05-22 2019-09-10 钛马信息网络技术有限公司 A kind of file accelerates method for down loading and device
CN110572456A (en) * 2019-09-09 2019-12-13 广东国粒教育技术有限公司 Teaching resource editing method and system
CN110784528B (en) * 2019-10-22 2023-04-18 北京天融信网络安全技术有限公司 File downloading method and device and storage medium
CN111131410A (en) * 2019-12-10 2020-05-08 武汉联影医疗科技有限公司 Image downloading method, computer device and storage medium
CN112286683A (en) * 2020-10-29 2021-01-29 北京小米移动软件有限公司 Method, device and medium for downloading fragments
CN114629895B (en) * 2022-03-22 2023-10-13 平安证券股份有限公司 File fragment breakpoint continuous transmission method, device, terminal equipment and medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103391454A (en) * 2013-07-12 2013-11-13 三星电子(中国)研发中心 Multithreading downloading method and device
CN103634383A (en) * 2013-11-21 2014-03-12 北京奇虎科技有限公司 Mobile terminal-based multi-link subsection downloading method and mobile terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103997544B (en) * 2014-06-12 2017-08-25 网易(杭州)网络有限公司 A kind of method and apparatus of resource downloading

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103391454A (en) * 2013-07-12 2013-11-13 三星电子(中国)研发中心 Multithreading downloading method and device
CN103634383A (en) * 2013-11-21 2014-03-12 北京奇虎科技有限公司 Mobile terminal-based multi-link subsection downloading method and mobile terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
MIU, A. ET AL.: "Performance Analysis of a Dynamic Parallel Downloading Scheme from Mirror Sites Throughout the Internet", TERM PAPER, LCS MIT, 31 December 1999 (1999-12-31), XP002204897 *

Cited By (4)

* 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
CN110430279A (en) * 2019-08-14 2019-11-08 平安普惠企业管理有限公司 File download control method and device
CN114040380A (en) * 2021-11-08 2022-02-11 北京百度网讯科技有限公司 Data issuing method, device, electronic equipment, medium and product
CN114040380B (en) * 2021-11-08 2023-08-01 北京百度网讯科技有限公司 Data issuing method and device, electronic equipment, medium and product

Also Published As

Publication number Publication date
CN107786583A (en) 2018-03-09

Similar Documents

Publication Publication Date Title
WO2018036133A1 (en) File download method and device
CN109862065B (en) File downloading method and device and electronic equipment
KR101006260B1 (en) Apparatus and method for supporting memory management in an offload of network protocol processing
CN107590001B (en) Load balancing method and device, storage medium and electronic equipment
WO2017133623A1 (en) Data stream processing method, apparatus, and system
US8239564B2 (en) Dynamic throttling based on network conditions
CN109729106B (en) Method, system and computer program product for processing computing tasks
WO2017041398A1 (en) Data transmission method and device
US9699276B2 (en) Data distribution method and system and data receiving apparatus
WO2014026613A1 (en) Network bandwidth distribution method and terminal
US8032588B2 (en) System and method for hosting one or more versions of a service using a service proxy
WO2014176927A1 (en) Method, device and system for downloading file
WO2020026018A1 (en) Method for downloading file, device, apparatus/terminal/ server, and storage medium
WO2021022964A1 (en) Task processing method, device, and computer-readable storage medium based on multi-core system
US20170255498A1 (en) Dynamically optimized device driver protocol assist threads
US9417924B2 (en) Scheduling in job execution
WO2021135279A1 (en) Asymmetric configuration management method, apparatus and device, and readable storage medium
WO2017107483A1 (en) Load balancing method for virtualized network management file downloading, and network management server
CN113259415A (en) Network message processing method and device and network server
JP4117889B2 (en) Computer and method for controlling communication for executing web application
WO2015062390A1 (en) Virtual machine migration method, device and system
CN103442041A (en) Method, device and system for upgrading firmware of embedded device
WO2018127013A1 (en) Method and device for concurrent transmission of stream data
CN110764710A (en) Data access method and storage system of low-delay and high-IOPS
JP6657910B2 (en) Band setting method, band setting program, information processing apparatus and information processing system

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

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

Country of ref document: EP

Kind code of ref document: A1