CN110784520A - File downloading method and device and electronic equipment - Google Patents

File downloading method and device and electronic equipment Download PDF

Info

Publication number
CN110784520A
CN110784520A CN201910940697.3A CN201910940697A CN110784520A CN 110784520 A CN110784520 A CN 110784520A CN 201910940697 A CN201910940697 A CN 201910940697A CN 110784520 A CN110784520 A CN 110784520A
Authority
CN
China
Prior art keywords
downloading
file
data
subtask
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910940697.3A
Other languages
Chinese (zh)
Inventor
赵元
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201910940697.3A priority Critical patent/CN110784520A/en
Publication of CN110784520A publication Critical patent/CN110784520A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • H04L67/108Resource delivery mechanisms characterised by resources being split in blocks or fragments

Abstract

The embodiment of the disclosure provides a file downloading method, a file downloading device and electronic equipment, belonging to the technical field of data processing, wherein the method comprises the following steps: initiating a file downloading request to a first data node, wherein the file downloading request comprises a file identifier of a target file requested to be downloaded; receiving the total volume of the target file returned by the first data node based on the file identification; judging whether the total volume of the target files is smaller than or equal to a first threshold value or not; if the total volume of the target files is smaller than or equal to a first threshold value, receiving the target files returned by the first data node; and if the total volume of the target file is larger than the first threshold value, downloading the fragment data of the target file in parallel, and synthesizing to obtain the target file. According to the scheme disclosed by the invention, the optional downloading mode aiming at the files with different volumes is provided, the file downloading speed is improved, and the time consumed for the terminal to download the files to the data node is shortened.

Description

