WO2018196459A1 - Download request processing method and apparatus, processing device and medium - Google Patents
Download request processing method and apparatus, processing device and medium Download PDFInfo
- Publication number
- WO2018196459A1 WO2018196459A1 PCT/CN2018/074877 CN2018074877W WO2018196459A1 WO 2018196459 A1 WO2018196459 A1 WO 2018196459A1 CN 2018074877 W CN2018074877 W CN 2018074877W WO 2018196459 A1 WO2018196459 A1 WO 2018196459A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- download
- executable
- server
- file
- task
- Prior art date
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
Definitions
- the present application belongs to the field of communications, and in particular, to a download request processing method, apparatus, processing device, and medium.
- an enterprise can upload files that need to be shared to a server.
- the file can be downloaded from the server for fast and convenient file sharing.
- the embodiment of the present application provides a download request processing method, apparatus, processing device, and medium, to solve the problem of long-term occupation of server session link resources in the prior art, and reduce the efficiency of downloading files by the terminal.
- a first aspect of the embodiment of the present application provides a download request processing method, including:
- a second aspect of the embodiments of the present application provides a download request processing apparatus, including:
- a download request receiving module configured to receive a download request initiated by the terminal
- a file size determining module configured to determine whether a size of the download file required by the download request exceeds a preset threshold
- a session link release module configured to release a current session link between the server and the terminal if the determination result of the file size determination module is yes;
- a background thread establishing module configured to establish a background thread for downloading the download file on the server
- a file downloading module configured to download and cache the downloaded file by using the background thread
- a download completion notification module configured to notify the terminal of the downloaded completion message, so that the terminal re-establishes a new session link with the server and acquires the download file in the cache.
- a third aspect of the embodiments of the present application provides a processing device including a memory and a processor, wherein the memory stores a download request processing program executable on the processor, and the processor executes the download request The steps of the download request processing method as described in the first aspect are implemented when the program is processed.
- a fourth aspect of the embodiments of the present application provides a computer readable storage medium storing a download request processing program, when the download request processing program is executed by a processor, implementing the method as described in the first aspect The steps of the download request processing method.
- the terminal first, receiving a download request initiated by the terminal; and then determining whether the size of the download file required by the download request exceeds a preset threshold; if the size of the download file required by the download request exceeds a preset a threshold, the current session link between the server and the terminal is released; then, a background thread for downloading the download file is established on the server; the download file is downloaded and cached by the background thread; and finally, The download completed message is notified to the terminal to cause the terminal to re-establish a new session link with the server and acquire the download file in the cache.
- the server may release the session link with the terminal, and then download and cache the file requested by the terminal by establishing a background thread. Since the requested file is cached, the terminal may at the appropriate time Quickly obtaining the file in the cache not only avoids the long-term occupation of the server session link resource, but also improves the efficiency of the terminal acquiring the requested file.
- FIG. 1 is a flowchart of a first embodiment of a download request processing method according to an embodiment of the present application
- FIG. 2 is a flowchart of a second embodiment of a download request processing method according to an embodiment of the present application
- FIG. 3 is a schematic flowchart of step 209 of a download request processing method in an application scenario in FIG. 2 corresponding to the second embodiment;
- FIG. 4 is a flow chart showing the steps of a download request processing method in the second embodiment after each of the background threads is established;
- FIG. 5 is a schematic diagram of an operating environment of a download request processing program according to an embodiment of the present application.
- FIG. 6 is a functional block diagram of a download request processing program provided by an embodiment of the present application.
- a first embodiment of a download request processing method in an embodiment of the present application includes:
- the terminal may initiate a download request of the file to the server, so that the server can receive the download request.
- step 102 determining whether the size of the download file required for the download request exceeds a preset threshold, if not, proceed to step 103, and if so, proceed to step 104;
- the server can complete the download of the download file in a short time and hand it to the user's terminal. Therefore, the server can maintain the current session link with the terminal until the download file is completed and then released.
- the current session link between the server and the terminal may be released.
- the server may further request the terminal to set an execution period in which the download file is downloaded in the background. Understandably, in daily use, the server has busy time and idle time. When busy, the memory resources of the server are scarce, which is not conducive to downloading large files; while in idle time, the content resources of the server are often relatively small. Space, for example, in the middle of the night, it is more appropriate for the server to download large files during free time. Therefore, after determining that the size of the download file required for the download request exceeds a preset threshold, the server may first query the user's terminal, requesting the user to set an execution period, and the server will establish a background thread in the set execution period to complete. Download the download file. Further, before the step 105 is performed, if the server acquires the execution period set by the terminal, when the current system time of the server reaches the execution period, the following step 105 is performed.
- the server may establish a background thread at a suitable time period, then complete the download of the downloaded file through the background thread, and cache the downloaded file on the server, so that the user's terminal establishes a session link with the server again. After that, the download file can be quickly obtained.
- the server may notify the terminal by means of mail, short message, system message, etc., after the user knows the notification message, the user may choose to log in to the server again at any time. Re-establish a new session link with the server and then get the download file in the server cache.
- the server fails to download the downloaded file through the background thread, for example, the file requested by the server is from a certain server B, but the user does not have the right to acquire the data of the server B, thereby causing the download to fail.
- the server can return relevant failure information to the user's terminal.
- the terminal first, receiving a download request initiated by the terminal; and then determining whether the size of the download file required by the download request exceeds a preset threshold; if the size of the download file required by the download request exceeds a preset threshold And releasing a current session link between the server and the terminal; then, establishing a background thread for downloading the download file on the server; downloading and caching the download file by the background thread; and finally, downloading The completed message is notified to the terminal to cause the terminal to re-establish a new session link with the server and obtain the download file in the cache.
- the server may release the session link with the terminal, and then download and cache the file requested by the terminal by establishing a background thread. Since the requested file is cached, the terminal may at the appropriate time Quickly obtaining the file in the cache not only avoids the long-term occupation of the server session link resource, but also improves the efficiency of the terminal acquiring the requested file.
- a second embodiment of a download request processing method in the embodiment of the present application includes:
- step 202 determining whether the size of the download file required for the download request exceeds a preset threshold, if not, proceed to step 203, and if so, proceed to step 204;
- steps 201 to 204 are similar to the steps 101 to 104 in the first embodiment, and are not described herein again.
- the server may create a new download task to be processed for the download request, and execute and complete the download task when appropriate.
- steps 206 and 207 it can be understood that in order to utilize the idle resources of the server to process these download tasks, it is first necessary to obtain the amount of memory currently available to the server, that is, how much free resources there are. Then, determine if there are executable download tasks in these pending download tasks. To this end, the server can pre-count the maximum memory usage M1 of various types of download tasks during operation, so that the estimated memory usage of these pending download tasks can be estimated. Assuming that the type of the download task to be processed is A, and the maximum memory usage of the download task of the server type A is M1, the estimated memory usage of the pending download task is also M1.
- step 209 it is determined whether the number of executable download tasks exceeds a preset number threshold, and if so, step 209 is performed, and if not, step 211 is performed;
- the number threshold may be set to 1, that is, when the number of the executable download tasks exceeds one, that is, two or more, step 209 is performed; otherwise, the number of executable download tasks is one. Then, step 211 is performed.
- the priority of each of the executable download tasks may be calculated. It can be understood that when more than one download task can be executed in the server, processing the download tasks in the order of the server will affect the resource utilization and processing efficiency of the server. Therefore, in the face of multiple executable download tasks, the priority of each executable download task can be calculated first, and then these executable download tasks are processed in order of priority, so as to maximize the utilization of server resources.
- step 209 may include:
- the user can preset its first importance value, assuming p, and the server can assign the first weight Vp corresponding to the first importance value p.
- the first priority value of the executable download task can be p*Vp.
- an executable download task its priority can be determined by (p*Vp)/(t*Vt).
- the respective executable download task priorities can be determined according to the size of their values. It can be seen that for (p*Vp)/(t*Vt), the larger the p*Vp, the larger the value and the higher the priority; the larger the t*Vt, the smaller the value and the lower the priority. .
- Step 210 Perform step 211 on each of the executable download tasks in order of priority;
- step 211 when the number of the executable download tasks does not exceed the preset number threshold, step 211 may be directly performed. If the number of the executable download tasks exceeds one, the server may set the executable download tasks. The default execution order. For example, in the order of the establishment time of each executable download task, or in accordance with the order in which the download files corresponding to each executable download task are downloaded from large to small or from small to large, and the like. When the number of executable download tasks exceeds a preset number threshold, the executable download tasks may be sequentially executed in the order of priority determined in step 209 above.
- the server may process the executable download tasks in sequence, and before processing, first establish a corresponding background thread for the currently executed executable download task. Further, as shown in FIG. 4, after each of the background threads is established, the following processing steps are further included:
- step 402 is required to perform the determination. If the determination result is no, it indicates that the server can continue to process the next executable download task; if the determination result is yes, then the process should return to step 207 to re-determine the executable download task.
- steps 212 and 213 are similar to the steps 106 and 107 in the first embodiment, respectively, and are not described herein again.
- FIG. 5 is a schematic diagram showing the operating environment of the download request processing program 50 provided by the embodiment of the present application. For the convenience of description, only the related embodiments of the present application are shown. section.
- the download request processing program 50 is installed and runs in the processing device 5.
- the processing device 5 can be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
- the processing device 5 can include, but is not limited to, a memory 51 and a processor 52.
- Figure 5 shows only the processing device 5 having the components 51-52, but it should be understood that not all illustrated components may be implemented, and more or fewer components may be implemented instead.
- the memory 51 may be an internal storage unit of the processing device 5, such as a hard disk or memory of the processing device 5, in some embodiments.
- the memory 51 may also be an external storage device of the processing device 5 in other embodiments, such as a plug-in hard disk equipped on the processing device 5, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card (Flash Card) and so on.
- SMC smart memory card
- flash card flash card
- the memory 51 may also include both an internal storage unit of the processing device 5 and an external storage device.
- the memory 51 is used to store application software and various types of data installed in the processing device 5, such as program codes of the download request processing program 50, and the like.
- the memory 51 can also be used to temporarily store data that has been output or is about to be output.
- the processor 52 may be a central processor (Central) in some embodiments A processing unit (CPU), a microprocessor or other data processing chip for running program code or processing data stored in the memory 51, for example, executing the download request processing program 50 or the like.
- Central central processor
- CPU central processing unit
- microprocessor microprocessor or other data processing chip for running program code or processing data stored in the memory 51, for example, executing the download request processing program 50 or the like.
- FIG. 6 is a functional block diagram of the download request processing program 50 provided by the embodiment of the present application.
- the download request processing program 50 may be divided into one or more modules, the one or more modules being stored in the memory 51 and being processed by one or more processors (this Embodiments are performed by the processor 52) to complete the application.
- the download request processing program 50 may be divided into a download request receiving module 601, a file size determining module 602, a session link releasing module 603, a background thread establishing module 604, a file downloading module 605, and download completion.
- a module referred to in this application refers to a series of computer readable instruction segments capable of performing a particular function, and is more suitable than the program to describe the execution of the download request handler 50 in the processing device 5. The following description will specifically describe the functions of the modules 601-606.
- the download request receiving module 601 is configured to receive a download request initiated by the terminal;
- the file size determining module 602 is configured to determine whether the size of the download file required for the download request exceeds a preset threshold
- the session link release module 603 is configured to release the current session link between the server and the terminal if the determination result of the file size determination module 602 is YES;
- a background thread establishing module 604 configured to establish, on the server, a background thread that downloads the downloaded file
- a file downloading module 605, configured to download and cache the downloaded file by using the background thread
- the download completion notification module 606 is configured to notify the terminal that the downloaded message is completed, so that the terminal re-establishes a new session link with the server and acquires the downloaded file in the cache.
- download request processing program 50 may further include:
- Downloading a task creation module configured to create a corresponding download task to be processed according to the download request
- a first available memory quantity obtaining module configured to acquire a quantity of memory currently available to the server
- the executable task determining module is configured to determine that the download task whose estimated memory usage in the to-be-processed download task is less than or equal to the currently available memory amount is an executable download task;
- a first triggering module configured to: when the number of the executable download tasks does not exceed a preset number threshold, perform a step of establishing, on the server, a background thread that downloads the download file;
- a second triggering module configured to calculate a priority of each of the executable download tasks if the number of the executable download tasks exceeds a preset number of thresholds, and then sequentially perform the executables according to the priority order
- the download task triggers the background thread creation module 604;
- the background thread establishing module 604 specifically includes: a thread establishing unit, configured to establish, on the server, a background thread of the currently executable executable download task.
- download request processing program 50 may further include:
- a second available memory quantity obtaining module configured to acquire, after each of the background threads is established, an amount of memory currently available to the server
- a memory amount determining module configured to determine whether an estimated memory usage of the executable download task executed next time exceeds the currently available memory amount
- the second trigger module may include:
- a first value obtaining unit configured to acquire a first importance value corresponding to the download request of the executable download task, where the first importance value is preset by the terminal before initiating a download request;
- a first priority value calculation unit configured to calculate a first priority value of the executable download task according to the first importance value and a preset first weight
- a second priority value calculation unit configured to calculate a second priority value of the executable download task according to the estimated consumption duration of the executable download task and the preset second weight
- a priority determining unit configured to determine a priority of each of the executable download tasks according to a first priority value and a second priority value of each of the executable download tasks, wherein the first priority value is positively correlated with the priority The second priority value is negatively correlated with the priority.
- download request processing program 50 may further include:
- An execution period setting module configured to request the terminal to set an execution period in which the download file is downloaded in the background
- a period triggering module configured to trigger the background thread establishing module when the current system time of the server reaches the execution period, if the execution period setting module acquires the execution period set by the terminal 604.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
- a computer readable storage medium A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.
- the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
Abstract
Provided are a download request processing method and apparatus, a processing device and a medium, which are applicable to the field of communications. The method comprises: receiving a download request initiated by a terminal; determining whether the size of a file to be downloaded required by the download request exceeds a pre-set threshold value; if the size of the file to be downloaded required by the download request exceeds the pre-set threshold value, releasing the current session link between a server and the terminal; establishing, on the server, a background thread for downloading the file to be downloaded; downloading and caching the file to be downloaded by means of the background thread; and notifying the terminal of a message regarding the fact that the file has been downloaded, so that the terminal re-establishes a new session link with the server and acquires the downloaded file in the cache. The solution is used for solving the problem that a session link takes up session resources of a server for a long time due to a long download time, thereby causing the waste of system resources.
Description
本申请要求于2017年04月26日提交中国专利局、申请号为201710282796.8、发明名称为“一种下载请求处理方法和处理设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application, filed on Apr. 26, 2017, filed Jan. In the application.
本申请属于通信领域,尤其涉及一种下载请求处理方法、装置、处理设备及介质。The present application belongs to the field of communications, and in particular, to a download request processing method, apparatus, processing device, and medium.
目前,很多企业、用户会通过服务器来实现数据的共享。例如,企业可以将需要共享的文件上传至服务器,当企业的员工需要获取该文件时,可以从该服务器上下载到该文件,实现快捷、便利的文件共享。At present, many enterprises and users use the server to share data. For example, an enterprise can upload files that need to be shared to a server. When an enterprise employee needs to obtain the file, the file can be downloaded from the server for fast and convenient file sharing.
然而,随着数据交互的频繁以及数据量的增大,用户通过服务器下载的文件也越来越大,一个下载任务往往需要服务器耗费较多的时间,造成系统资源的浪费。However, with the frequent data interaction and the increase of the data volume, the files downloaded by the user through the server are also getting larger and larger. A download task often requires the server to spend more time, resulting in waste of system resources.
本申请实施例提供了一种下载请求处理方法、装置、处理设备及介质,以解决现有技术中服务器会话链接资源的长时间占用,降低了终端下载文件的效率的问题。The embodiment of the present application provides a download request processing method, apparatus, processing device, and medium, to solve the problem of long-term occupation of server session link resources in the prior art, and reduce the efficiency of downloading files by the terminal.
本申请实施例的第一方面提供了一种下载请求处理方法,包括:A first aspect of the embodiment of the present application provides a download request processing method, including:
接收终端发起的下载请求;Receiving a download request initiated by the terminal;
判断所述下载请求所需的下载文件的大小是否超过预设阈值;Determining whether the size of the download file required for the download request exceeds a preset threshold;
若所述下载请求所需的下载文件的大小超过预设阈值,则释放服务器与所述终端之间的当前会话链接;If the size of the download file required for the download request exceeds a preset threshold, releasing a current session link between the server and the terminal;
在所述服务器上建立下载所述下载文件的后台线程;Establishing a background thread for downloading the downloaded file on the server;
通过所述后台线程下载并缓存所述下载文件;Downloading and caching the download file by the background thread;
将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。Notifying the terminal that the downloaded message has been completed, so that the terminal re-establishes a new session link with the server and acquires the downloaded file in the cache.
本申请实施例的第二方面提供了一种下载请求处理装置,包括:A second aspect of the embodiments of the present application provides a download request processing apparatus, including:
下载请求接收模块,用于接收终端发起的下载请求;a download request receiving module, configured to receive a download request initiated by the terminal;
文件大小判断模块,用于判断所述下载请求所需的下载文件的大小是否超过预设阈值;a file size determining module, configured to determine whether a size of the download file required by the download request exceeds a preset threshold;
会话链接释放模块,用于若所述文件大小判断模块的判断结果为是,则释放服务器与所述终端之间的当前会话链接;a session link release module, configured to release a current session link between the server and the terminal if the determination result of the file size determination module is yes;
后台线程建立模块,用于在所述服务器上建立下载所述下载文件的后台线程;a background thread establishing module, configured to establish a background thread for downloading the download file on the server;
文件下载模块,用于通过所述后台线程下载并缓存所述下载文件;a file downloading module, configured to download and cache the downloaded file by using the background thread;
下载完成通知模块,用于将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。And a download completion notification module, configured to notify the terminal of the downloaded completion message, so that the terminal re-establishes a new session link with the server and acquires the download file in the cache.
本申请实施例的第三方面提供了一种处理设备,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的下载请求处理程序,所述处理器执行所述下载请求处理程序时实现如第一方面所述的下载请求处理方法的步骤。A third aspect of the embodiments of the present application provides a processing device including a memory and a processor, wherein the memory stores a download request processing program executable on the processor, and the processor executes the download request The steps of the download request processing method as described in the first aspect are implemented when the program is processed.
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有下载请求处理程序,所述下载请求处理程序被处理器执行时实现如第一方面所述的下载请求处理方法的步骤。A fourth aspect of the embodiments of the present application provides a computer readable storage medium storing a download request processing program, when the download request processing program is executed by a processor, implementing the method as described in the first aspect The steps of the download request processing method.
本申请实施例中,首先,接收终端发起的下载请求;然后,判断所述下载请求所需的下载文件的大小是否超过预设阈值;若所述下载请求所需的下载文件的大小超过预设阈值,则释放服务器与所述终端之间的当前会话链接;接着,在所述服务器上建立下载所述下载文件的后台线程;通过所述后台线程下载并缓存所述下载文件;最后,将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。这样,当终端请求下载的文件过大时,服务器可以释放与终端的会话链接,然后通过建立后台线程的方式下载并缓存终端请求的文件,由于请求的文件已缓存,终端可以在合适的时候从缓存中快速获取到该文件,不仅避免了服务器会话链接资源的长时间占用,而且提高了终端获取所请求的文件的效率。In the embodiment of the present application, first, receiving a download request initiated by the terminal; and then determining whether the size of the download file required by the download request exceeds a preset threshold; if the size of the download file required by the download request exceeds a preset a threshold, the current session link between the server and the terminal is released; then, a background thread for downloading the download file is established on the server; the download file is downloaded and cached by the background thread; and finally, The download completed message is notified to the terminal to cause the terminal to re-establish a new session link with the server and acquire the download file in the cache. In this way, when the file requested by the terminal is too large, the server may release the session link with the terminal, and then download and cache the file requested by the terminal by establishing a background thread. Since the requested file is cached, the terminal may at the appropriate time Quickly obtaining the file in the cache not only avoids the long-term occupation of the server session link resource, but also improves the efficiency of the terminal acquiring the requested file.
图1为本申请实施例中一种下载请求处理方法第一个实施例流程图;1 is a flowchart of a first embodiment of a download request processing method according to an embodiment of the present application;
图2为本申请实施例中一种下载请求处理方法第二个实施例流程图;2 is a flowchart of a second embodiment of a download request processing method according to an embodiment of the present application;
图3为图2对应第二个实施例中一种下载请求处理方法步骤209在一个应用场景下的流程示意图;3 is a schematic flowchart of step 209 of a download request processing method in an application scenario in FIG. 2 corresponding to the second embodiment;
图4为图2对应第二个实施例中一种下载请求处理方法在每建立一个所述后台线程之后的步骤流程示意图;4 is a flow chart showing the steps of a download request processing method in the second embodiment after each of the background threads is established;
图5是本申请实施例提供的下载请求处理程序的运行环境示意图;FIG. 5 is a schematic diagram of an operating environment of a download request processing program according to an embodiment of the present application;
图6是本申请实施例提供的下载请求处理程序的功能模块图。FIG. 6 is a functional block diagram of a download request processing program provided by an embodiment of the present application.
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for purposes of illustration and description However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the application.
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to explain the technical solutions described in the present application, the following description will be made by way of specific embodiments.
请参阅图1,本申请实施例中一种下载请求处理方法第一个实施例包括:Referring to FIG. 1, a first embodiment of a download request processing method in an embodiment of the present application includes:
101、接收终端发起的下载请求;101. Receive a download request initiated by the terminal.
本实施例中,当用户需要下载某个文件时,可以通过终端向服务器发起该文件的下载请求,从而服务器可以接收到该下载请求。In this embodiment, when the user needs to download a certain file, the terminal may initiate a download request of the file to the server, so that the server can receive the download request.
102、判断所述下载请求所需的下载文件的大小是否超过预设阈值,若否,则执行步骤103,若是,则执行步骤104;102, determining whether the size of the download file required for the download request exceeds a preset threshold, if not, proceed to step 103, and if so, proceed to step 104;
可以理解的是,由于共享在服务器中的文件的数据量往往非常庞大,因此,这些文件通常是存储在与服务器连接的数据库中。在服务器根据该下载请求下载文件时,服务器需要先从对应数据库中下载该文件,然后将该文件发送给用户终端。因此,当文件较大时,服务器往往等待较长的时间才能完成该文件的下载。As can be appreciated, since the amount of data shared by files in the server is often very large, these files are usually stored in a database connected to the server. When the server downloads a file according to the download request, the server needs to first download the file from the corresponding database, and then send the file to the user terminal. Therefore, when the file is large, the server often waits for a long time to complete the download of the file.
本实施例中,通过判断该下载请求所需的下载文件的大小是否超过预设阈值,若否,则表示服务器可以在较短的时间内完成该下载文件的下载,从而执行步骤103,下载该文件然后通过当前会话链接交给用户的终端;若是,则表示服务器需要消耗较长的时间才能完成该下载文件的下载,从而执行步骤104及后续步骤,通过后台的方式完成文件的下载。In this embodiment, it is determined whether the size of the download file required by the download request exceeds a preset threshold. If not, it indicates that the server can complete the download of the downloaded file in a short time, thereby performing step 103, downloading the The file is then delivered to the user's terminal through the current session link; if so, it means that the server needs to take a long time to complete the download of the downloaded file, thereby performing step 104 and subsequent steps to complete the file download in the background manner.
103、保持与所述终端之间的当前会话链接,在下载完成所述下载文件之后,将所述下载文件通过所述当前会话链接发送至所述终端;103. Maintain a current session link with the terminal, and after downloading the download file, send the download file to the terminal by using the current session link;
当该下载文件较小时,服务器可以在短时间内完成下载文件的下载从而交给用户的终端,因此,服务器可以保持与所述终端之间的当前会话链接,直至下载文件完成后再释放。When the download file is small, the server can complete the download of the download file in a short time and hand it to the user's terminal. Therefore, the server can maintain the current session link with the terminal until the download file is completed and then released.
104、释放服务器与所述终端之间的当前会话链接;104. Release a current session link between the server and the terminal.
本实施例中,为避免当前会话链接长期占用服务器的会话链接资源,在判定所述下载请求所需的下载文件的大小超过预设阈值时,可以释放服务器与所述终端之间的当前会话链接。In this embodiment, in order to prevent the current session link from occupying the session link resource of the server for a long time, when determining that the size of the download file required for the download request exceeds a preset threshold, the current session link between the server and the terminal may be released. .
进一步地,在释放服务器与所述终端之间的当前会话链接之前,服务器还可以请求所述终端设定后台下载所述下载文件的执行时段。可以理解的是,服务器在日常使用中,存在忙时和闲时,在忙时,服务器的内存资源较为紧缺,不利于用于下载大体积的文件;而在闲时,服务器的内容资源往往较为空间,例如在半夜时段,服务器在闲时时段下载大体积的文件则更为合适。因此,在判定述下载请求所需的下载文件的大小超过预设阈值之后,服务器可以先询问用户的终端,请求用户设定一个执行时段,服务器将在设定的该执行时段建立后台线程来完成下载文件的下载。进一步地,在下述步骤105之前,若服务器获取到所述终端设定的所述执行时段,则当所述服务器的当前系统时间到达所述执行时段时,执行下述步骤105。Further, before releasing the current session link between the server and the terminal, the server may further request the terminal to set an execution period in which the download file is downloaded in the background. Understandably, in daily use, the server has busy time and idle time. When busy, the memory resources of the server are scarce, which is not conducive to downloading large files; while in idle time, the content resources of the server are often relatively small. Space, for example, in the middle of the night, it is more appropriate for the server to download large files during free time. Therefore, after determining that the size of the download file required for the download request exceeds a preset threshold, the server may first query the user's terminal, requesting the user to set an execution period, and the server will establish a background thread in the set execution period to complete. Download the download file. Further, before the step 105 is performed, if the server acquires the execution period set by the terminal, when the current system time of the server reaches the execution period, the following step 105 is performed.
105、在所述服务器上建立下载所述下载文件的后台线程;105. Establish a background thread for downloading the download file on the server.
106、通过所述后台线程下载并缓存所述下载文件;106. Download and cache the download file by using the background thread.
对于步骤105和106,服务器可以在合适的时间段建立后台线程,然后通过该后台线程完成下载文件的下载,并将下载好的文件缓存在服务器上,以便于用户的终端与服务器再次建立会话链接之后,可以快速地获取到该下载文件。For steps 105 and 106, the server may establish a background thread at a suitable time period, then complete the download of the downloaded file through the background thread, and cache the downloaded file on the server, so that the user's terminal establishes a session link with the server again. After that, the download file can be quickly obtained.
107、将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。107. Notifying the terminal that the downloaded message is completed, so that the terminal re-establishes a new session link with the server and acquires the downloaded file in the cache.
本实施例中,当服务器通过后台线程完成下载文件的下载之后,服务器可以通过邮件、短信、系统消息等方式通知终端,用户在得知该通知消息之后,可以选择在任意时候再次登录服务器,终端与服务器重新建立新的会话链接,然后获取服务器缓存中的所述下载文件。In this embodiment, after the server completes the download of the downloaded file through the background thread, the server may notify the terminal by means of mail, short message, system message, etc., after the user knows the notification message, the user may choose to log in to the server again at any time. Re-establish a new session link with the server and then get the download file in the server cache.
另外,在本实施例中,若服务器通过后台线程下载该下载文件失败,例如服务器需求的文件来自某个服务器B,但用户没有获取该服务器B的数据的权限,从而导致下载失败。此时,服务器可以向用户的终端返回相关的失败信息。In addition, in this embodiment, if the server fails to download the downloaded file through the background thread, for example, the file requested by the server is from a certain server B, but the user does not have the right to acquire the data of the server B, thereby causing the download to fail. At this point, the server can return relevant failure information to the user's terminal.
本实施例中,首先,接收终端发起的下载请求;然后,判断所述下载请求所需的下载文件的大小是否超过预设阈值;若所述下载请求所需的下载文件的大小超过预设阈值,则释放服务器与所述终端之间的当前会话链接;接着,在所述服务器上建立下载所述下载文件的后台线程;通过所述后台线程下载并缓存所述下载文件;最后,将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。这样,当终端请求下载的文件过大时,服务器可以释放与终端的会话链接,然后通过建立后台线程的方式下载并缓存终端请求的文件,由于请求的文件已缓存,终端可以在合适的时候从缓存中快速获取到该文件,不仅避免了服务器会话链接资源的长时间占用,而且提高了终端获取所请求的文件的效率。In this embodiment, first, receiving a download request initiated by the terminal; and then determining whether the size of the download file required by the download request exceeds a preset threshold; if the size of the download file required by the download request exceeds a preset threshold And releasing a current session link between the server and the terminal; then, establishing a background thread for downloading the download file on the server; downloading and caching the download file by the background thread; and finally, downloading The completed message is notified to the terminal to cause the terminal to re-establish a new session link with the server and obtain the download file in the cache. In this way, when the file requested by the terminal is too large, the server may release the session link with the terminal, and then download and cache the file requested by the terminal by establishing a background thread. Since the requested file is cached, the terminal may at the appropriate time Quickly obtaining the file in the cache not only avoids the long-term occupation of the server session link resource, but also improves the efficiency of the terminal acquiring the requested file.
请参阅图2,本申请实施例中一种下载请求处理方法第二个实施例包括:Referring to FIG. 2, a second embodiment of a download request processing method in the embodiment of the present application includes:
201、接收终端发起的下载请求;201. Receive a download request initiated by the terminal.
202、判断所述下载请求所需的下载文件的大小是否超过预设阈值,若否,则执行步骤203,若是,则执行步骤204;202, determining whether the size of the download file required for the download request exceeds a preset threshold, if not, proceed to step 203, and if so, proceed to step 204;
203、保持与所述终端之间的当前会话链接,在下载完成所述下载文件之后,将所述下载文件通过所述当前会话链接发送至所述终端;203. Keep a current session link with the terminal, and after downloading the download file, send the download file to the terminal by using the current session link.
204、释放服务器与所述终端之间的当前会话链接;204. Release a current session link between the server and the terminal.
上述步骤201~204与第一个实施例中的步骤101~104类似,此处不再赘述。The above steps 201 to 204 are similar to the steps 101 to 104 in the first embodiment, and are not described herein again.
205、根据所述下载请求新建对应的待处理的下载任务;205. Create a corresponding download task to be processed according to the download request.
本实施例中,服务器在释放当前会话链接之后,可以为该下载请求新建一个待处理的下载任务,并在合适的时候执行并完成该下载任务。In this embodiment, after the server releases the current session link, the server may create a new download task to be processed for the download request, and execute and complete the download task when appropriate.
206、获取所述服务器当前可用的内存量;206. Obtain a quantity of memory currently available to the server;
207、确定所述待处理的下载任务中预计内存使用量小于或等于所述当前可用的内存量的下载任务为可执行下载任务;207. Determine that the download task whose estimated memory usage in the to-be-processed download task is less than or equal to the currently available memory amount is an executable download task.
对于步骤206和207,可以理解的是,为了利用服务器的空闲资源来处理这些下载任务,首先需要获取服务器当前可用的内存量有多少,也即空闲的资源有多少。然后,确定这些待处理的下载任务中是否有可执行的下载任务。为此,服务器可以预先统计各种类型的下载任务在运行期间的最大内存使用量M1,从而可以估算出这些待处理的下载任务的预计内存使用量。假设某个待处理的下载任务的类型为A,服务器统计的类型为A的下载任务的最大内存使用量为M1,则该待处理的下载任务的预计内存使用量也为M1。For steps 206 and 207, it can be understood that in order to utilize the idle resources of the server to process these download tasks, it is first necessary to obtain the amount of memory currently available to the server, that is, how much free resources there are. Then, determine if there are executable download tasks in these pending download tasks. To this end, the server can pre-count the maximum memory usage M1 of various types of download tasks during operation, so that the estimated memory usage of these pending download tasks can be estimated. Assuming that the type of the download task to be processed is A, and the maximum memory usage of the download task of the server type A is M1, the estimated memory usage of the pending download task is also M1.
因此,假设服务器当前可用的内存量为M0,则可以将那些M1≤M0的下载任务确定为可执行下载任务。Therefore, assuming that the amount of memory currently available to the server is M0, those download tasks of M1 ≤ M0 can be determined as executable download tasks.
208、判断所述可执行下载任务的数量是否超过预设的数量阈值,若是,则执行步骤209,若否,则执行步骤211;208, it is determined whether the number of executable download tasks exceeds a preset number threshold, and if so, step 209 is performed, and if not, step 211 is performed;
具体地,该数量阈值可以设为1,即,当所述可执行下载任务的数量超过1个时,即2个以上时,执行步骤209;反之,所述可执行下载任务的数量为1时,则执行步骤211。Specifically, the number threshold may be set to 1, that is, when the number of the executable download tasks exceeds one, that is, two or more, step 209 is performed; otherwise, the number of executable download tasks is one. Then, step 211 is performed.
209、计算各个所述可执行下载任务的优先级;209. Calculate a priority of each of the executable download tasks.
若所述可执行下载任务的数量超过预设的数量阈值,则可以计算各个所述可执行下载任务的优先级。可以理解的是,当服务器中可执行的下载任务超过1个时,对服务器来说,按照何种顺序处理这些下载任务将关系到服务器的资源利用率和处理效率。因此,面对多个可执行下载任务时,可以先计算出各个可执行下载任务的优先级,然后按照优先级的先后顺序处理这些可执行下载任务,以便实现服务器资源的最大化利用。If the number of executable download tasks exceeds a preset number threshold, the priority of each of the executable download tasks may be calculated. It can be understood that when more than one download task can be executed in the server, processing the download tasks in the order of the server will affect the resource utilization and processing efficiency of the server. Therefore, in the face of multiple executable download tasks, the priority of each executable download task can be calculated first, and then these executable download tasks are processed in order of priority, so as to maximize the utilization of server resources.
进一步地,如图3所示,步骤209可以包括:Further, as shown in FIG. 3, step 209 may include:
301、获取所述可执行下载任务对应下载请求的第一重要性数值,所述第一重要性数值由所述终端在发起下载请求之前预先设定;301. Obtain a first importance value corresponding to the download request of the executable download task, where the first importance value is preset by the terminal before initiating a download request.
302、根据所述第一重要性数值和预设的第一权重计算所述可执行下载任务的第一优先值;302. Calculate, according to the first importance value and the preset first weight, a first priority value of the executable download task.
303、根据所述可执行下载任务的预估消耗时长和预设的第二权重计算所述可执行下载任务的第二优先值;303. Calculate, according to the estimated consumption duration of the executable download task and the preset second weight, a second priority value of the executable download task.
304、根据各个所述可执行下载任务的第一优先值和第二优先值确定各个所述可执行下载任务的优先级,其中,第一优先值与所述优先级正相关,所述第二优先值与所述优先级负相关。304. Determine, according to the first priority value and the second priority value of each of the executable download tasks, a priority of each of the executable download tasks, where the first priority value is positively related to the priority, and the second The priority value is inversely related to the priority.
对于上述步骤301~304,对于每个下载任务,用户可以预先设定其第一重要性数值,假设为p,另外,服务器可以赋予第一重要性数值p对应的第一权重Vp。从而,该可执行下载任务的第一优先值可以为p*Vp。For the above steps 301-304, for each download task, the user can preset its first importance value, assuming p, and the server can assign the first weight Vp corresponding to the first importance value p. Thus, the first priority value of the executable download task can be p*Vp.
另外,服务器可以预先统计各种类型的下载任务执行所需的耗时T1,从而可以估算出这些可执行下载任务的预估消耗时长t。假设某个可执行下载任务的类型为B,服务器统计的类型为B的下载任务的所需的耗时为T1,则该可执行下载任务的预估消耗时长t=T1。并且,服务器可以赋予所述可执行下载任务的预估消耗时长对应的第二权重Vt,从而该可执行下载任务的第二优先值可以为t*Vt。In addition, the server can pre-count the time consuming T1 required for various types of download tasks to perform, so that the estimated consumption time t of these executable download tasks can be estimated. Assuming that the type of an executable download task is B, and the time required for the download task of the server type B is T1, the estimated consumption time of the executable download task is t=T1. Moreover, the server may assign a second weight Vt corresponding to the estimated consumption duration of the executable download task, so that the second priority value of the executable download task may be t*Vt.
从而,对于一个可执行下载任务来说,其优先级可以由(p*Vp)/(t*Vt)来确定。在计算出所各个所述可执行下载任务的(p*Vp)/(t*Vt)之后,可以根据它们值的大小确定出各个可执行下载任务优先级。可知,对于(p*Vp)/(t*Vt)来说,p*Vp越大,则其值越大,优先级越高;t*Vt越大,则其值越小,优先级越低。Thus, for an executable download task, its priority can be determined by (p*Vp)/(t*Vt). After calculating (p*Vp)/(t*Vt) of each of the executable download tasks, the respective executable download task priorities can be determined according to the size of their values. It can be seen that for (p*Vp)/(t*Vt), the larger the p*Vp, the larger the value and the higher the priority; the larger the t*Vt, the smaller the value and the lower the priority. .
210、根据优先级的先后顺序依次对各个所述可执行下载任务执行步骤211;Step 210: Perform step 211 on each of the executable download tasks in order of priority;
211、在所述服务器上建立当前执行的所述可执行下载任务的后台线程;211. Establish a background thread of the currently executable executable download task on the server.
本实施例中,当所述可执行下载任务的数量未超过预设的数量阈值时,可以直接执行步骤211,若这些可执行下载任务的数量超过1个,服务器可以为这些可执行下载任务设定默认的执行顺序。例如,按照各个可执行下载任务的建立时间的先后顺序,或者按照各个可执行下载任务对应下载的下载文件从大到小或从小到大的顺序,等等。而当所述可执行下载任务的数量超过预设的数量阈值时,则可以按照上述步骤209确定出的优先级的先后顺序依次执行这些可执行下载任务。In this embodiment, when the number of the executable download tasks does not exceed the preset number threshold, step 211 may be directly performed. If the number of the executable download tasks exceeds one, the server may set the executable download tasks. The default execution order. For example, in the order of the establishment time of each executable download task, or in accordance with the order in which the download files corresponding to each executable download task are downloaded from large to small or from small to large, and the like. When the number of executable download tasks exceeds a preset number threshold, the executable download tasks may be sequentially executed in the order of priority determined in step 209 above.
对于步骤211,服务器可以按顺序依次处理这些可执行下载任务,在处理之前,先为当前执行的所述可执行下载任务建立对应的后台线程。进一步地,如图4所示,在每建立一个所述后台线程之后,还包括如下处理步骤:For step 211, the server may process the executable download tasks in sequence, and before processing, first establish a corresponding background thread for the currently executed executable download task. Further, as shown in FIG. 4, after each of the background threads is established, the following processing steps are further included:
401、获取所述服务器当前可用的内存量;401. Obtain a quantity of memory currently available to the server.
402、判断下一个执行的所述可执行下载任务的预计内存使用量是否超过所述当前可用的内存量,若是,则执行步骤207,若否,则执行步骤403;402, determining whether the expected memory usage of the executable download task that is executed next time exceeds the currently available memory amount, and if yes, executing step 207, if not, executing step 403;
403、继续建立下一个可执行下载任务的后台线程。403. Continue to establish the next background thread for the executable download task.
对于步骤401~403,可以每建立一个所述后台线程,服务器上的当前可用的内存量就会发生变化,在不考虑其它占用内存资源的任务的情况下,当前可用的内存量会变小,此时,可能出现剩下的可用内存量不足以处理下一个可执行下载任务的情况。因此,需要执行步骤402进行判断,若判断结果为否,则表示服务器还可以继续处理下一个可执行的下载任务;若判断结果为是,则应该返回执行步骤207,重新确定可执行下载任务。For steps 401 to 403, each of the background threads can be created, and the amount of currently available memory on the server changes. The amount of currently available memory becomes smaller without considering other tasks that occupy memory resources. At this point, there may be situations where the amount of free memory remaining is not enough to handle the next executable download task. Therefore, step 402 is required to perform the determination. If the determination result is no, it indicates that the server can continue to process the next executable download task; if the determination result is yes, then the process should return to step 207 to re-determine the executable download task.
212、通过所述后台线程下载并缓存所述下载文件;212. Download and cache the download file by using the background thread.
213、将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。213. Notify the terminal that the downloaded message is complete, so that the terminal re-establishes a new session link with the server and acquires the downloaded file in the cache.
上述步骤212和步骤213分别与第一个实施例中的步骤106和107类似,此处不再赘述。The above steps 212 and 213 are similar to the steps 106 and 107 in the first embodiment, respectively, and are not described herein again.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence of the steps in the above embodiments does not mean that the order of execution is performed. The order of execution of each process should be determined by its function and internal logic, and should not be construed as limiting the implementation process of the embodiments of the present application.
对应于上文实施例所述的下载请求处理方法,图5示出了本申请实施例提供的下载请求处理程序50的运行环境示意图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the download request processing method described in the above embodiment, FIG. 5 is a schematic diagram showing the operating environment of the download request processing program 50 provided by the embodiment of the present application. For the convenience of description, only the related embodiments of the present application are shown. section.
在本实施例中,所述的下载请求处理程序50安装并运行于处理设备5中。所述处理设备5可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该处理设备5可包括,但不仅限于,存储器51和处理器52。图5仅示出了具有组件51-52的处理设备5,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。In the present embodiment, the download request processing program 50 is installed and runs in the processing device 5. The processing device 5 can be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The processing device 5 can include, but is not limited to, a memory 51 and a processor 52. Figure 5 shows only the processing device 5 having the components 51-52, but it should be understood that not all illustrated components may be implemented, and more or fewer components may be implemented instead.
所述存储器51在一些实施例中可以是所述处理设备5的内部存储单元,例如该处理设备5的硬盘或内存。所述存储器51在另一些实施例中也可以是所述处理设备5的外部存储设备,例如所述处理设备5上配备的插接式硬盘,智能存储卡(Smart Media Card, SMC),安全数字(Secure Digital, SD)卡,闪存卡(Flash
Card)等。进一步地,所述存储器51还可以既包括所述处理设备5的内部存储单元也包括外部存储设备。所述存储器51用于存储安装于所述处理设备5的应用软件及各类数据,例如所述下载请求处理程序50的程序代码等。所述存储器51还可以用于暂时地存储已经输出或者将要输出的数据。The memory 51 may be an internal storage unit of the processing device 5, such as a hard disk or memory of the processing device 5, in some embodiments. The memory 51 may also be an external storage device of the processing device 5 in other embodiments, such as a plug-in hard disk equipped on the processing device 5, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card (Flash
Card) and so on. Further, the memory 51 may also include both an internal storage unit of the processing device 5 and an external storage device. The memory 51 is used to store application software and various types of data installed in the processing device 5, such as program codes of the download request processing program 50, and the like. The memory 51 can also be used to temporarily store data that has been output or is about to be output.
所述处理器52在一些实施例中可以是一中央处理器(Central
Processing Unit, CPU),微处理器或其他数据处理芯片,用于运行所述存储器51中存储的程序代码或处理数据,例如执行所述下载请求处理程序50等。The processor 52 may be a central processor (Central) in some embodiments
A processing unit (CPU), a microprocessor or other data processing chip for running program code or processing data stored in the memory 51, for example, executing the download request processing program 50 or the like.
请参阅图6,是本申请实施例提供的下载请求处理程序50的功能模块图。在本实施例中,所述的下载请求处理程序50可以被分割成一个或多个模块,所述一个或者多个模块被存储于所述存储器51中,并由一个或多个处理器(本实施例为所述处理器52)所执行,以完成本申请。例如,在图6中,所述的下载请求处理程序50可以被分割成下载请求接收模块601、文件大小判断模块602、会话链接释放模块603、后台线程建立模块604、文件下载模块605和下载完成通知模块606。本申请所称的模块是指能够完成特定功能的一系列计算机可读指令段,比程序更适合于描述所述下载请求处理程序50在所述处理设备5中的执行过程。以下描述将具体介绍所述模块601-606的功能。Please refer to FIG. 6 , which is a functional block diagram of the download request processing program 50 provided by the embodiment of the present application. In this embodiment, the download request processing program 50 may be divided into one or more modules, the one or more modules being stored in the memory 51 and being processed by one or more processors (this Embodiments are performed by the processor 52) to complete the application. For example, in FIG. 6, the download request processing program 50 may be divided into a download request receiving module 601, a file size determining module 602, a session link releasing module 603, a background thread establishing module 604, a file downloading module 605, and download completion. Notification module 606. A module referred to in this application refers to a series of computer readable instruction segments capable of performing a particular function, and is more suitable than the program to describe the execution of the download request handler 50 in the processing device 5. The following description will specifically describe the functions of the modules 601-606.
下载请求接收模块601,用于接收终端发起的下载请求;The download request receiving module 601 is configured to receive a download request initiated by the terminal;
文件大小判断模块602,用于判断所述下载请求所需的下载文件的大小是否超过预设阈值;The file size determining module 602 is configured to determine whether the size of the download file required for the download request exceeds a preset threshold;
会话链接释放模块603,用于若所述文件大小判断模块602的判断结果为是,则释放服务器与所述终端之间的当前会话链接;The session link release module 603 is configured to release the current session link between the server and the terminal if the determination result of the file size determination module 602 is YES;
后台线程建立模块604,用于在所述服务器上建立下载所述下载文件的后台线程;a background thread establishing module 604, configured to establish, on the server, a background thread that downloads the downloaded file;
文件下载模块605,用于通过所述后台线程下载并缓存所述下载文件;a file downloading module 605, configured to download and cache the downloaded file by using the background thread;
下载完成通知模块606,用于将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。The download completion notification module 606 is configured to notify the terminal that the downloaded message is completed, so that the terminal re-establishes a new session link with the server and acquires the downloaded file in the cache.
进一步地,所述下载请求处理程序50还可以包括:Further, the download request processing program 50 may further include:
下载任务新建模块,用于根据所述下载请求新建对应的待处理的下载任务;Downloading a task creation module, configured to create a corresponding download task to be processed according to the download request;
第一可用内存量获取模块,用于获取所述服务器当前可用的内存量;a first available memory quantity obtaining module, configured to acquire a quantity of memory currently available to the server;
可执行任务确定模块,用于确定所述待处理的下载任务中预计内存使用量小于或等于所述当前可用的内存量的下载任务为可执行下载任务;The executable task determining module is configured to determine that the download task whose estimated memory usage in the to-be-processed download task is less than or equal to the currently available memory amount is an executable download task;
第一触发模块,用于若所述可执行下载任务的数量未超过预设的数量阈值,则执行在所述服务器上建立下载所述下载文件的后台线程的步骤;a first triggering module, configured to: when the number of the executable download tasks does not exceed a preset number threshold, perform a step of establishing, on the server, a background thread that downloads the download file;
第二触发模块,用于若所述可执行下载任务的数量超过预设的数量阈值,则计算各个所述可执行下载任务的优先级,然后根据优先级的先后顺序依次对各个所述可执行下载任务触发所述后台线程建立模块604;a second triggering module, configured to calculate a priority of each of the executable download tasks if the number of the executable download tasks exceeds a preset number of thresholds, and then sequentially perform the executables according to the priority order The download task triggers the background thread creation module 604;
所述后台线程建立模块604具体包括:线程建立单元,用于在所述服务器上建立当前执行的所述可执行下载任务的后台线程。The background thread establishing module 604 specifically includes: a thread establishing unit, configured to establish, on the server, a background thread of the currently executable executable download task.
进一步地,所述下载请求处理程序50还可以包括:Further, the download request processing program 50 may further include:
第二可用内存量获取模块,用于在每建立一个所述后台线程之后,获取所述服务器当前可用的内存量;a second available memory quantity obtaining module, configured to acquire, after each of the background threads is established, an amount of memory currently available to the server;
内存量判断模块,用于判断下一个执行的所述可执行下载任务的预计内存使用量是否超过所述当前可用的内存量;a memory amount determining module, configured to determine whether an estimated memory usage of the executable download task executed next time exceeds the currently available memory amount;
返回触发模块,用于若所述内存量判断模块的判断结果为是,则返回触发所述可执行任务确定模块。Returning to the triggering module, if the judgment result of the memory amount determining module is yes, returning to trigger the executable task determining module.
进一步地,所述第二触发模块可以包括:Further, the second trigger module may include:
第一数值获取单元,用于获取所述可执行下载任务对应下载请求的第一重要性数值,所述第一重要性数值由所述终端在发起下载请求之前预先设定;a first value obtaining unit, configured to acquire a first importance value corresponding to the download request of the executable download task, where the first importance value is preset by the terminal before initiating a download request;
第一优先值计算单元,用于根据所述第一重要性数值和预设的第一权重计算所述可执行下载任务的第一优先值;a first priority value calculation unit, configured to calculate a first priority value of the executable download task according to the first importance value and a preset first weight;
第二优先值计算单元,用于根据所述可执行下载任务的预估消耗时长和预设的第二权重计算所述可执行下载任务的第二优先值;a second priority value calculation unit, configured to calculate a second priority value of the executable download task according to the estimated consumption duration of the executable download task and the preset second weight;
优先级确定单元,用于根据各个所述可执行下载任务的第一优先值和第二优先值确定各个所述可执行下载任务的优先级,其中,第一优先值与所述优先级正相关,所述第二优先值与所述优先级负相关。a priority determining unit, configured to determine a priority of each of the executable download tasks according to a first priority value and a second priority value of each of the executable download tasks, wherein the first priority value is positively correlated with the priority The second priority value is negatively correlated with the priority.
进一步地,所述下载请求处理程序50还可以包括:Further, the download request processing program 50 may further include:
执行时段设定模块,用于请求所述终端设定后台下载所述下载文件的执行时段;An execution period setting module, configured to request the terminal to set an execution period in which the download file is downloaded in the background;
时段触发模块,用于若所述执行时段设定模块获取到所述终端设定的所述执行时段,则当所述服务器的当前系统时间到达所述执行时段时,触发所述后台线程建立模块604。a period triggering module, configured to trigger the background thread establishing module when the current system time of the server reaches the execution period, if the execution period setting module acquires the execution period set by the terminal 604.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application, in essence or the contribution to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。The above embodiments are only used to explain the technical solutions of the present application, and are not limited thereto; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still The technical solutions described in the embodiments are modified, or the equivalents of the technical features are replaced by the equivalents. The modifications and substitutions of the embodiments do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims (20)
- 一种下载请求处理方法,其特征在于,包括:A download request processing method, comprising:接收终端发起的下载请求;Receiving a download request initiated by the terminal;判断所述下载请求所需的下载文件的大小是否超过预设阈值;Determining whether the size of the download file required for the download request exceeds a preset threshold;若所述下载请求所需的下载文件的大小超过预设阈值,则释放服务器与所述终端之间的当前会话链接;If the size of the download file required for the download request exceeds a preset threshold, releasing a current session link between the server and the terminal;在所述服务器上建立下载所述下载文件的后台线程;Establishing a background thread for downloading the downloaded file on the server;通过所述后台线程下载并缓存所述下载文件;Downloading and caching the download file by the background thread;将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。Notifying the terminal that the downloaded message has been completed, so that the terminal re-establishes a new session link with the server and acquires the downloaded file in the cache.
- 如权利要求1所述的下载请求处理方法,其特征在于,在所述服务器上建立下载所述下载文件的后台线程之前,还包括:The download request processing method according to claim 1, wherein before the background thread for downloading the download file is established on the server, the method further includes:根据所述下载请求新建对应的待处理的下载任务;Creating a corresponding download task to be processed according to the download request;获取所述服务器当前可用的内存量;Obtaining the amount of memory currently available to the server;确定所述待处理的下载任务中预计内存使用量小于或等于所述当前可用的内存量的下载任务为可执行下载任务;Determining that the download task in the to-be-processed download task that the estimated memory usage is less than or equal to the currently available memory amount is an executable download task;若所述可执行下载任务的数量未超过预设的数量阈值,则执行在所述服务器上建立下载所述下载文件的后台线程的步骤;If the number of the executable download tasks does not exceed a preset number threshold, performing a step of establishing a background thread for downloading the download file on the server;若所述可执行下载任务的数量超过预设的数量阈值,则计算各个所述可执行下载任务的优先级,然后根据优先级的先后顺序依次对各个所述可执行下载任务执行在所述服务器上建立下载所述下载文件的后台线程的步骤;If the number of the executable download tasks exceeds a preset number threshold, calculating a priority of each of the executable download tasks, and then sequentially executing the executable download tasks on the server according to a priority order Establishing a step of downloading a background thread of the downloaded file;在所述服务器上建立下载所述下载文件的后台线程具体包括:在所述服务器上建立当前执行的所述可执行下载任务的后台线程。Establishing a background thread for downloading the download file on the server specifically includes: establishing, on the server, a background thread of the currently executable executable download task.
- 如权利要求2所述的下载请求处理方法,其特征在于,所述下载请求处理方法还包括:The download request processing method according to claim 2, wherein the download request processing method further comprises:在每建立一个所述后台线程之后,获取所述服务器当前可用的内存量;Obtaining the amount of memory currently available to the server after each of the background threads is established;判断下一个执行的所述可执行下载任务的预计内存使用量是否超过所述当前可用的内存量;Determining whether the estimated memory usage of the executable download task executed next time exceeds the currently available memory amount;若下一个执行的所述可执行下载任务的预计内存使用量超过所述当前可用的内存量,则返回执行确定所述待处理的下载任务中预计内存使用量小于或等于所述当前可用的内存量的下载任务为可执行下载任务的步骤。If the estimated memory usage of the executable download task that is executed next time exceeds the currently available memory amount, returning execution to determine that the expected memory usage in the to-be-processed download task is less than or equal to the currently available memory The amount of download tasks is the step of performing a download task.
- 如权利要求2所述的下载请求处理方法,其特征在于,所述计算各个所述可执行下载任务的优先级包括:The download request processing method according to claim 2, wherein the calculating the priority of each of the executable download tasks comprises:获取所述可执行下载任务对应下载请求的第一重要性数值,所述第一重要性数值由所述终端在发起下载请求之前预先设定;Acquiring, by the executable download task, a first importance value corresponding to the download request, where the first importance value is preset by the terminal before initiating a download request;根据所述第一重要性数值和预设的第一权重计算所述可执行下载任务的第一优先值;Calculating a first priority value of the executable download task according to the first importance value and a preset first weight;根据所述可执行下载任务的预估消耗时长和预设的第二权重计算所述可执行下载任务的第二优先值;Calculating a second priority value of the executable download task according to the estimated consumption duration of the executable download task and the preset second weight;根据各个所述可执行下载任务的第一优先值和第二优先值确定各个所述可执行下载任务的优先级,其中,第一优先值与所述优先级正相关,所述第二优先值与所述优先级负相关。Determining a priority of each of the executable download tasks according to a first priority value and a second priority value of each of the executable download tasks, wherein the first priority value is positively correlated with the priority, and the second priority value Negatively related to the priority.
- 如权利要求1至4中任一项所述的下载请求处理方法,其特征在于,在释放服务器与所述终端之间的当前会话链接之前,还包括:The download request processing method according to any one of claims 1 to 4, further comprising: before releasing the current session link between the server and the terminal, further comprising:请求所述终端设定后台下载所述下载文件的执行时段;Requesting the terminal to set an execution period in which the download file is downloaded in the background;在所述服务器上建立下载所述下载文件的后台线程之前,还包括:Before establishing a background thread for downloading the download file on the server, the method further includes:若获取到所述终端设定的所述执行时段,则当所述服务器的当前系统时间到达所述执行时段时,执行在所述服务器上建立下载所述下载文件的后台线程的步骤。If the execution period set by the terminal is obtained, when the current system time of the server reaches the execution period, a step of establishing a background thread for downloading the download file on the server is performed.
- 一种下载请求处理装置,其特征在于,包括:A download request processing device, comprising:下载请求接收模块,用于接收终端发起的下载请求;a download request receiving module, configured to receive a download request initiated by the terminal;文件大小判断模块,用于判断所述下载请求所需的下载文件的大小是否超过预设阈值;a file size determining module, configured to determine whether a size of the download file required by the download request exceeds a preset threshold;会话链接释放模块,用于若所述文件大小判断模块的判断结果为是,则释放服务器与所述终端之间的当前会话链接;a session link release module, configured to release a current session link between the server and the terminal if the determination result of the file size determination module is yes;后台线程建立模块,用于在所述服务器上建立下载所述下载文件的后台线程;a background thread establishing module, configured to establish a background thread for downloading the download file on the server;文件下载模块,用于通过所述后台线程下载并缓存所述下载文件;a file downloading module, configured to download and cache the downloaded file by using the background thread;下载完成通知模块,用于将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。And a download completion notification module, configured to notify the terminal of the downloaded completion message, so that the terminal re-establishes a new session link with the server and acquires the download file in the cache.
- 根据权利要求6所述的下载请求处理装置,其特征在于,还包括:The download request processing apparatus according to claim 6, further comprising:下载任务新建模块,用于根据所述下载请求新建对应的待处理的下载任务;Downloading a task creation module, configured to create a corresponding download task to be processed according to the download request;第一可用内存量获取模块,用于获取所述服务器当前可用的内存量;a first available memory quantity obtaining module, configured to acquire a quantity of memory currently available to the server;可执行任务确定模块,用于确定所述待处理的下载任务中预计内存使用量小于或等于所述当前可用的内存量的下载任务为可执行下载任务;The executable task determining module is configured to determine that the download task whose estimated memory usage in the to-be-processed download task is less than or equal to the currently available memory amount is an executable download task;第一触发模块,用于若所述可执行下载任务的数量未超过预设的数量阈值,则执行在所述服务器上建立下载所述下载文件的后台线程的步骤;a first triggering module, configured to: when the number of the executable download tasks does not exceed a preset number threshold, perform a step of establishing, on the server, a background thread that downloads the download file;第二触发模块,用于若所述可执行下载任务的数量超过预设的数量阈值,则计算各个所述可执行下载任务的优先级,然后根据优先级的先后顺序依次对各个所述可执行下载任务触发所述后台线程建立模块;a second triggering module, configured to calculate a priority of each of the executable download tasks if the number of the executable download tasks exceeds a preset number of thresholds, and then sequentially perform the executables according to the priority order The download task triggers the background thread creation module;所述后台线程建立模块具体包括:线程建立单元,用于在所述服务器上建立当前执行的所述可执行下载任务的后台线程。The background thread establishing module specifically includes: a thread establishing unit, configured to establish, on the server, a background thread of the currently executable executable download task.
- 根据权利要求7所述的下载请求处理装置,其特征在于,还包括:The download request processing apparatus according to claim 7, further comprising:第二可用内存量获取模块,用于在每建立一个所述后台线程之后,获取所述服务器当前可用的内存量;a second available memory quantity obtaining module, configured to acquire, after each of the background threads is established, an amount of memory currently available to the server;内存量判断模块,用于判断下一个执行的所述可执行下载任务的预计内存使用量是否超过所述当前可用的内存量;a memory amount determining module, configured to determine whether an estimated memory usage of the executable download task executed next time exceeds the currently available memory amount;返回触发模块,用于若所述内存量判断模块的判断结果为是,则返回触发所述可执行任务确定模块。Returning to the triggering module, if the judgment result of the memory amount determining module is yes, returning to trigger the executable task determining module.
- 根据权利要求7所述的下载请求处理装置,其特征在于,所述第二触发模块包括:The download request processing apparatus according to claim 7, wherein the second triggering module comprises:第一数值获取单元,用于获取所述可执行下载任务对应下载请求的第一重要性数值,所述第一重要性数值由所述终端在发起下载请求之前预先设定;a first value obtaining unit, configured to acquire a first importance value corresponding to the download request of the executable download task, where the first importance value is preset by the terminal before initiating a download request;第一优先值计算单元,用于根据所述第一重要性数值和预设的第一权重计算所述可执行下载任务的第一优先值;a first priority value calculation unit, configured to calculate a first priority value of the executable download task according to the first importance value and a preset first weight;第二优先值计算单元,用于根据所述可执行下载任务的预估消耗时长和预设的第二权重计算所述可执行下载任务的第二优先值;a second priority value calculation unit, configured to calculate a second priority value of the executable download task according to the estimated consumption duration of the executable download task and the preset second weight;优先级确定单元,用于根据各个所述可执行下载任务的第一优先值和第二优先值确定各个所述可执行下载任务的优先级,其中,第一优先值与所述优先级正相关,所述第二优先值与所述优先级负相关。a priority determining unit, configured to determine a priority of each of the executable download tasks according to a first priority value and a second priority value of each of the executable download tasks, wherein the first priority value is positively correlated with the priority The second priority value is negatively correlated with the priority.
- 根据权利要求6至9任一项所述的下载请求处理装置,其特征在于,还包括:The download request processing apparatus according to any one of claims 6 to 9, further comprising:执行时段设定模块,用于请求所述终端设定后台下载所述下载文件的执行时段;An execution period setting module, configured to request the terminal to set an execution period in which the download file is downloaded in the background;时段触发模块,用于若所述执行时段设定模块获取到所述终端设定的所述执行时段,则当所述服务器的当前系统时间到达所述执行时段时,触发所述后台线程建立模块。a period triggering module, configured to trigger the background thread establishing module when the current system time of the server reaches the execution period, if the execution period setting module acquires the execution period set by the terminal .
- 一种处理设备,其特征在于,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的下载请求处理程序,所述处理器执行所述下载请求处理程序时实现如下步骤:A processing device, comprising: a memory and a processor, wherein the memory stores a download request processing program executable on the processor, and the processor implements the following steps when executing the download request processing program :接收终端发起的下载请求;Receiving a download request initiated by the terminal;判断所述下载请求所需的下载文件的大小是否超过预设阈值;Determining whether the size of the download file required for the download request exceeds a preset threshold;若所述下载请求所需的下载文件的大小超过预设阈值,则释放服务器与所述终端之间的当前会话链接;If the size of the download file required for the download request exceeds a preset threshold, releasing a current session link between the server and the terminal;在所述服务器上建立下载所述下载文件的后台线程;Establishing a background thread for downloading the downloaded file on the server;通过所述后台线程下载并缓存所述下载文件;Downloading and caching the download file by the background thread;将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。Notifying the terminal that the downloaded message has been completed, so that the terminal re-establishes a new session link with the server and acquires the downloaded file in the cache.
- 根据权利要求11所述的处理设备,其特征在于,所述处理器执行所述下载请求处理程序时,还实现如下步骤:The processing device according to claim 11, wherein when the processor executes the download request processing program, the following steps are further implemented:根据所述下载请求新建对应的待处理的下载任务;Creating a corresponding download task to be processed according to the download request;获取所述服务器当前可用的内存量;Obtaining the amount of memory currently available to the server;确定所述待处理的下载任务中预计内存使用量小于或等于所述当前可用的内存量的下载任务为可执行下载任务;Determining that the download task in the to-be-processed download task that the estimated memory usage is less than or equal to the currently available memory amount is an executable download task;若所述可执行下载任务的数量未超过预设的数量阈值,则执行在所述服务器上建立下载所述下载文件的后台线程的步骤;If the number of the executable download tasks does not exceed a preset number threshold, performing a step of establishing a background thread for downloading the download file on the server;若所述可执行下载任务的数量超过预设的数量阈值,则计算各个所述可执行下载任务的优先级,然后根据优先级的先后顺序依次对各个所述可执行下载任务执行在所述服务器上建立下载所述下载文件的后台线程的步骤;If the number of the executable download tasks exceeds a preset number threshold, calculating a priority of each of the executable download tasks, and then sequentially executing the executable download tasks on the server according to a priority order Establishing a step of downloading a background thread of the downloaded file;在所述服务器上建立下载所述下载文件的后台线程具体包括:在所述服务器上建立当前执行的所述可执行下载任务的后台线程。Establishing a background thread for downloading the download file on the server specifically includes: establishing, on the server, a background thread of the currently executable executable download task.
- 根据权利要求12所述的处理设备,其特征在于,所述处理器执行所述下载请求处理程序时,还实现如下步骤:The processing device according to claim 12, wherein when the processor executes the download request processing program, the following steps are further implemented:在每建立一个所述后台线程之后,获取所述服务器当前可用的内存量;Obtaining the amount of memory currently available to the server after each of the background threads is established;判断下一个执行的所述可执行下载任务的预计内存使用量是否超过所述当前可用的内存量;Determining whether the estimated memory usage of the executable download task executed next time exceeds the currently available memory amount;若下一个执行的所述可执行下载任务的预计内存使用量超过所述当前可用的内存量,则返回执行确定所述待处理的下载任务中预计内存使用量小于或等于所述当前可用的内存量的下载任务为可执行下载任务的步骤。If the estimated memory usage of the executable download task that is executed next time exceeds the currently available memory amount, returning execution to determine that the expected memory usage in the to-be-processed download task is less than or equal to the currently available memory The amount of download tasks is the step of performing a download task.
- 根据权利要求12所述的处理设备,其特征在于,所述计算各个所述可执行下载任务的优先级包括:The processing device according to claim 12, wherein the calculating the priority of each of the executable download tasks comprises:获取所述可执行下载任务对应下载请求的第一重要性数值,所述第一重要性数值由所述终端在发起下载请求之前预先设定;Acquiring, by the executable download task, a first importance value corresponding to the download request, where the first importance value is preset by the terminal before initiating a download request;根据所述第一重要性数值和预设的第一权重计算所述可执行下载任务的第一优先值;Calculating a first priority value of the executable download task according to the first importance value and a preset first weight;根据所述可执行下载任务的预估消耗时长和预设的第二权重计算所述可执行下载任务的第二优先值;Calculating a second priority value of the executable download task according to the estimated consumption duration of the executable download task and the preset second weight;根据各个所述可执行下载任务的第一优先值和第二优先值确定各个所述可执行下载任务的优先级,其中,第一优先值与所述优先级正相关,所述第二优先值与所述优先级负相关。Determining a priority of each of the executable download tasks according to a first priority value and a second priority value of each of the executable download tasks, wherein the first priority value is positively correlated with the priority, and the second priority value Negatively related to the priority.
- 根据权利要求11至14任一项所述的处理设备,其特征在于,所述处理器执行所述下载请求处理程序时,还实现如下步骤:The processing device according to any one of claims 11 to 14, wherein when the processor executes the download request processing program, the following steps are further implemented:请求所述终端设定后台下载所述下载文件的执行时段;Requesting the terminal to set an execution period in which the download file is downloaded in the background;在所述服务器上建立下载所述下载文件的后台线程之前,所述处理器执行所述下载请求处理程序时,还实现如下步骤:Before the background thread for downloading the download file is established on the server, when the processor executes the download request processing program, the following steps are further implemented:若获取到所述终端设定的所述执行时段,则当所述服务器的当前系统时间到达所述执行时段时,执行在所述服务器上建立下载所述下载文件的后台线程的步骤。If the execution period set by the terminal is obtained, when the current system time of the server reaches the execution period, a step of establishing a background thread for downloading the download file on the server is performed.
- 一种计算机可读存储介质,所述计算机可读存储介质存储有下载请求处理程序,其特征在于,所述下载请求处理程序被至少一个处理器执行时实现如下步骤:A computer readable storage medium storing a download request processing program, wherein the download request processing program is executed by at least one processor to implement the following steps:接收终端发起的下载请求;Receiving a download request initiated by the terminal;判断所述下载请求所需的下载文件的大小是否超过预设阈值;Determining whether the size of the download file required for the download request exceeds a preset threshold;若所述下载请求所需的下载文件的大小超过预设阈值,则释放服务器与所述终端之间的当前会话链接;If the size of the download file required for the download request exceeds a preset threshold, releasing a current session link between the server and the terminal;在所述服务器上建立下载所述下载文件的后台线程;Establishing a background thread for downloading the downloaded file on the server;通过所述后台线程下载并缓存所述下载文件;Downloading and caching the download file by the background thread;将已下载完成的消息通知给所述终端,以使所述终端重新建立与所述服务器之间的新的会话链接并获取所述缓存中的所述下载文件。Notifying the terminal that the downloaded message has been completed, so that the terminal re-establishes a new session link with the server and acquires the downloaded file in the cache.
- 根据权利要求16所述的计算机可读存储介质,其特征在于,所述下载请求处理程序被至少一个处理器执行时,还实现如下步骤:The computer readable storage medium according to claim 16, wherein when said download request processing program is executed by at least one processor, the following steps are further implemented:根据所述下载请求新建对应的待处理的下载任务;Creating a corresponding download task to be processed according to the download request;获取所述服务器当前可用的内存量;Obtaining the amount of memory currently available to the server;确定所述待处理的下载任务中预计内存使用量小于或等于所述当前可用的内存量的下载任务为可执行下载任务;Determining that the download task in the to-be-processed download task that the estimated memory usage is less than or equal to the currently available memory amount is an executable download task;若所述可执行下载任务的数量未超过预设的数量阈值,则执行在所述服务器上建立下载所述下载文件的后台线程的步骤;If the number of the executable download tasks does not exceed a preset number threshold, performing a step of establishing a background thread for downloading the download file on the server;若所述可执行下载任务的数量超过预设的数量阈值,则计算各个所述可执行下载任务的优先级,然后根据优先级的先后顺序依次对各个所述可执行下载任务执行在所述服务器上建立下载所述下载文件的后台线程的步骤;If the number of the executable download tasks exceeds a preset number threshold, calculating a priority of each of the executable download tasks, and then sequentially executing the executable download tasks on the server according to a priority order Establishing a step of downloading a background thread of the downloaded file;在所述服务器上建立下载所述下载文件的后台线程具体包括:在所述服务器上建立当前执行的所述可执行下载任务的后台线程。Establishing a background thread for downloading the download file on the server specifically includes: establishing, on the server, a background thread of the currently executable executable download task.
- 根据权利要求17所述的计算机可读存储介质,其特征在于,所述下载请求处理程序被至少一个处理器执行时,还实现如下步骤:The computer readable storage medium according to claim 17, wherein when said download request processing program is executed by at least one processor, the following steps are further implemented:在每建立一个所述后台线程之后,获取所述服务器当前可用的内存量;Obtaining the amount of memory currently available to the server after each of the background threads is established;判断下一个执行的所述可执行下载任务的预计内存使用量是否超过所述当前可用的内存量;Determining whether the estimated memory usage of the executable download task executed next time exceeds the currently available memory amount;若下一个执行的所述可执行下载任务的预计内存使用量超过所述当前可用的内存量,则返回执行确定所述待处理的下载任务中预计内存使用量小于或等于所述当前可用的内存量的下载任务为可执行下载任务的步骤。If the estimated memory usage of the executable download task that is executed next time exceeds the currently available memory amount, returning execution to determine that the expected memory usage in the to-be-processed download task is less than or equal to the currently available memory The amount of download tasks is the step of performing a download task.
- 根据权利要求17所述的计算机可读存储介质,其特征在于,所述计算各个所述可执行下载任务的优先级包括:The computer readable storage medium of claim 17, wherein the calculating the priority of each of the executable download tasks comprises:获取所述可执行下载任务对应下载请求的第一重要性数值,所述第一重要性数值由所述终端在发起下载请求之前预先设定;Acquiring, by the executable download task, a first importance value corresponding to the download request, where the first importance value is preset by the terminal before initiating a download request;根据所述第一重要性数值和预设的第一权重计算所述可执行下载任务的第一优先值;Calculating a first priority value of the executable download task according to the first importance value and a preset first weight;根据所述可执行下载任务的预估消耗时长和预设的第二权重计算所述可执行下载任务的第二优先值;Calculating a second priority value of the executable download task according to the estimated consumption duration of the executable download task and the preset second weight;根据各个所述可执行下载任务的第一优先值和第二优先值确定各个所述可执行下载任务的优先级,其中,第一优先值与所述优先级正相关,所述第二优先值与所述优先级负相关。Determining a priority of each of the executable download tasks according to a first priority value and a second priority value of each of the executable download tasks, wherein the first priority value is positively correlated with the priority, and the second priority value Negatively related to the priority.
- 根据权利要求16至19任一项所述的计算机可读存储介质,其特征在于,所述下载请求处理程序被至少一个处理器执行时,还实现如下步骤:The computer readable storage medium according to any one of claims 16 to 19, wherein when the download request processing program is executed by at least one processor, the following steps are further implemented:请求所述终端设定后台下载所述下载文件的执行时段;Requesting the terminal to set an execution period in which the download file is downloaded in the background;在所述服务器上建立下载所述下载文件的后台线程之前,所述下载请求处理程序被至少一个处理器执行时,还实现如下步骤:Before the background thread for downloading the download file is established on the server, when the download request processing program is executed by at least one processor, the following steps are further implemented:若获取到所述终端设定的所述执行时段,则当所述服务器的当前系统时间到达所述执行时段时,执行在所述服务器上建立下载所述下载文件的后台线程的步骤。If the execution period set by the terminal is obtained, when the current system time of the server reaches the execution period, a step of establishing a background thread for downloading the download file on the server is performed.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710282796.8A CN107689979B (en) | 2017-04-26 | 2017-04-26 | method and equipment for processing download request |
CN201710282796.8 | 2017-04-26 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2018196459A1 true WO2018196459A1 (en) | 2018-11-01 |
Family
ID=61152386
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/074877 WO2018196459A1 (en) | 2017-04-26 | 2018-01-31 | Download request processing method and apparatus, processing device and medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN107689979B (en) |
WO (1) | WO2018196459A1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110633133A (en) * | 2018-06-21 | 2019-12-31 | 中兴通讯股份有限公司 | Task processing method and device and computer readable storage medium |
CN114157655A (en) * | 2021-11-26 | 2022-03-08 | 杭州安恒信息安全技术有限公司 | Task downloading method, system, computer equipment and readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102368213A (en) * | 2011-09-26 | 2012-03-07 | 奇智软件(北京)有限公司 | Page downloading control method and system for IE (Internet Explorer) core browser |
CN105847118A (en) * | 2016-04-01 | 2016-08-10 | 乐视控股(北京)有限公司 | Method and device of sending mails with big attachments, and intelligent terminal |
CN106445665A (en) * | 2016-09-19 | 2017-02-22 | 武汉斗鱼网络科技有限公司 | Method and tool for system file downloading applied to android system |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101420389A (en) * | 2007-10-25 | 2009-04-29 | 中兴通讯股份有限公司 | File transferring system and method |
CN101873355A (en) * | 2010-06-28 | 2010-10-27 | 深圳市迅雷网络技术有限公司 | Method, device and system for downloading file |
CN103634386A (en) * | 2013-11-22 | 2014-03-12 | 北京奇虎科技有限公司 | Method and device for downloading application by client end application program |
CN105263181B (en) * | 2015-09-14 | 2019-03-26 | Tcl移动通信科技(宁波)有限公司 | A kind of document down loading method and system of the mobile terminal based on WIFI |
CN106250061A (en) * | 2016-08-12 | 2016-12-21 | 乐视控股(北京)有限公司 | File download processing method and processing device |
-
2017
- 2017-04-26 CN CN201710282796.8A patent/CN107689979B/en active Active
-
2018
- 2018-01-31 WO PCT/CN2018/074877 patent/WO2018196459A1/en active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102368213A (en) * | 2011-09-26 | 2012-03-07 | 奇智软件(北京)有限公司 | Page downloading control method and system for IE (Internet Explorer) core browser |
CN105847118A (en) * | 2016-04-01 | 2016-08-10 | 乐视控股(北京)有限公司 | Method and device of sending mails with big attachments, and intelligent terminal |
CN106445665A (en) * | 2016-09-19 | 2017-02-22 | 武汉斗鱼网络科技有限公司 | Method and tool for system file downloading applied to android system |
Also Published As
Publication number | Publication date |
---|---|
CN107689979B (en) | 2019-12-13 |
CN107689979A (en) | 2018-02-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9823947B2 (en) | Method and system for allocating FPGA resources | |
EP3612942B1 (en) | Queue management for direct memory access | |
US9665404B2 (en) | Optimization of map-reduce shuffle performance through shuffler I/O pipeline actions and planning | |
US10789085B2 (en) | Selectively providing virtual machine through actual measurement of efficiency of power usage | |
WO2019114128A1 (en) | Block chain transaction block processing method, electronic device and readable storage medium | |
US10248175B2 (en) | Off-line affinity-aware parallel zeroing of memory in non-uniform memory access (NUMA) servers | |
JP5744707B2 (en) | Computer-implemented method, computer program, and system for memory usage query governor (memory usage query governor) | |
US8639809B2 (en) | Predictive removal of runtime data using attribute characterizing | |
WO2017016421A1 (en) | Method of executing tasks in a cluster and device utilizing same | |
US11018965B1 (en) | Serverless function scaling | |
WO2018058998A1 (en) | Data loading method, terminal and computing cluster | |
US8583608B2 (en) | Maximum allowable runtime query governor | |
WO2018107945A1 (en) | Method and device for implementing allocation of hardware resources, and storage medium | |
CN111753065A (en) | Request response method, system, computer system and readable storage medium | |
WO2017185615A1 (en) | Method for determining service status of service processing device and scheduling device | |
CN103873587A (en) | Method and device for achieving dispatching based on cloud platform | |
US20240187351A1 (en) | Stream allocation using stream credits | |
WO2018196459A1 (en) | Download request processing method and apparatus, processing device and medium | |
WO2017096787A1 (en) | Picture processing method and device | |
US11005776B2 (en) | Resource allocation using restore credits | |
US10616317B2 (en) | Method and system for affinity load balancing | |
CN118170528A (en) | Workload class for tenant-level resource isolation | |
CN116069789A (en) | Data query method and device and computer readable storage medium | |
Liu et al. | A pushlet system optimization method based on Servlet |
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: 18792296 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 20.01.2020) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 18792296 Country of ref document: EP Kind code of ref document: A1 |