Method and device for downloading file
First Claim
1. A method for downloading a file to a device, the method comprising:
- when receiving a download request a file,acquiring, by the device, attribute information about the file from a name node of at least two data nodes,learning information, by the device, about the length of the file according to the attribute information about the file, andwhen the length of the file goes beyond a preset value,segmenting, by the device, the download request into at least two fragments of download requests, the at least two fragments of download requests comprising a first fragment download request and a second fragment download request,sending the at least two fragments of download requests from the device to the at least two data nodes to request to download corresponding fragments,receiving, by the device, information returned by each data node, andidentifying, by the device, whether the information is a downloaded fragment or download failure information,wherein, when the downloaded information corresponding to the first fragment download request that is received from one data node is identified as the download failure information,excluding, by the device, the data node from the at least two data nodes; and
when the downloaded information corresponding to the second fragment download request is also identified as the download failure information, sending, by the device, the second fragment download request to another data node of the at least two data nodes;
wherein, when the downloaded information corresponding to the first fragment download request that is received from one data node is identified as the downloaded fragment and the downloaded information corresponding to the second fragment download request is identified as the download failure information,sending, by the device, the second fragment download request to the data node; and
wherein, when downloaded fragments corresponding to fragments of download requests are received from data nodes,obtaining, by the device, the file according to the at least two fragments obtained by download.
2 Assignments
0 Petitions
Accused Products
Abstract
Disclosed are a method and a device for downloading a file. The method includes: when receiving a download request of a file, acquiring attribute information about the file, and learning information about the length of the file according to the attribute information about the file; when the length of the file goes beyond a preset value, segmenting the download request into at least two fragments of download requests; sending the at least two fragments of download requests to at least two data nodes to request to download corresponding fragments, and obtaining the at least two fragments; and according to the at least two fragments obtained by download, obtaining the file. By segmenting the download request into a plurality of fragments of requests, the present invention achieves the parallel download of the plurality of fragments of requests, thereby greatly improving the download efficiency of a file.
12 Citations
20 Claims
-
1. A method for downloading a file to a device, the method comprising:
when receiving a download request a file, acquiring, by the device, attribute information about the file from a name node of at least two data nodes, learning information, by the device, about the length of the file according to the attribute information about the file, and when the length of the file goes beyond a preset value, segmenting, by the device, the download request into at least two fragments of download requests, the at least two fragments of download requests comprising a first fragment download request and a second fragment download request, sending the at least two fragments of download requests from the device to the at least two data nodes to request to download corresponding fragments, receiving, by the device, information returned by each data node, and identifying, by the device, whether the information is a downloaded fragment or download failure information, wherein, when the downloaded information corresponding to the first fragment download request that is received from one data node is identified as the download failure information, excluding, by the device, the data node from the at least two data nodes; and when the downloaded information corresponding to the second fragment download request is also identified as the download failure information, sending, by the device, the second fragment download request to another data node of the at least two data nodes; wherein, when the downloaded information corresponding to the first fragment download request that is received from one data node is identified as the downloaded fragment and the downloaded information corresponding to the second fragment download request is identified as the download failure information, sending, by the device, the second fragment download request to the data node; and wherein, when downloaded fragments corresponding to fragments of download requests are received from data nodes, obtaining, by the device, the file according to the at least two fragments obtained by download. - View Dependent Claims (2, 3, 4, 5, 6, 7, 15)
-
8. A device for downloading a file, comprising:
-
a processor; a memory storing a plurality of instructions, the plurality of instructions being executed by the processor and causing the processor to; acquire attribute information about a file from a name node of at least two data nodes when receiving a download request of the file; learn information about the length of the file according to the attribute information about the file; download the file directly when the length of the file is less than or equal to a preset value; and when the length of the file goes beyond the preset value, segment the download request into at least two fragments of download requests, the at least two fragments of download requests comprising a first fragment download request and a second fragment download request; send the at least two fragments of download requests to the at least two data nodes to request to download corresponding fragments, receive information returned by each data node; and identify whether the information is a downloaded fragment or download failure information, wherein, when the downloaded information corresponding to the first fragment download request that is received from one data node is identified as the download failure information, exclude the data node from the at least two data nodes; and when the downloaded information corresponding to the second fragment download request is also identified as the download failure information, send the second fragment download request to another data node of the at least two data nodes; wherein, when the downloaded information corresponding to the first fragment download request that is received from one data node is identified as the downloaded fragment and the downloaded information corresponding to the second fragment download request is identified as the download failure information, send the second fragment download request to the data node; and wherein, when downloaded fragments corresponding to fragments of download requests are received from data nodes, obtain the file according to the at least two fragments obtained by download. - View Dependent Claims (9, 10, 11, 12, 13, 14, 16)
-
-
17. A non-transitory computer readable storage medium, storing one or more programs for execution by one or more processors of a computer having a display, the one or more programs comprising instructions for performing:
when receiving a download request of a file, acquiring, by the computer, attribute information about the file from a name node of at least two data nodes, learning information, by the computer, about the length of the file awarding to the attribute information about the file, and when the length of the file goes beyond a preset value, segmenting, by the computer, the download request into at least two fragments of download requests, the at least two fragments of download requests comprising a first fragment download request and a second fragment download request, sending the at least two fragments of download requests from the computer to the at least two data nodes to request to download corresponding fragments, receiving, by the computer, information returned by each data node, and identifying, by the computer, whether the information is a downloaded fragment or download failure information, wherein, when the downloaded information corresponding to the first fragment download request that is received from one data node is identified as the download failure information, excluding, by the computer, the data node from the at least two data nodes; and when the downloaded information corresponding to the second fragment download request is also identified as the download failure information, sending, by the computer, the second fragment download request to another data node of the at least two data nodes; wherein, when the downloaded information corresponding to the first fragment download request that is received from one data node is identified as the downloaded fragment and the downloaded information corresponding to the second fragment download request is identified as the download failure information, sending, by the computer, the second fragment download request to the data node; and wherein, when downloaded fragment fragments corresponding to fragments of download requests are received from data nodes, obtaining, by the computer, the file according to the at least two fragments obtained by download. - View Dependent Claims (18, 19, 20)
Specification