File downloading method and device and electronic equipment
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a file downloading method and apparatus, and an electronic device.
Background
And establishing a single link between the terminal and the data node, and requesting the data node to download the file. However, the existing data node limits the downloading speed of the terminal to be low, which results in that the time for the terminal to download the file to the data node through the single link is long.
Therefore, the existing terminal has the technical problem that time consumption for downloading files to the data node through the single link is long.
Disclosure of Invention
In view of this, embodiments of the present disclosure provide a file downloading method, device and electronic device, which at least partially solve the problems in the prior art.
In a first aspect, an embodiment of the present disclosure provides a file downloading method, where the method includes:
initiating a file downloading request to a first data node, wherein the file downloading request comprises a file identifier of a target file requested to be downloaded;
receiving the total volume of the target file returned by the first data node based on the file identification;
judging whether the total volume of the target files is smaller than or equal to a first threshold value or not;
if the total volume of the target file is smaller than or equal to the first threshold value, receiving the target file returned by the first data node;
and if the total volume of the target file is larger than the first threshold value, downloading the fragment data of the target file in parallel, and synthesizing to obtain the target file.
According to a specific implementation manner of the embodiment of the present disclosure, the step of downloading the fragmented data of the target file in parallel includes:
dividing a downloading task corresponding to the target file into N subtasks for downloading the fragment data of the target file according to the total volume of the target file, wherein N is a positive integer greater than 1;
and requesting to download the corresponding fragment data from the N data nodes.
According to a specific implementation manner of the embodiment of the present disclosure, the step of requesting the N data nodes to download the corresponding fragment data includes:
requesting to download the corresponding fragment data from the first data node, and requesting to download the corresponding fragment data from (N-1) second data nodes;
wherein the first data node and the second data node are different data nodes.
According to a specific implementation manner of the embodiment of the present disclosure, after the step of requesting the N data nodes to download the corresponding fragment data, the method further includes:
determining a first target data node corresponding to a first subtask of which the downloading state meets a preset condition, and determining that the downloading state is a second subtask which is not downloaded;
dividing a third subtask which is not downloaded and is completed from the second subtask;
and requesting the first target node to download the fragment data corresponding to the third subtask.
According to a specific implementation manner of the embodiment of the present disclosure, the step of dividing a third subtask that is not completely downloaded from the second subtask and requesting the first target node to download the fragment data corresponding to the third subtask includes:
judging whether the volume of the fragmented data which is not downloaded in the second subtask exceeds a second threshold value;
if the volume of the fragmented data which is not downloaded in the second subtask is larger than or equal to a second threshold, executing a third subtask which is not downloaded in the second subtask, and requesting the first target node to download the fragmented data corresponding to the third subtask;
and if the volume of the fragment data which is not downloaded completely in the second subtask is smaller than a second threshold value, continuing to download the fragment data which is not downloaded completely in the second subtask to a second target data node corresponding to the second subtask.
According to a specific implementation manner of the embodiment of the present disclosure, the step of determining a first target data node corresponding to a first subtask whose download state satisfies a first preset condition includes:
and determining that the data node corresponding to the subtask with the downloading state being the downloading completion state is the first target data node.
According to a specific implementation manner of the embodiment of the present disclosure, the step of determining that the data node corresponding to the subtask whose download state is the download complete state is the first target data node includes:
and determining the data node corresponding to the subtask of which the downloading state is the downloading completion state and the downloading speed is greater than or equal to a third threshold value as the first target data node.
According to a specific implementation manner of the embodiment of the present disclosure, the step of determining that the download status is the second subtask that is not completed by downloading includes:
and determining that the downloading state is not finished and the subtask with the downloading speed less than or equal to a fourth threshold value is the second subtask.
According to a specific implementation manner of the embodiment of the present disclosure, after the step of requesting the N data nodes to download the corresponding fragment data, the method further includes:
and before the downloading of all the fragment data of the target file is completed, maintaining the links with all the data nodes until all the fragment data are downloaded.
According to a specific implementation manner of the embodiment of the present disclosure, after the steps of determining the first target data node corresponding to the first subtask whose download state satisfies the first preset condition and determining that the download state is the second subtask whose download is not completed, the method further includes:
and maintaining the link with the first target data node until the downloading of all the fragment data is completed.
In a second aspect, an embodiment of the present disclosure provides a file downloading apparatus, including:
the request module is used for initiating a file downloading request to a first data node, wherein the file downloading request comprises a file identifier of a target file requested to be downloaded;
a receiving module, configured to receive a total volume of the target file returned by the first data node based on the file identifier;
the judging module is used for judging whether the total volume of the target files is smaller than or equal to a first threshold value or not;
a first downloading module, configured to receive the target file returned by the first data node if the total volume of the target file is less than or equal to the first threshold;
and the second downloading module is used for downloading the fragment data of the target file in parallel and synthesizing to obtain the target file if the total volume of the target file is greater than the first threshold value.
In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the file download method of any of the preceding first aspect or any implementation of the first aspect.
In a fourth aspect, the disclosed embodiments also provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the file downloading method in the first aspect or any implementation manner of the first aspect.
In a fifth aspect, the disclosed embodiments also provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions that, when executed by a computer, cause the computer to perform the file downloading method in the foregoing first aspect or any implementation manner of the first aspect.
The file downloading scheme in the embodiment of the disclosure comprises initiating a file downloading request to a first data node, wherein the file downloading request comprises a file identifier of a target file requested to be downloaded; receiving the total volume of the target file returned by the first data node based on the file identification; judging whether the total volume of the target files is smaller than or equal to a first threshold value or not; if the total volume of the target file is smaller than or equal to the first threshold value, receiving the target file returned by the first data node; and if the total volume of the target file is larger than the first threshold value, downloading the fragment data of the target file in parallel, and synthesizing to obtain the target file. According to the scheme, the selectable downloading mode for the files with different volumes is provided, the file downloading speed is improved, and the time consumed for the terminal to download the files to the data node is shortened.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings needed to be used in the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a file downloading method according to an embodiment of the present disclosure;
fig. 2 is a partial schematic flow chart of another file downloading method provided in the embodiment of the present disclosure;
fig. 3 is a schematic diagram of a file downloading device according to an embodiment of the disclosure;
fig. 4 is a schematic view of an electronic device according to an embodiment of the disclosure.
Detailed Description
The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
The embodiments of the present disclosure are described below with specific examples, and other advantages and effects of the present disclosure will be readily apparent to those skilled in the art from the disclosure in the specification. It is to be understood that the described embodiments are merely illustrative of some, and not restrictive, of the embodiments of the disclosure. The disclosure may be embodied or carried out in various other specific embodiments, and various modifications and changes may be made in the details within the description without departing from the spirit of the disclosure. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
It is noted that various aspects of the embodiments are described below within the scope of the appended claims. It should be apparent that the aspects described herein may be embodied in a wide variety of forms and that any specific structure and/or function described herein is merely illustrative. Based on the disclosure, one skilled in the art should appreciate that one aspect described herein may be implemented independently of any other aspects and that two or more of these aspects may be combined in various ways. For example, an apparatus may be implemented and/or a method practiced using any number of the aspects set forth herein. Additionally, such an apparatus may be implemented and/or such a method may be practiced using other structure and/or functionality in addition to one or more of the aspects set forth herein.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present disclosure, and the drawings only show the components related to the present disclosure rather than the number, shape and size of the components in actual implementation, and the type, amount and ratio of the components in actual implementation may be changed arbitrarily, and the layout of the components may be more complicated.
In addition, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects may be practiced without these specific details.
The embodiment of the disclosure provides a file downloading method. The file downloading method provided by the embodiment can be executed by a computing device, the computing device can be implemented as software, or implemented as a combination of software and hardware, and the computing device can be integrated in a terminal device and the like.
Referring to fig. 1, a file downloading method provided by the embodiment of the present disclosure includes:
s101, a file downloading request is sent to a first data node, wherein the file downloading request comprises a file identifier of a target file requested to be downloaded.
The file downloading method provided by the embodiment of the disclosure is applied to a terminal (electronic equipment). The terminal can establish a link with at least one data node and request the data node to download the relevant data of the file. The file which the terminal needs to download is defined as a target file, a data node which is firstly linked by the terminal before the target file is downloaded is defined as a first data node, and a download request initiated by the terminal to the first data node is defined as a file download request.
Specifically, the file downloading request initiated by the terminal includes a file identifier of the target file requested to be downloaded, so that the first data node searches the target file according to the file identifier of the target file. The file identifier may include, but is not limited to, a subject name of the file, a data source identifier of the file, and the like.
S102, receiving the total volume of the target file returned by the first data node based on the file identification.
After the terminal initiates a file downloading request to the first data node, the first data node may search the target file according to the identifier of the target file included in the file downloading request to obtain the target file and attribute information thereof, where the attribute information of the target file may include a total volume of the target file, data source information, and the like. The first data node firstly returns the total volume of the target file to the terminal so that the terminal can obtain the size of the target file requested to be downloaded.
In a specific implementation, the first data node returns the total file volume in its Response message Header according to a standard protocol, such as HTTP/HTTPs protocol, and then sends the Response message Body. It should be noted that the present solution is directed to a common request method capable of searching and returning the total volume of the file. For a request that a part cannot search or return the total volume of the file, such as a chunked request, other schemes for assisting in searching the total volume of the file may be used in combination.
S103, judging whether the total volume of the target file is smaller than or equal to a first threshold value.
And after the terminal receives the total volume of the target file, determining the downloading mode applicable to the target file. In order to make full use of the terminal bandwidth and the data node link, at least two downloading modes are preset in the terminal, including: a single-link download mode and a multi-link parallel download mode. The single link downloading is to download all data of the file directly through the data nodes with links established currently, and the downloading mode is suitable for downloading tasks with smaller total volume of the file; the multi-link parallel downloading mode is to divide the file downloading task into a plurality of subtasks, each subtask is used for downloading part of fragment data of the file, and all data of the file is obtained by downloading the fragment data in parallel, and the mode is suitable for the downloading task with larger file total volume.
The method comprises the steps of determining a critical value of the file volume applicable to a single-link downloading mode and a multi-link downloading mode, and presetting a first threshold value corresponding to the file volume in the terminal, wherein the first threshold value can be approximately equal to the critical value of the file volume used by the two downloading modes. After obtaining the total volume of the target file, the terminal judges the size relation between the total volume of the target file and the first threshold value, and then selects a file downloading mode suitable for high efficiency.
And S104, if the total volume of the target file is less than or equal to the first threshold value, receiving the target file returned by the first data node.
And if the terminal judges that the total volume of the target file is smaller than or equal to the first threshold value, determining that the total volume of the target file is smaller, and adapting to a single-link downloading mode.
And the terminal keeps a link with the first data node and directly acquires all data of the target file from the first data node. Thus, the complete target file can be obtained. Therefore, the operation of initiating a request and establishing a link with multiple data nodes can be saved, the first link is fully utilized, and the file downloading efficiency is improved.
S105, if the total volume of the target file is larger than the first threshold value, downloading the fragment data of the target file in parallel, and synthesizing to obtain the target file.
And if the terminal judges that the total volume of the target file is larger than the first threshold value, determining that the total volume of the target file is larger, and the time consumption of a single-link downloading mode is longer, so that a multi-link parallel downloading mode can be selected to improve the file downloading efficiency. And the terminal downloads a plurality of fragment data of the target file in parallel to synthesize the target file. Therefore, the bandwidth of the terminal can be fully utilized, fragment data are downloaded in parallel through the link with multiple data nodes, the total time consumption of file downloading is shortened, and the file downloading efficiency is improved.
During specific implementation, the terminal may equally or unequally divide the downloading task of the target file into a plurality of subtasks according to the current bandwidth and the number of data nodes capable of establishing links, and download the fragment data corresponding to one or more subtasks through each data node. Therefore, after the terminal acquires all the fragment data of the target file, the target file can be obtained by synthesis according to the division sequence of the subtasks or the relevance between the fragment data.
According to the file downloading method provided by the embodiment of the disclosure, the corresponding file downloading mode is determined by acquiring the total volume of the target file to be downloaded, and the selection diversity and the applicability of the file downloading mode are improved. When the total volume of the target file is smaller than or equal to the first threshold value, a single link downloading mode is selected, the operation of initiating a request and establishing a link with multiple data nodes is saved, the first link is fully utilized, and the file downloading efficiency is improved. When the total volume of the target file is larger than the first threshold value, the fragment data is downloaded in parallel through the links with the multiple data nodes, so that the bandwidth of the terminal can be fully utilized, the total time consumption of file downloading is shortened, and the file downloading efficiency is improved.
In a specific embodiment, the parallel downloading of the fragmented data of the target file in step S105 may include:
dividing a downloading task corresponding to the target file into N subtasks for downloading the fragment data of the target file according to the total volume of the target file, wherein N is a positive integer greater than 1;
and requesting to download the corresponding fragment data from the N data nodes.
In this embodiment, the terminal further defines a manner of downloading the sliced data in parallel. Specifically, the terminal divides the downloading task into N subtasks according to the total volume of the target file, and each subtask is used for indicating the terminal to request a data node to download the corresponding fragment data. And the terminal establishes links to the plurality of data nodes and downloads the fragment data corresponding to the plurality of subtasks in parallel to obtain all data of the target file and performs sequencing synthesis, namely the downloading operation of the target file is completed.
Optionally, the step of requesting the N data nodes to download the corresponding fragment data includes:
requesting to download the corresponding fragment data from the first data node, and requesting to download the corresponding fragment data from (N-1) second data nodes;
wherein the first data node and the second data node are different data nodes.
In this embodiment, it is further limited that, in the process of executing the parallel downloading of the fragment data, the terminal downloads the corresponding fragment data to the first data node that previously initiated the file downloading request, and requests other (N-1) second data nodes to download other fragment data. It should be noted that, the (N-1) second data nodes mentioned herein are not intended to refer to the same data node, but are merely intended to refer to other data nodes different from the first data node.
Therefore, the terminal can make full use of the first request and the established link, the request waste is avoided, and the file downloading efficiency is further improved.
In another specific embodiment, as shown in fig. 2, after the step of requesting the N data nodes to download the corresponding sliced data, the method may further include:
s201, determining a first target data node corresponding to a first subtask of which the downloading state meets a preset condition, and determining that the downloading state is a second subtask which is not downloaded;
in this embodiment, at a certain time after the terminal starts to request the N data nodes to download the corresponding segment data, a reuse operation for part of the high-quality links is added. Specifically, the terminal is internally provided with a preset condition for screening the high-quality links, and the preset condition may include: the download completion proportion exceeds a preset proportion, all the fragment data corresponding to the distributed subtasks are downloaded completely, the download speed exceeds a preset speed and the like, the completion state of the subtasks meeting the preset condition is better, and the link for realizing the subtasks is defined as a high-quality link.
And the terminal screens out the subtasks with the downloading states meeting the preset conditions according to the current downloading states of all the subtasks, defines the subtasks as first subtasks, and defines the data nodes corresponding to the first subtasks as first target data nodes. In addition, the terminal screens out the subtask with the downloading state of incomplete downloading, and the subtask is defined as a second subtask.
Optionally, in specific implementation, the terminal may determine that the data node corresponding to the subtask whose download state is the download complete state is the first target data node.
Therefore, at a certain moment, the data nodes corresponding to the downloaded subtasks are screened out, and the link between the terminal and the partial data nodes is utilized to assist in downloading other residual fragment data which are not downloaded.
Further, the terminal may further determine that the data node corresponding to the subtask whose downloading state is the downloading completion state and whose downloading speed exceeds the third threshold is the first target data node.
And the data node corresponding to the subtask with the downloading state of being completed and the downloading speed exceeding the third threshold is the first target data node, so that the efficiency is higher and the time consumption is shorter when the screened high-quality link executes the auxiliary downloading operation.
In addition, the terminal may further determine that the downloading state is incomplete, and the sub-task with the downloading speed less than or equal to a fourth threshold is the second sub-task.
When a second subtask requiring auxiliary downloading is screened, the subtask with the downloading state of incomplete downloading and the downloading speed being low can be selected, and an auxiliary downloading scheme does not need to be added for a part of subtask with high downloading speed but not complete downloading possibly due to more fragment data.
S202, dividing an unfinished third subtask from the second subtask;
s203, requesting the first target node to download the fragment data corresponding to the third subtask.
And the terminal screens out the first target data node corresponding to the high-quality link and the second subtask which is not downloaded completely according to the steps, and divides partial subtasks which are not downloaded completely from the second subtask to define the partial subtasks as a third subtask. And the terminal requests the first target node to download the fragment data corresponding to the third subtask, so that the full utilization of the high-quality link can be realized.
It should be noted that the third subtask may be a task that is not completely downloaded or a task that is partially not completely downloaded at the current time of the second subtask. Optionally, the third subtask is a task in which a part of the second subtask at the current time is not downloaded completely, and two links are used to assist downloading at the same time, so that file downloading efficiency can be further improved, and total time consumption can be reduced.
Further, the step of dividing an uncompleted third subtask from the second subtask and requesting the first target node to download the fragment data corresponding to the third subtask, in steps S202 and S203, may include:
judging whether the volume of the fragmented data which is not downloaded in the second subtask is larger than or equal to a second threshold value;
if the volume of the fragment data which is not downloaded completely in the second subtask is larger than or equal to a second threshold value, an operation of dividing an uncompleted third subtask from the second subtask and requesting the first target node to download the fragment data corresponding to the third subtask is executed;
and if the volume of the fragment data which is not downloaded completely in the second subtask is smaller than a second threshold value, continuing to download the fragment data which is not downloaded completely in the second subtask to a second target data node corresponding to the second subtask.
In this embodiment, the division process of the download task is further limited, that is, the auxiliary download is performed only for the subtasks with more remaining incomplete download fragment data. A second threshold value is preset in the terminal, the second threshold value may be a partial volume of the second subtask, and the second threshold value may be smaller than or equal to the first threshold value. And after screening out a second subtask of which the downloading state is incomplete, the terminal judges whether the volume of the fragmented data which is incomplete in downloading in the second subtask exceeds a second threshold value.
If the volume of the remaining unfired fragment data is greater than or equal to the second threshold, it is determined that the remaining unfired fragment data is more, and the download needs to be assisted by using a high-quality link. If the volume of the remaining unsubmerged fragment data is smaller than the second threshold, determining that the remaining unsubmerged fragment data is less, and not needing to transfer to other links for auxiliary downloading. And selecting an adaptive downloading mode according to the volume of the residual un-downloaded fragment data of the subtask, thereby further improving the downloading efficiency.
In other embodiments of the disclosed embodiments, the terminal is additionally provided with a mode for assisting in executing other subtasks by maintaining the link, so as to reduce request waste and link establishment operation. Specifically, there are two embodiments:
firstly, the terminal maintains the link with all the data nodes until all the fragment data of the target file are downloaded.
And secondly, the terminal maintains the link with the first target data node until the fragment data corresponding to the third subtask is downloaded.
It is contemplated that some of the premium links may also be used to assist in performing other subtasks that have not yet been downloaded after the current subtask has been performed. And establishing a link between the terminal and the multiple data nodes, and if the downloading of the current subtask is completed, only finishing the downloading operation aiming at the link of all the data nodes or only aiming at part of the high-quality links, and not disconnecting the link to prepare for auxiliary downloading of other fragment data until the link with all the data nodes is disconnected after the downloading of all the fragment data is completed.
In summary, the file downloading method provided by the embodiments of the present disclosure and the related embodiments described above improves the selection diversity and applicability of the file downloading method, can fully utilize the bandwidth of the terminal, shorten the total time consumption for downloading the file, and improve the file downloading efficiency.
Corresponding to the above method embodiment, referring to fig. 3, the disclosed embodiment further provides a file downloading device 30, including:
a request module 301, configured to initiate a file download request to a first data node, where the file download request includes a file identifier of a target file requested to be downloaded;
a receiving module 302, configured to receive a total volume of the target file returned by the first data node based on the file identifier;
a judging module 303, configured to judge whether the total volume of the target files is less than or equal to a first threshold;
a first downloading module 304, configured to receive the target file returned by the first data node if the total volume of the target file is less than or equal to the first threshold;
a second downloading module 305, configured to download the fragmented data of the target file in parallel and synthesize the target file if the total volume of the target file is greater than the first threshold.
The apparatus shown in fig. 3 may correspondingly execute the content in the above method embodiment, and details of the part not described in detail in this embodiment refer to the content described in the above method embodiment, which is not described again here.
Referring to fig. 4, an embodiment of the present disclosure also provides an electronic device 40, where the electronic device 40 may include:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the file download method of the foregoing method embodiments.
The disclosed embodiments also provide a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the file downloading method in the foregoing method embodiments.
The disclosed embodiments also provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, cause the computer to perform the method of the aforementioned method embodiments.
Referring now to FIG. 4, a block diagram of an electronic device 40 suitable for use in implementing embodiments of the present disclosure is shown. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, the electronic device 40 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 401 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage means 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the electronic apparatus 40 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 404 including, for example, a touch screen, touch pad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 40 to communicate wirelessly or by wire with other devices to exchange data. While the figures illustrate an electronic device 40 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 401.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring at least two internet protocol addresses; sending a node evaluation request comprising the at least two internet protocol addresses to node evaluation equipment, wherein the node evaluation equipment selects the internet protocol addresses from the at least two internet protocol addresses and returns the internet protocol addresses; receiving an internet protocol address returned by the node evaluation equipment; wherein the obtained internet protocol address indicates an edge node in the content distribution network.
Alternatively, the computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a node evaluation request comprising at least two internet protocol addresses; selecting an internet protocol address from the at least two internet protocol addresses; returning the selected internet protocol address; wherein the received internet protocol address indicates an edge node in the content distribution network.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
It should be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof.
The above description is only for the specific embodiments of the present disclosure, but the scope of the present disclosure is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present disclosure should be covered within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (13)

1. A method for downloading a file, the method comprising:
initiating a file downloading request to a first data node, wherein the file downloading request comprises a file identifier of a target file requested to be downloaded;
receiving the total volume of the target file returned by the first data node based on the file identification;
judging whether the total volume of the target files is smaller than or equal to a first threshold value or not;
if the total volume of the target file is smaller than or equal to the first threshold value, receiving the target file returned by the first data node;
and if the total volume of the target file is larger than the first threshold value, downloading the fragment data of the target file in parallel, and synthesizing to obtain the target file.
2. The method of claim 1, wherein the step of downloading the fragmented data of the target file in parallel comprises:
dividing a downloading task corresponding to the target file into N subtasks for downloading the fragment data of the target file according to the total volume of the target file, wherein N is a positive integer greater than 1;
and requesting to download the corresponding fragment data from the N data nodes.
3. The method according to claim 2, wherein the step of requesting the N data nodes to download the corresponding fragmented data comprises:
requesting to download the corresponding fragment data from the first data node, and requesting to download the corresponding fragment data from (N-1) second data nodes;
wherein the first data node and the second data node are different data nodes.
4. The method according to claim 2 or 3, wherein after the step of requesting the N data nodes to download the corresponding sliced data, the method further comprises:
determining a first target data node corresponding to a first subtask of which the downloading state meets a preset condition, and determining that the downloading state is a second subtask which is not downloaded;
dividing a third subtask which is not downloaded and is completed from the second subtask;
and requesting the first target node to download the fragment data corresponding to the third subtask.
5. The method according to claim 4, wherein the step of dividing a third subtask that is not completely downloaded from the second subtask, and requesting the first target node to download the fragment data corresponding to the third subtask comprises:
judging whether the volume of the fragmented data which is not downloaded in the second subtask is larger than or equal to a second threshold value;
if the volume of the fragmented data which is not downloaded in the second subtask is larger than or equal to a second threshold, executing a third subtask which is not downloaded in the second subtask, and requesting the first target node to download the fragmented data corresponding to the third subtask;
and if the volume of the fragment data which is not downloaded completely in the second subtask is smaller than a second threshold value, continuing to download the fragment data which is not downloaded completely in the second subtask to a second target data node corresponding to the second subtask.
6. The method according to claim 5, wherein the step of determining the first target data node corresponding to the first subtask whose download status satisfies the first preset condition includes:
and determining that the data node corresponding to the subtask with the downloading state being the downloading completion state is the first target data node.
7. The method according to claim 6, wherein the step of determining that the data node corresponding to the subtask whose download status is the download complete status is the first target data node comprises:
and determining the data node corresponding to the subtask of which the downloading state is the downloading completion state and the downloading speed is greater than or equal to a third threshold value as the first target data node.
8. The method of claim 5, wherein the step of determining that the download status is the second subtask that is not completed by downloading comprises:
and determining that the downloading state is not finished and the subtask with the downloading speed less than or equal to a fourth threshold value is the second subtask.
9. The method according to claim 2 or 3, wherein after the step of requesting the N data nodes to download the corresponding sliced data, the method further comprises:
and before the downloading of all the fragment data of the target file is completed, maintaining the links with all the data nodes until all the fragment data are downloaded.
10. The method according to claim 4, wherein after the steps of determining the first target data node corresponding to the first subtask whose download status satisfies the first preset condition and determining the download status as the second subtask whose download is not completed, the method further comprises:
and maintaining the link with the first target data node until the downloading of all the fragment data is completed.
11. A file downloading apparatus, comprising:
the request module is used for initiating a file downloading request to a first data node, wherein the file downloading request comprises a file identifier of a target file requested to be downloaded;
a receiving module, configured to receive a total volume of the target file returned by the first data node based on the file identifier;
the judging module is used for judging whether the total volume of the target files is smaller than or equal to a first threshold value or not;
a first downloading module, configured to receive the target file returned by the first data node if the total volume of the target file is less than or equal to the first threshold;
and the second downloading module is used for downloading the fragment data of the target file in parallel and synthesizing to obtain the target file if the total volume of the target file is greater than the first threshold value.
12. An electronic device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the file download method of any of the preceding claims 1-10.
13. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the file download method of any one of the preceding claims 1-10.
CN201910940697.3A 2019-09-30 2019-09-30 File downloading method and device and electronic equipment Pending CN110784520A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910940697.3A CN110784520A (en) 2019-09-30 2019-09-30 File downloading method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910940697.3A CN110784520A (en) 2019-09-30 2019-09-30 File downloading method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN110784520A true CN110784520A (en) 2020-02-11

Family

ID=69385403

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910940697.3A Pending CN110784520A (en) 2019-09-30 2019-09-30 File downloading method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110784520A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112491990A (en) * 2020-11-17 2021-03-12 中科三清科技有限公司 Hybrid cloud network data transmission method and device, electronic equipment and storage medium
CN113242302A (en) * 2021-05-11 2021-08-10 鸬鹚科技(深圳)有限公司 Data access request processing method and device, computer equipment and medium
CN113992651A (en) * 2021-09-24 2022-01-28 深圳市有方科技股份有限公司 Downloading method based on File Transfer Protocol (FTP) and related product
CN114640665A (en) * 2022-02-15 2022-06-17 北京邮电大学 Multi-source segmented parallel file downloading method and tool
CN115277678A (en) * 2022-07-29 2022-11-01 招商局金融科技有限公司 File downloading method and device, computer equipment and storage medium
CN117252655A (en) * 2023-11-20 2023-12-19 畅捷通信息技术股份有限公司 Invoice downloading method, invoice downloading device, computing equipment and storage medium

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103124275A (en) * 2011-11-18 2013-05-29 腾讯科技(深圳)有限公司 Method and device of obtaining files
CN103634361A (en) * 2012-08-28 2014-03-12 腾讯科技(深圳)有限公司 Method and apparatus for downloading file
US20140229582A1 (en) * 2011-11-24 2014-08-14 Tencent Technology (Shenzhen) Company Limited System And Method For Offline Downloading Network Resource Files
CN105871706A (en) * 2016-06-13 2016-08-17 珠海佳米科技有限公司 File transmission method and file transmission system
CN106412137A (en) * 2016-12-20 2017-02-15 北京并行科技股份有限公司 File downloading system and file downloading method
US20170142186A1 (en) * 2015-11-17 2017-05-18 Le Holdings (Beijing) Co., Ltd. Method, apparatus, and electronic device for downloading files
US20170201566A1 (en) * 2016-01-08 2017-07-13 Guangzhou Uc Network Technology Co., Ltd. File downloading method, apparatus, and terminal device
CN106982249A (en) * 2017-03-03 2017-07-25 广州优视网络科技有限公司 Multithreading segmentation method for down loading, equipment, client device and electronic equipment
CN106993054A (en) * 2017-05-05 2017-07-28 腾讯科技(深圳)有限公司 Document distribution method, node and system
CN107959700A (en) * 2016-10-18 2018-04-24 中国电信股份有限公司 The method and cloud storage gateway that adaptive document is downloaded
CN108306961A (en) * 2018-01-29 2018-07-20 广东五科技股份有限公司 A kind of file block method for down loading and device
CN109040213A (en) * 2018-07-23 2018-12-18 Oppo广东移动通信有限公司 Document down loading method and Related product
CN109040230A (en) * 2018-07-31 2018-12-18 优视科技新加坡有限公司 Method for down loading, device, equipment/terminal/server and the storage medium of file
CN109561138A (en) * 2018-11-19 2019-04-02 Oppo广东移动通信有限公司 Document down loading method and Related product
CN109756581A (en) * 2019-03-06 2019-05-14 珠海金山网络游戏科技有限公司 A kind of document transmission system and method, a kind of calculating equipment and storage medium
CN109862065A (en) * 2018-12-06 2019-06-07 北京字节跳动网络技术有限公司 Document down loading method, device and electronic equipment

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103124275A (en) * 2011-11-18 2013-05-29 腾讯科技(深圳)有限公司 Method and device of obtaining files
US20140229582A1 (en) * 2011-11-24 2014-08-14 Tencent Technology (Shenzhen) Company Limited System And Method For Offline Downloading Network Resource Files
CN103634361A (en) * 2012-08-28 2014-03-12 腾讯科技(深圳)有限公司 Method and apparatus for downloading file
US20170142186A1 (en) * 2015-11-17 2017-05-18 Le Holdings (Beijing) Co., Ltd. Method, apparatus, and electronic device for downloading files
US20170201566A1 (en) * 2016-01-08 2017-07-13 Guangzhou Uc Network Technology Co., Ltd. File downloading method, apparatus, and terminal device
CN106961454A (en) * 2016-01-08 2017-07-18 广州优视网络科技有限公司 Document down loading method, device and terminal device
CN105871706A (en) * 2016-06-13 2016-08-17 珠海佳米科技有限公司 File transmission method and file transmission system
CN107959700A (en) * 2016-10-18 2018-04-24 中国电信股份有限公司 The method and cloud storage gateway that adaptive document is downloaded
CN106412137A (en) * 2016-12-20 2017-02-15 北京并行科技股份有限公司 File downloading system and file downloading method
CN110290186A (en) * 2016-12-20 2019-09-27 北京并行科技股份有限公司 A kind of system and method suitable for the transmission of more Supercomputer Center's files
CN106982249A (en) * 2017-03-03 2017-07-25 广州优视网络科技有限公司 Multithreading segmentation method for down loading, equipment, client device and electronic equipment
CN106993054A (en) * 2017-05-05 2017-07-28 腾讯科技(深圳)有限公司 Document distribution method, node and system
CN108306961A (en) * 2018-01-29 2018-07-20 广东五科技股份有限公司 A kind of file block method for down loading and device
CN109040213A (en) * 2018-07-23 2018-12-18 Oppo广东移动通信有限公司 Document down loading method and Related product
CN109040230A (en) * 2018-07-31 2018-12-18 优视科技新加坡有限公司 Method for down loading, device, equipment/terminal/server and the storage medium of file
CN109561138A (en) * 2018-11-19 2019-04-02 Oppo广东移动通信有限公司 Document down loading method and Related product
CN109862065A (en) * 2018-12-06 2019-06-07 北京字节跳动网络技术有限公司 Document down loading method, device and electronic equipment
CN109756581A (en) * 2019-03-06 2019-05-14 珠海金山网络游戏科技有限公司 A kind of document transmission system and method, a kind of calculating equipment and storage medium

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112491990A (en) * 2020-11-17 2021-03-12 中科三清科技有限公司 Hybrid cloud network data transmission method and device, electronic equipment and storage medium
CN112491990B (en) * 2020-11-17 2021-08-10 中科三清科技有限公司 Hybrid cloud network data transmission method and device, electronic equipment and storage medium
CN113242302A (en) * 2021-05-11 2021-08-10 鸬鹚科技(深圳)有限公司 Data access request processing method and device, computer equipment and medium
CN113992651A (en) * 2021-09-24 2022-01-28 深圳市有方科技股份有限公司 Downloading method based on File Transfer Protocol (FTP) and related product
CN114640665A (en) * 2022-02-15 2022-06-17 北京邮电大学 Multi-source segmented parallel file downloading method and tool
CN115277678A (en) * 2022-07-29 2022-11-01 招商局金融科技有限公司 File downloading method and device, computer equipment and storage medium
CN115277678B (en) * 2022-07-29 2024-02-06 招商局金融科技有限公司 File downloading method, device, computer equipment and storage medium
CN117252655A (en) * 2023-11-20 2023-12-19 畅捷通信息技术股份有限公司 Invoice downloading method, invoice downloading device, computing equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110784520A (en) File downloading method and device and electronic equipment
CN111581563A (en) Page response method and device, storage medium and electronic equipment
CN110391938B (en) Method and apparatus for deploying services
CN113254105B (en) Resource processing method and device, storage medium and electronic equipment
CN112379982B (en) Task processing method, device, electronic equipment and computer readable storage medium
CN111209306A (en) Business logic judgment method and device, electronic equipment and storage medium
CN110336592B (en) Data transmission method suitable for Bluetooth card reader, electronic equipment and storage medium
CN112230969B (en) Method and equipment for formatting user space storage area in firmware upgrading process
CN111309406A (en) Event processing method and device of application program and electronic equipment
CN116302271A (en) Page display method and device and electronic equipment
CN111767062A (en) Application configuration data updating method, device, equipment and storage medium
CN114611483A (en) Method and device for automatically upgrading nuclear power DCS control logic diagram and function diagram association
CN111756833B (en) Node processing method, node processing device, electronic equipment and computer readable medium
CN113032046A (en) Method, device and equipment for repairing so file and storage medium
CN111625326B (en) Task pipeline execution method and device and electronic equipment
CN109614089B (en) Automatic generation method, device, equipment and storage medium of data access code
CN109933556B (en) Method and apparatus for processing information
US10925104B2 (en) Method and device for network connection download
CN110609728A (en) Page generation method and device and electronic equipment
CN111314457B (en) Method and device for setting virtual private cloud
CN114793227B (en) Vehicle-mounted software downloading method, electronic equipment and computer readable storage medium
CN113157365B (en) Program running method, program running device, electronic equipment and computer readable medium
CN112486826B (en) Test method, test device, electronic equipment and computer readable medium
CN116361254B (en) Image storage method, apparatus, electronic device, and computer-readable medium
CN110968334B (en) Application resource updating method, resource package manufacturing method, device, medium and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination