A file downloading method, device, equipment and storage medium

By sharding and assigning files to multiple edge servers for download, combined with the central server's download speed summary and restriction type identification, the problem of download speed is solved, achieving more efficient download speed and shorter waiting time.

CN119299449BActive Publication Date: 2025-05-09HANGZHOU YOUYUN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411805425.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-05-09
Estimated Expiration
2044-12-09

AI Technical Summary

Technical Problem

When users download large files, they often encounter the download speed being limited by the server or network intermediate devices, resulting in the actual download speed being lower than the test speed, resulting in the waiting time being too long.

Method used

The downloaded files are sharded through the central server and allocated these shards to multiple edge servers for download. The central server summarizes the download speed based on the download speed of the edge server, identifies the download limit type, and adjusts the number and priority of download tasks according to the identified type to achieve an increase in download speed.

Benefits of technology

Through the collaborative work of sharding and edge servers, different types of download restrictions can be identified and adapted to improve download speed and reduce user waiting time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119299449B_ABST
    Figure CN119299449B_ABST
Patent Text Reader

Abstract

The present application provides a file downloading method, apparatus, device and storage medium. The central server segments the file to be downloaded, and distributes the segments to the edge servers according to the offset of the segments. Each edge server corresponds to a segment group, so that the central server can save memory usage and reduce memory occupancy time. The central server aggregates the first total download speed of all edge servers to obtain a second total download speed, and determines the download restriction type according to the second total download speed, so that the download restriction type can be identified. In the case where the download restriction type is the first type, each edge server maintains the number of download tasks for the number of segments. In the case where the download restriction type is the second type, each edge server ends the number of download tasks for the number of segments, and starts a single download task to download each segment in the segment group in turn, so that the download speed under different download restriction types can be improved in a cluster manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a file downloading method, device, equipment and storage medium. Background Art

[0002] When users use browsers or other download tools to download files, they often encounter a troubling problem: although the download speed can reach high speeds such as 5M / s and 10M / s when testing the local network, the actual download speed is only 500K / s and 1M / s when downloading files. This means that users have to endure a long waiting time when downloading large files.

[0003] One of the main reasons for this phenomenon is that the server or network intermediate device has limited the download speed, which makes the originally achievable high-speed download suppressed to a lower level. At present, the speed limit rules commonly used by servers or intermediate devices are source speed limit or flow speed limit.

[0004] In the related art, the download speed is increased by pre-segmenting the file into multiple blocks and uploading them to the server, and then using the block download method when downloading. However, the above scheme cannot identify the speed limit rules adopted by the server or intermediate device, and the acceleration effect is minimal when the server or intermediate device adopts flow speed limit; when the server or intermediate device adopts source speed limit, even download acceleration cannot be achieved. Summary of the invention

[0005] In view of this, the present application provides a file downloading method, device, equipment and storage medium to solve the deficiencies in the related art.

[0006] In a first aspect of the present application, a file downloading method is provided, the method comprising:

[0007] The central server segments the file to be downloaded according to the pre-download speed and file size of the file to be downloaded;

[0008] The central server distributes the shards to a plurality of edge servers associated with the central server according to the obtained offsets of the shards, each edge server corresponding to a shard group;

[0009] Each edge server starts a download task with the same number of fragments as the corresponding fragment group to download each fragment in the fragment group respectively, and summarizes a first total download speed of the download task after a first set time, and sends the first total download speed to the central server;

[0010] The central server aggregates the first total download speed of each edge server to obtain a second total download speed, determines a download restriction type according to the second total download speed, and sends the download restriction type to each edge server;

[0011] In the case where the download restriction type is the first type, each edge server maintains the number of download tasks for the number of fragments, and sends the fragments downloaded by each download task and the offset of the fragments to the central server; in the case where the download restriction type is the second type, each edge server ends the number of download tasks for the number of fragments, starts a single download task to download each fragment in the fragment group in turn, and sends the fragments downloaded by the single download task and the offset of the fragment to the central server;

[0012] The central server sends the fragments obtained from each edge server to the client in sequence according to the offset of the fragments.

[0013] According to an embodiment of the present application, before segmenting the file to be downloaded, the method further includes:

[0014] The central server obtains the file size of the file to be downloaded according to the download request for the file to be downloaded sent by the client;

[0015] The file to be downloaded is pre-downloaded for a second set time to obtain a pre-download speed of the file to be downloaded.

[0016] According to an embodiment of the present application, the central server distributes the shards to multiple edge servers associated with the central server according to the obtained offsets of the shards, including:

[0017] The central server repeatedly performs the shard allocation step according to the order of the shard offsets until all the obtained shards are allocated to the plurality of edge servers, and the shard allocation step includes allocating a shard to each edge server in turn.

[0018] According to an embodiment of the present application, the central server is pre-set with a grouping table, each entry in the grouping table corresponds to an edge server, and each entry includes an edge server IP address, a shard offset array, and a download path of the file to be downloaded;

[0019] After allocating the shards to a plurality of edge servers associated with the central server according to the obtained offsets of the shards, the method further includes:

[0020] For each shard assigned to each edge server, the offset of the shard is recorded in the shard offset array of the entry corresponding to the edge server;

[0021] According to the edge server IP address in each table entry, each table entry is sent to the corresponding edge server;

[0022] Each edge server starts a download task with the same number of fragments as the corresponding fragment group to download each fragment in the fragment group, including:

[0023] After receiving the table entry sent by the central server, each edge server creates download tasks with the same number of fragments as the fragment offset array of the table entry, and each download task corresponds to a fragment in the fragment offset array;

[0024] For each download task, according to the download path of the file to be downloaded in the table entry and the offset of the segment corresponding to the download task, the download task is started to download the segment.

[0025] According to an embodiment of the present application, determining the download restriction type according to the second total download speed includes:

[0026] Determining whether the second total download speed is greater than the product of the pre-download speed, the number of edge servers, and a preset ratio;

[0027] If the second total download speed is greater than the product of the pre-download speed, the number of edge servers and the preset ratio, determining that the download restriction type is the first type, and the first type is the flow rate limit;

[0028] Otherwise, it is determined that the download restriction type is the second type, and the second type is source speed limitation.

[0029] According to an embodiment of the present application, sending the segments downloaded by each download task and the offsets of the segments to the central server includes:

[0030] For each download task, a return channel is established between the download task and the central server;

[0031] Using the return channel, the offset of the segment downloaded by the download task is sent to the central server;

[0032] Determine whether the download of the segment is completed within the first set time;

[0033] If the download is completed, the segment is sent to the central server using the return channel, and the download task is terminated;

[0034] If the download is not completed, the download task is maintained, and the data downloaded by the download task is synchronously sent to the central server using the return channel until the download of the segments is completed, and the download task is terminated.

[0035] According to an embodiment of the present application, the central server is pre-configured with a to-be-returned offset start bit, the initial value of the to-be-returned offset start bit is 0, and the fragments obtained from each edge server are sent to the client in sequence according to the fragment offsets, including:

[0036] For each acquired slice, the first determination step is executed in a loop until the slice is sent to the client;

[0037] The first determination step comprises:

[0038] Determine whether the offset start bit of the slice is the same as the offset start bit to be returned;

[0039] If the offset start bit of the fragment is different from the offset start bit to be returned, storing the fragment;

[0040] If the offset start bit of the fragment is the same as the offset start bit to be returned, the fragment is sent to the client, and the offset start bit to be returned is updated according to the offset start bit of the fragment.

[0041] According to one embodiment of the present application, the method further includes:

[0042] The central server obtains the number of executable download tasks according to the second total download speed and the pre-download speed when it is determined that the download restriction type is the first type and the product of the pre-download speed and the obtained number of shards is greater than the second total download speed, or when it is determined that the download restriction type is the second type and the product of the pre-download speed and the number of edge servers is greater than the second total download speed;

[0043] According to the current starting position of the offset to be returned, the number of executable download tasks and the pre-download speed, a download priority adjustment task is performed to control each edge server to preferentially download the segments with low offset.

[0044] According to one embodiment of the present application, the download priority adjustment task includes:

[0045] Obtaining a target offset start position according to the current offset start position to be returned, the number of executable download tasks, and the pre-download speed;

[0046] Determine whether the target offset start bit is greater than or equal to the file size of the file to be downloaded;

[0047] If the target offset start bit is greater than or equal to the file size of the file to be downloaded, a first control instruction is sent to each edge server to control each edge server to download the remaining segments, and the download priority adjustment task is terminated;

[0048] If the target offset starting bit is smaller than the file size of the file to be downloaded, a second control instruction is sent to each edge server to control each edge server to download the segments whose offset starting bit does not exceed the target offset starting bit, stop downloading the segments whose offset starting bit exceeds the target offset starting bit, and repeat the download priority adjustment task when the target offset starting bit is equal to the current offset starting bit to be returned.

[0049] In a second aspect of the present application, a file downloading method is provided, which is applied to a central server, wherein the central server is associated with a plurality of edge servers, and the method comprises:

[0050] Segmenting the file to be downloaded according to the pre-download speed and file size of the file to be downloaded;

[0051] According to the obtained offsets of the shards, the shards are allocated to the plurality of edge servers, each edge server corresponding to a shard group;

[0052] Summarizing the first total download speed obtained from each edge server to obtain a second total download speed, determining a download restriction type according to the second total download speed, and sending the download restriction type to each edge server;

[0053] The shards obtained from each edge server are sent to the client in sequence according to the offset of the shards.

[0054] In a third aspect of the present application, a file download method is provided, which is applied to an edge server, wherein the edge server is associated with a central server and corresponds to a fragment group, wherein the fragments in the fragment group are allocated to the edge server by the central server according to the offset of the obtained fragments, and the method comprises:

[0055] Initiate a download task with the same number of fragments as the number of fragments in the fragment group to download each fragment in the fragment group respectively, and summarize a first total download speed of the download task after a first set time, and send the first total download speed to the central server;

[0056] Receive the download restriction type issued by the central server, and when the download restriction type is the first type, maintain the download tasks for the number of fragments, and send the fragments downloaded by each download task and the offset of the fragment to the central server; when the download restriction type is the second type, end the download tasks for the number of fragments, start a single download task to download each fragment in the fragment group in turn, and send the fragments downloaded by the single download task and the offset of the fragment to the central server, so that the central server will send the fragments obtained from each edge server to the client in turn according to the offset of the fragment.

[0057] In a fourth aspect of the present application, a file downloading device is provided, the device comprising:

[0058] A fragmentation unit, configured to fragment the file to be downloaded according to a pre-download speed and a file size of the file to be downloaded through a central server;

[0059] an allocating unit, configured to allocate the shards to a plurality of edge servers associated with the central server according to the offsets of the shards obtained through the central server, each edge server corresponding to a shard group;

[0060] A first download unit is used to start a download task with the same number of fragments as the corresponding fragment group through each edge server to download each fragment in the fragment group respectively, and summarize a first total download speed of the download task after a first set time, and send the first total download speed to the central server;

[0061] a determining unit, configured to aggregate the first total download speed of each edge server through the central server to obtain a second total download speed, determine a download restriction type according to the second total download speed, and send the download restriction type to each edge server;

[0062] A second download unit is used for maintaining the number of download tasks of the fragments through each edge server when the download restriction type is the first type, and sending the fragments downloaded by each download task and the offset of the fragments to the central server; when the download restriction type is the second type, ending the number of download tasks of the fragments through each edge server, starting a single download task to download each fragment in the fragment group in turn, and sending the fragments downloaded by the single download task and the offset of the fragments to the central server;

[0063] The sending unit is used to send the slices obtained from each edge server to the client in sequence according to the offset of the slice through the central server.

[0064] In a fifth aspect of the present application, a file downloading device is provided, which is applied to a central server, wherein the central server is associated with a plurality of edge servers, and the device comprises:

[0065] A fragmentation unit, used for fragmenting the file to be downloaded according to the pre-download speed and file size of the file to be downloaded;

[0066] an allocating unit, configured to allocate the shards to the plurality of edge servers according to the obtained offsets of the shards, each edge server corresponding to a shard group;

[0067] a determination unit, configured to aggregate the first total download speed obtained from each edge server to obtain a second total download speed, determine a download restriction type according to the second total download speed, and send the download restriction type to each edge server;

[0068] The sending unit is used to send the slices obtained from each edge server to the client in sequence according to the offset of the slices.

[0069] In a sixth aspect of the present application, a file downloading device is provided, which is applied to an edge server, wherein the edge server is associated with a central server and corresponds to a fragment group, wherein the fragments in the fragment group are allocated to the edge server by the central server according to the offset of the obtained fragments, and the device comprises:

[0070] A first download unit is used to start a download task with the same number of fragments as the fragment group to download each fragment in the fragment group respectively, and summarize a first total download speed of the download task after a first set time, and send the first total download speed to the central server;

[0071] The second download unit is used to receive the download restriction type issued by the central server, and when the download restriction type is the first type, maintain the download tasks for the number of fragments, and send the fragments downloaded by each download task and the offset of the fragment to the central server; when the download restriction type is the second type, end the download tasks for the number of fragments, start a single download task to download each fragment in the fragment group in turn, and send the fragments downloaded by the single download task and the offset of the fragment to the central server, so that the central server will send the fragments obtained from each edge server to the client in turn according to the offset of the fragment.

[0072] In the seventh aspect of the present application, an electronic device is provided, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor is used to execute the machine executable instructions to implement the steps of the method proposed in the above embodiment.

[0073] In an eighth aspect of the present application, a machine-readable storage medium is provided, wherein the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are executed by a processor, the steps of the method proposed in the above embodiment are implemented.

[0074] In a ninth aspect of the present application, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the method proposed in the above embodiment when executed by a processor.

[0075] It can be seen from the above technical solution that the central server is associated with multiple edge servers to form a cluster system. The central server segments the files to be downloaded and distributes the segments to multiple edge servers according to the offset of the segments. Each edge server corresponds to a segment group. Since each edge server eventually returns the downloaded data to the central server in the form of segments, the central server can save memory usage and reduce memory occupancy time.

[0076] In addition, each edge server initiates a number of fragment download tasks to download each fragment in the fragment group respectively, and summarizes the first total download speed of the download tasks after a first set time. The central server summarizes the first total download speed of each edge server to obtain a second total download speed, and determines the download restriction type according to the second total download speed, thereby realizing the identification of the download restriction type.

[0077] In addition, when the download restriction type is the first type, each edge server maintains download tasks for the number of shards. When the download restriction type is the second type, each edge server ends download tasks for the number of shards and starts a single download task to download each shard in the shard group in turn, thereby improving the download speed under different download restriction types in a cluster manner.

[0078] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] Figure 1 It is a flowchart of a file downloading method provided in an embodiment of the present application;

[0080] Figure 2 This is an architecture diagram of a central server and several edge servers provided in an embodiment of the present application;

[0081] Figure 3 This is a schematic diagram of shard allocation provided in an embodiment of the present application;

[0082] Figure 4It is a flowchart of a file downloading method provided in an embodiment of the present application;

[0083] Figure 5 It is a schematic diagram of a process of performing shard combination and grouping by a central server provided in an embodiment of the present application;

[0084] Figure 6 It is a schematic diagram of a process of a central server sending a fragment to a client provided in an embodiment of the present application;

[0085] Figure 7 It is a flowchart of a file downloading method provided in an embodiment of the present application;

[0086] Figure 8 It is a structural schematic diagram of a file downloading device provided in an embodiment of the present application;

[0087] Fig. 9 It is a structural schematic diagram of a file downloading device provided in an embodiment of the present application;

[0088] Fig.10 It is a structural schematic diagram of a file downloading device provided in an embodiment of the present application;

[0089] Fig.11 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0090] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0091] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0092] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.

[0093] When users use browsers or other download tools to download files, they often encounter a troubling problem: although the download speed can reach high speeds such as 5M / s and 10M / s when testing the local network, the actual download speed is only 500K / s and 1M / s when downloading files. This means that users have to endure a long waiting time when downloading large files.

[0094] Taking a 1GB file as an example, if the actual download speed is only 500K / s, it will take about 2097 seconds (about 35 minutes) to complete the download, which is a very time-consuming wait for the user.

[0095] An important reason for this phenomenon is that the server or network intermediate equipment imposes restrictions on download speeds, causing the high-speed downloads that could have been achieved to be suppressed to a lower level.

[0096] At present, the speed limit rules commonly used by servers or intermediate devices are source speed limit or flow speed limit. Source speed limit refers to the data transmission speed limit implemented for a specific source IP address, while flow speed limit refers to the data transmission speed limit for a single data stream or session.

[0097] In the related art, files are usually pre-divided into multiple data blocks and uploaded to the server, and the data is obtained from the server by downloading in blocks, thereby increasing the download speed. However, the above scheme cannot identify the speed limit rules adopted by the server or intermediate device, and the acceleration effect is minimal when the server or intermediate device adopts flow speed limit; when the server or intermediate device adopts source speed limit, even download acceleration cannot be achieved.

[0098] In view of this, an embodiment of the present application discloses a file downloading method to solve the deficiencies in the related art.

[0099] like Figure 1 As shown, Figure 1 : is a flowchart of a file download method provided by an embodiment of the present application, and the file download method may include the following steps:

[0100] S101: The central server segments the file to be downloaded according to the pre-download speed and file size of the file to be downloaded.

[0101] In an embodiment of the present application, the file to be downloaded may be a file requested to be downloaded by a client. The pre-download speed may be a download speed calculated by the central server after a short test download of the file to be downloaded. Segmentation refers to dividing the file to be downloaded into multiple segments, each segment containing a portion of the data of the file to be downloaded, and these segments can be downloaded independently.

[0102] In some embodiments, the value of the file size may be divided by the value of the pre-download speed of the file to be downloaded to obtain the total number of fragments of the file to be downloaded, and the size of each fragment is the value of the pre-download speed.

[0103] For example, if the file size of the file to be downloaded is 99M, and the pre-download speed of the file to be downloaded is 1M / s, then the calculation formula for the total number of fragments is "99 / 1", and the total number of fragments is 99, and the size of each fragment is 1M.

[0104] In some embodiments, before segmenting the file to be downloaded, the central server can obtain the file size of the file to be downloaded based on the download request for the file to be downloaded sent by the client, and pre-download the file to be downloaded for a second set time to obtain the pre-download speed of the file to be downloaded.

[0105] Specifically, the client may send a download request for a file to be downloaded to the central server. The central server determines the file to be downloaded requested by the client according to the received download request, and obtains the file size of the file to be downloaded.

[0106] After obtaining the file size, the central server pre-downloads the file to be downloaded for a second set time (for example, 1 second, 2 seconds, etc.) according to the download path of the file to be downloaded carried in the download request, stores the downloaded data in the memory of the central server, and divides the size of the downloaded data by the second set time to obtain the pre-download speed of the file to be downloaded.

[0107] In some embodiments, the central server may determine whether the download data size is smaller than the file size of the file to be downloaded.

[0108] If not, it means that the file to be downloaded has been downloaded within the second set time. In this case, the central server sends the download data stored in the memory to the client;

[0109] If yes, it means that the file to be downloaded has not been downloaded within the second set time. In this case, the file size of the file to be downloaded is divided by the pre-download speed to obtain the download time, and it is determined whether the obtained download time is greater than the preset threshold.

[0110] If not, it means that the download time required for the file to be downloaded is short. In this case, the central server continues to download the file to be downloaded, stores the downloaded data in the memory, and synchronously sends the downloaded data in the memory to the client until the download of the file to be downloaded is completed;

[0111] If so, it means that the download time required for the file to be downloaded is relatively long. In this case, the central server will fragment the file to be downloaded according to the pre-download speed and file size of the file to be downloaded.

[0112] S102: The central server distributes the shards to a plurality of edge servers associated with the central server according to the obtained offsets of the shards, and each edge server corresponds to a shard group.

[0113] like Figure 2 As shown, Figure 2 This is an architecture diagram of a central server and several edge servers provided in an embodiment of the present application. The central server is associated with multiple edge servers, that is, one central server is connected to several edge servers respectively to form a cluster system.

[0114] The central server distributes the shards to multiple edge servers in the cluster according to the offsets of the shards obtained, thereby combining and grouping the shards. The number of shard groups is the number of edge servers, that is, each edge server corresponds to a shard group. After combining and grouping the shards, the central server can send each shard group to the corresponding edge server.

[0115] After the file to be downloaded is segmented, the specific position of each segment in the file to be downloaded can be identified by the offset of the segment. The offset of the segment includes the offset start bit and the offset end bit of the segment. The offset start bit of the segment is used to represent the starting byte position of the segment in the file to be downloaded, and the offset end bit of the segment is used to represent the ending byte position of the segment in the file to be downloaded.

[0116] For example, suppose the file size of the file to be downloaded is 99M, the total number of fragments is 99, and the size of each fragment is 1M. Then, the offset of the first fragment is 0-1048575 bytes, where 0 is the offset start bit of the first fragment, 1048575 is the offset end bit of the first fragment, the offset of the second fragment is 1048576-2097151 bytes, and so on, the offset of the last fragment is 102760448-103809023 bytes.

[0117] In some embodiments, the central server repeatedly performs the shard allocation step according to the order of the shard offsets until all the obtained shards are allocated to the plurality of edge servers, and the shard allocation step includes allocating a shard to each edge server in turn.

[0118] Specifically, the central server sorts the offsets of the shards in ascending order. First, the first round of shard allocation is performed. According to the above order, a shard is allocated to each edge server in turn, and after the allocation is completed, it is determined whether there are any remaining shards.

[0119] If there are no remaining shards, the shard allocation ends; if there are remaining shards, a second round of shard allocation is performed.

[0120] In the second round of shard allocation, a shard is allocated to each edge server in turn according to the offset order of the remaining shards, and after the allocation is completed, it is determined whether there are any remaining shards, and so on, until all the obtained shards are allocated to the plurality of edge servers.

[0121] For example, suppose there is a central server and three edge servers (edge ​​server A, edge server B and edge server C) in the cluster system, the total number of shards of the file to be downloaded is 99, the size of each shard is 1M, and the offsets of the shards are 0-1048575 bytes, 1048576-2097151 bytes, 2097152-3145727 bytes, ..., 102760448-103809023 bytes.

[0122] like Figure 3 As shown, Figure 3 This is a shard allocation diagram provided in an embodiment of the present application. Edge server A corresponds to shard group A, edge server B corresponds to shard group B, and edge server C corresponds to shard group C.

[0123] The offsets of the shards are sorted in ascending order. In the first round of shard allocation, the first shard with an offset of 0-1048575 bytes is recorded in shard group A, the second shard with an offset of 1048576-2097151 bytes is recorded in shard group B, and the third shard with an offset of 2097152-3145727 bytes is recorded in shard group C; in the second round of shard allocation, the fourth shard with an offset of 3145728-4194303 bytes is recorded in shard group A, the fifth shard with an offset of 4194304-5242879 bytes is recorded in shard group B, and the sixth shard with an offset of 5242880-6291455 bytes is recorded in shard group C, and so on, until all the obtained shards are allocated to multiple edge servers.

[0124] In some embodiments, for each edge server, the central server creates a table entry in a pre-set grouping table according to the IP address of the edge server, and records the edge server IP address and the download path of the file to be downloaded in the table entry. In addition, the table entry also includes a shard offset array, and the elements of the shard offset array are the offsets of the shards.

[0125] For the shards assigned to the edge server, the central server can write the offset of the shard into the shard offset array of the table entry corresponding to the edge server in sequence. After completing the shard allocation, the central server will send each table entry to the corresponding edge server according to the edge server IP address in each table entry.

[0126] S103: Each edge server initiates a download task with the same number of fragments as the corresponding fragment group to download each fragment in the fragment group respectively, and summarizes a first total download speed of the download task after a first set time, and sends the first total download speed to the central server.

[0127] Each edge server can obtain the fragment grouping sent by the central server, and start downloading tasks with the same number of fragments as the fragments in the fragment grouping, and use the download tasks with the same number of fragments to download each fragment in the fragment grouping according to the fragment offset.

[0128] After the download process lasts for a first set time, each edge server may summarize the total download speed of all download tasks in the edge server, that is, the first total download speed, and send it to the central server.

[0129] Exemplarily, the first set time may be 1 second, 2 seconds, etc., which is not specifically limited in the embodiments of the present application.

[0130] In some embodiments, the central server is pre-configured with a grouping table, each entry in the grouping table corresponds to an edge server, and each entry includes an edge server IP address, a shard offset array, and a download path of a file to be downloaded.

[0131] After receiving the table entry sent by the central server, the edge server creates download tasks with the same number of shards as the number of shards in the shard offset array of the table entry, wherein each download task corresponds to a shard in the shard offset array;

[0132] For each download task, according to the download path of the file to be downloaded in the table entry and the offset of the segment corresponding to the download task, the download task is started to download the segment.

[0133] S104: The central server aggregates the first total download speed of each edge server to obtain a second total download speed, determines a download restriction type according to the second total download speed, and sends the download restriction type to each edge server.

[0134] The central server may receive the first total download speed sent by each edge server, and aggregate all the first total download speeds to obtain a second total download speed, determine the download restriction type by judging whether the second total download speed meets the set condition, and send the obtained download restriction type to each edge server.

[0135] In an embodiment of the present application, each edge server initiates a number of shard download tasks to download each shard in the shard group respectively, and summarizes the first total download speed of the download tasks after a first set time, and then summarizes the first total download speed of each edge server through the central server to obtain a second total download speed, and determines the download restriction type according to the second total download speed, thereby realizing intelligent identification of the download restriction type.

[0136] In some embodiments, the above-mentioned setting condition may be greater than the product of the pre-download speed, the number of edge servers and the preset ratio, or greater than the preset download speed, etc.

[0137] In some embodiments, the download restriction type may include a first type and a second type. Exemplarily, the first type is a flow rate limit, and the second type is a source rate limit. It should be noted that the flow rate limit refers to the data transmission speed limit for a single data stream or session, and the source rate limit refers to the data transmission speed limit implemented for a specific source IP address.

[0138] It can be determined whether the second total download speed is greater than the product of the pre-download speed, the number of edge servers, and the preset ratio.

[0139] If the second total download speed is greater than the product of the pre-download speed, the number of edge servers and the preset ratio, the download restriction type is determined to be flow speed restriction; otherwise, the download restriction type is determined to be source speed restriction.

[0140] Exemplarily, the preset ratio can be set according to actual needs, for example, the preset ratio is 1.1 or 1.2.

[0141] S105: When the download restriction type is the first type, each edge server maintains download tasks for the number of fragments, and sends the fragments downloaded by each download task and the offset of the fragments to the central server; when the download restriction type is the second type, each edge server ends the download tasks for the number of fragments, starts a single download task to download each fragment in the fragment group in turn, and sends the fragments downloaded by the single download task and the offset of the fragments to the central server.

[0142] Each edge server receives the download restriction type sent by the central server, and downloads each fragment in the fragment group using a corresponding download method according to the download restriction type.

[0143] Specifically, if the download restriction type is the first type, then the number of download tasks for the fragments started in S103 continues to be executed, and the fragments downloaded by each download task and the offset of the fragments are sent to the central server;

[0144] If the download restriction type is the second type, then the number of download tasks for the fragments started in S103 is recovered and a download task is started. The download task is used to sort the fragments according to the offset of the fragments, and each fragment in the fragment group is downloaded in turn, and the fragments downloaded by the download task and the offset of the fragment are sent to the central server.

[0145] Exemplarily, the first type is flow rate limiting, and the second type is source rate limiting.

[0146] In some embodiments, when the download restriction type is the first type, each edge server maintains a number of download tasks equal to the number of shards. For each download task, the edge server will establish a return channel between the download task and the central server, and use the return channel to first send the offset of the shard downloaded by the download task to the central server.

[0147] Then determine whether the download of the segments downloaded by the download task is completed within the first set time.

[0148] If the download is complete, the downloaded segments are sent to the central server using the return channel, and the download task is completed;

[0149] If the download is not completed, the download task is maintained, and the data downloaded by the download task is sent to the central server using the return channel synchronously until the download of each segment is completed and the download task is ended. Specifically, if the download is not completed, the data downloaded within the first set time can be sent to the central server using the return channel, and then the data is downloaded and returned until the download of each segment is completed and the download task is ended.

[0150] In some embodiments, when the download restriction type is the second type, each edge server ends the download tasks of the number of shards, starts a single download task, and establishes a return channel between the single download task and the central server. According to the order of the offsets of the shards in the shard grouping, each shard in the shard grouping is downloaded in sequence, and the data downloaded by the single download task is sent to the central server synchronously using the return channel. It should be noted that the edge server will use the return channel to send the offset of each shard to the central server before starting to download the shard.

[0151] In some embodiments, when the download restriction type is the second type, each edge server ends the download tasks of the number of shards, starts a single download task, and establishes a return channel between the single download task and the central server. The shard offset array in the table item sent by the central server is traversed, and each shard in the shard offset array is sequentially subjected to a specified processing step, and the specified processing step includes: using the return channel to send the offset of the shard to the central server, and then downloading the shard according to the offset of the shard, and synchronously using the return channel to send the downloaded data to the central server until the shard is downloaded.

[0152] In an embodiment of the present application, when the download restriction type is the first type, each edge server maintains download tasks for the number of shards. When the download restriction type is the second type, each edge server ends the download tasks for the number of shards and starts a single download task to download each shard in the shard group in turn, thereby improving the download speed under different download restriction types in a cluster manner.

[0153] S106: The central server sends the fragments obtained from each edge server to the client in sequence according to the fragment offsets.

[0154] The central server sends the shards obtained from each edge server to the client in sequence.

[0155] In some embodiments, the central server is pre-configured with a to-be-returned offset start bit, and the initial value of the to-be-returned offset start bit is 0. The fragments obtained from each edge server are sent to the client in sequence according to the fragment offsets, including:

[0156] For each obtained slice, the first determination step is executed in a loop until the slice is sent to the client;

[0157] The first judgment step includes: judging whether the offset starting bit of the fragment is the same as the offset starting bit to be returned; if the offset starting bit of the fragment is different from the offset starting bit to be returned, temporarily storing the fragment in the memory of the central server; if the offset starting bit of the fragment is the same as the offset starting bit to be returned, sending the fragment to the client, and updating the offset starting bit to be returned according to the offset starting bit of the fragment.

[0158] In some embodiments, updating the offset start bit to be returned according to the offset start bit of the slice includes: adding one to the offset start bit of the slice to obtain a new offset start bit to be returned.

[0159] For example, assuming that the offset start bit to be returned is 0, the offset of the fragment obtained by the central server from edge server A is 0-1048575 bytes, and the offset of the fragment obtained from edge server B is 1048576-2097151 bytes. Since the offset start bit of the fragment obtained from edge server B is different from the offset start bit to be returned, the fragment is temporarily stored in the memory of the central server and the first judgment is executed cyclically; and the offset start bit of the fragment obtained from edge server A is the same as the offset start bit to be returned, so the fragment is sent to the client until all data of the fragment is sent, and the offset start bit to be returned is updated to 1048576, so as to be used for other fragments to execute the first judgment.

[0160] In an embodiment of the present application, a central server is associated with multiple edge servers to form a cluster system. The central server segments the files to be downloaded and distributes the segments to multiple edge servers according to the offsets of the segments. Each edge server corresponds to a segment group. Since each edge server eventually returns the downloaded data to the central server in the form of segments, the central server can save memory usage and reduce memory occupancy time.

[0161] In addition, each edge server initiates a number of fragment download tasks to download each fragment in the fragment group respectively, and summarizes the first total download speed of the download tasks after a first set time. The central server summarizes the first total download speed of each edge server to obtain a second total download speed, and determines the download restriction type according to the second total download speed, thereby realizing the identification of the download restriction type.

[0162] In addition, when the download restriction type is the first type, each edge server maintains download tasks for the number of shards. When the download restriction type is the second type, each edge server ends download tasks for the number of shards and starts a single download task to download each shard in the shard group in turn, thereby improving the download speed under different download restriction types in a cluster manner.

[0163] In some embodiments, when the central server determines that the download restriction type is the first type and the product of the pre-download speed and the obtained number of shards is greater than the second total download speed, or when the central server determines that the download restriction type is the second type and the product of the pre-download speed and the number of edge servers is greater than the second total download speed, the number of executable download tasks is obtained according to the second total download speed and the pre-download speed;

[0164] According to the current starting position of the offset to be returned, the number of executable download tasks and the pre-download speed, the download priority adjustment task is performed to control each edge server to give priority to downloading the fragments with low offset.

[0165] Specifically, the download priority adjustment task includes:

[0166] According to the current offset start position to be returned, the number of executable download tasks and the pre-download speed, the target offset start position is obtained;

[0167] Determine whether the target offset start bit is greater than or equal to the file size of the file to be downloaded;

[0168] If the target offset start bit is greater than or equal to the file size of the file to be downloaded, a first control instruction is sent to each edge server to control each edge server to download the remaining segments, and the download priority adjustment task is terminated;

[0169] If the target offset starting bit is smaller than the file size of the file to be downloaded, a second control instruction is sent to each edge server to control each edge server to download the segments whose offset starting bit does not exceed the target offset starting bit, stop downloading the segments whose offset starting bit exceeds the target offset starting bit, and repeat the download priority adjustment task when the target offset starting bit is equal to the current offset starting bit to be returned.

[0170] Exemplarily, the first type is flow rate limiting, and the second type is source rate limiting.

[0171] It should be noted that, ideally, this application can increase the file download speed from "pre-download speed" to "the product of pre-download speed and the number of shards" for flow speed limit conditions, and can increase the file download speed from "pre-download speed" to "the product of pre-download speed and the number of edge servers" for source speed limit conditions. However, the download speed will be affected by the server bandwidth or client bandwidth that provides the file to be downloaded. Therefore, this embodiment monitors the total download speed of all tasks of the edge server through the central server to see if it meets the ideal situation. If not, the edge server is controlled to give priority to downloading low-offset shards and stop downloading high-offset shards. In this way, when the server bandwidth or client bandwidth that provides the file to be downloaded is limited, the shard download tasks can be intelligently monitored and scheduled to avoid download speed reduction, so as to achieve fast download.

[0172] In some embodiments, the central server initiates a task, and the task execution content is as follows:

[0173] A1. Obtain the total download speed of all download tasks of each edge server;

[0174] A2. Summarize the total download speed of each edge server to obtain the total summary speed;

[0175] A3. Determine the download restriction type. If the download restriction type is flow rate limit, execute step A4; if the download restriction type is source rate limit, execute step 10;

[0176] A4, determine whether the total aggregation speed is greater than or equal to the product of the pre-download speed and the number of obtained fragments. If so, end the task; otherwise, execute step A5;

[0177] A5. Divide the total summary speed by the pre-download speed and round down to get the number of executable download tasks.

[0178] A6. Calculate the target offset start position, where the target offset start position = the current offset start position to be returned + the number of executable download tasks * the pre-download speed;

[0179] A7, determining whether the target offset start bit is greater than or equal to the file size of the file to be downloaded, if so, sending a first control instruction to each edge server to control each edge server to download the remaining segments, and ending the task; if not, executing step A8;

[0180] A8. Send a second control instruction to each edge server to control each edge server to download the segments whose offset start bit does not exceed the target offset start bit, and stop downloading the segments whose offset start bit exceeds the target offset start bit;

[0181] A9, determine whether the current offset start position to be returned is equal to the target offset start position, if they are equal, execute step A6; otherwise, repeat step A9;

[0182] A10. Determine whether the total aggregation speed is greater than or equal to the product of the pre-download speed and the number of edge servers. If so, end the task; otherwise, execute step A5.

[0183] For example, suppose there are three edge servers with IP addresses 1.1.1.1, 1.1.1.2, and 1.1.1.3. The size of the file to be downloaded is 99M. The server that provides the file to be downloaded has a flow rate limit of 1M / s, and the total bandwidth of the server is 10M / s.

[0184] The central server starts the above task, queries the total download speed from each edge server and adds them up. Since the total server bandwidth is 10M / s, the total summary speed at this time is about 10M / s. Ideally, this application can increase the file download speed to 99M / s for flow speed limit conditions, so the total summary speed at this time is not in line with expectations, so it is necessary to schedule the download task through this task.

[0185] First, calculate the number of executable download tasks, the calculation formula is 10 / 1, the result is 10. Then calculate the target offset start bit, assuming that the current offset start bit to be returned is 0, the calculation formula for the target offset start bit is 0+10*1*1024*1024, the result is 10485760.

[0186] At this time, the target offset starting bit is not greater than or equal to 103809024, that is, 99M file size, indicating that the download has not yet ended. Therefore, the central server sends a second control instruction to each edge server to control each edge server to give priority to downloading the fragments with an offset within 0-10M and stop downloading the fragments with an offset after 10M.

[0187] Until the current offset start position to be returned is the same as the target offset start position, continue to calculate the next target offset start position.

[0188] Assume that the next target offset start bit = 93323264 + 10*1*1024*1024, the result is 103809024. At this time, the target offset start bit is greater than or equal to 103809024, that is, 99M file size, so the central server sends a first control instruction to each edge server to control each edge server to download the remaining segments and end the task.

[0189] In this embodiment, the central server monitors whether the total download speed of all tasks of the edge server meets the ideal situation. If not, the edge server is controlled to prioritize downloading low-offset segments and stop downloading high-offset segments. In this way, when the server bandwidth or client bandwidth providing the file to be downloaded is limited, the segment download tasks can be intelligently monitored and scheduled to avoid download speed reduction, so as to achieve fast download.

[0190] like Figure 4 As shown, Figure 4 1 is a flowchart of a file download method provided in an embodiment of the present application. The file download method is applied to a central server, and the central server is associated with multiple edge servers. The file download method may include the following steps:

[0191] S401: Segment the file to be downloaded according to the pre-download speed and file size of the file to be downloaded.

[0192] In some embodiments, the value of the pre-download speed of the file to be downloaded may be divided by the value of the file size to obtain the total number of fragments of the file to be downloaded, and the size of each fragment is the value of the pre-download speed.

[0193] In some embodiments, before segmenting the file to be downloaded, the central server can obtain the file size of the file to be downloaded based on the download request for the file to be downloaded sent by the client, and pre-download the file to be downloaded for a second set time to obtain the pre-download speed of the file to be downloaded.

[0194] Specifically, the client may send a download request for a file to be downloaded to the central server. The central server determines the file to be downloaded requested by the client according to the received download request, and obtains the file size of the file to be downloaded.

[0195] After obtaining the file size, the central server pre-downloads the file to be downloaded for a second set time according to the download path of the file to be downloaded carried in the download request, stores the downloaded data in the memory of the central server, and divides the downloaded data size by the second set time to obtain the pre-download speed of the file to be downloaded.

[0196] In some embodiments, the central server may determine whether the download data size is smaller than the file size of the file to be downloaded.

[0197] If not, it means that the file to be downloaded has been downloaded within the second set time. In this case, the central server sends the download data stored in the memory to the client;

[0198] If yes, it means that the file to be downloaded has not been downloaded within the second set time. In this case, the file size of the file to be downloaded is divided by the pre-download speed to obtain the download time, and it is determined whether the obtained download time is greater than the preset threshold.

[0199] If not, it means that the download time required for the file to be downloaded is short. In this case, the central server continues to download the file to be downloaded, stores the downloaded data in the memory, and synchronously sends the downloaded data in the memory to the client until the download of the file to be downloaded is completed;

[0200] If so, it means that the download time required for the file to be downloaded is relatively long. In this case, the central server will fragment the file to be downloaded according to the pre-download speed and file size of the file to be downloaded.

[0201] S402: Allocate the shards to the plurality of edge servers according to the obtained offsets of the shards, each edge server corresponding to a shard group.

[0202] The central server distributes the shards to multiple edge servers in the cluster according to the offsets of the shards obtained, thereby combining and grouping the shards. The number of shard groups is the number of edge servers, that is, each edge server corresponds to a shard group. After combining and grouping the shards, the central server can send each shard group to the corresponding edge server.

[0203] In some embodiments, the central server repeatedly performs the shard allocation step according to the order of the shard offsets until all the obtained shards are allocated to the plurality of edge servers, and the shard allocation step includes allocating a shard to each edge server in turn.

[0204] Specifically, the central server sorts the offsets of the shards in ascending order. First, the first round of shard allocation is performed. According to the above order, a shard is allocated to each edge server in turn, and after the allocation is completed, it is determined whether there are any remaining shards.

[0205] If there are no remaining shards, the shard allocation ends; if there are remaining shards, a second round of shard allocation is performed.

[0206] In the second round of shard allocation, a shard is allocated to each edge server in turn according to the offset order of the remaining shards, and after the allocation is completed, it is determined whether there are any remaining shards, and so on, until all the obtained shards are allocated to the plurality of edge servers.

[0207] In some embodiments, for each edge server, the central server creates an entry in a pre-set grouping table according to the IP address of the edge server, and records the edge server IP address and the download path of the file to be downloaded in the entry. In addition, the entry also includes a shard offset array.

[0208] For the shards assigned to the edge server, the central server can write the offset of the shard into the shard offset array of the table entry corresponding to the edge server in sequence. After completing the shard allocation, the central server will send each table entry to the corresponding edge server according to the edge server IP address in each table entry.

[0209] S403: Summarize the first total download speed obtained from each edge server to obtain a second total download speed, determine a download restriction type according to the second total download speed, and send the download restriction type to each edge server.

[0210] The central server may receive the first total download speed sent by each edge server, and aggregate all the first total download speeds to obtain a second total download speed.

[0211] By judging whether the second total download speed satisfies the set condition, the download restriction type is determined, and the obtained download restriction type is sent to each edge server.

[0212] In some embodiments, the above-mentioned setting condition may be greater than the product of the pre-download speed, the number of edge servers and the preset ratio, or greater than the preset download speed, etc.

[0213] In some embodiments, the download restriction type may include a first type and a second type. Exemplarily, the first type is a flow rate limit, and the second type is a source rate limit. It should be noted that the flow rate limit refers to the data transmission speed limit for a single data stream or session, and the source rate limit refers to the data transmission speed limit implemented for a specific source IP address.

[0214] It can be determined whether the second total download speed is greater than the product of the pre-download speed, the number of edge servers, and the preset ratio.

[0215] If the second total download speed is greater than the product of the pre-download speed, the number of edge servers and the preset ratio, the download restriction type is determined to be flow speed restriction; otherwise, the download restriction type is determined to be source speed restriction.

[0216] S404: The fragments obtained from each edge server are sent to the client in sequence according to the fragment offsets.

[0217] The central server sends the shards obtained from each edge server to the client in sequence.

[0218] In some embodiments, the central server is pre-configured with a to-be-returned offset start bit, and the initial value of the to-be-returned offset start bit is 0. The fragments obtained from each edge server are sent to the client in sequence according to the fragment offsets, including:

[0219] For each obtained slice, the first determination step is executed in a loop until the slice is sent to the client;

[0220] The first judgment step includes: judging whether the offset starting bit of the fragment is the same as the offset starting bit to be returned; if the offset starting bit of the fragment is different from the offset starting bit to be returned, temporarily storing the fragment in the memory of the central server; if the offset starting bit of the fragment is the same as the offset starting bit to be returned, sending the fragment to the client, and updating the offset starting bit to be returned according to the offset starting bit of the fragment.

[0221] In some embodiments, updating the offset start bit to be returned according to the offset start bit of the slice includes: adding one to the offset start bit of the slice to obtain a new offset start bit to be returned.

[0222] In an embodiment of the present application, a central server is associated with multiple edge servers to form a cluster system. The central server segments the files to be downloaded and distributes the segments to multiple edge servers according to the offsets of the segments. Each edge server corresponds to a segment group. Since each edge server eventually returns the downloaded data to the central server in the form of segments, the central server can save memory usage and reduce memory occupancy time.

[0223] In addition, the central server aggregates the first total download speed of each edge server to obtain a second total download speed, and determines the download restriction type according to the second total download speed, thereby enabling identification of the download restriction type.

[0224] In addition, the central server sends the obtained download restriction type to each edge server, so that each edge server maintains the download tasks for the number of shards when the download restriction type is the first type, and ends the download tasks for the number of shards when the download restriction type is the second type, and starts a single download task to download each shard in the shard group in turn, thereby improving the download speed under different download restriction types in a cluster manner.

[0225] like Figure 5 As shown, Figure 5 It is a flowchart of a central server performing shard combination and grouping provided in an embodiment of the present application.

[0226] The central server receives a download request for a file to be downloaded sent by a client. The file size of the file to be downloaded is obtained according to the download request. The file to be downloaded is pre-downloaded for a second set time (e.g., 1 second, 2 seconds, etc.) according to the download path carried in the download request, and the download data is stored in the memory of the central server. The size of the downloaded data is divided by the second set time to obtain the pre-download speed of the file to be downloaded.

[0227] It is determined whether the size of the downloaded data is smaller than the size of the file to be downloaded. If not, it means that the file to be downloaded has been downloaded within the second set time. In this case, the central server sends the downloaded data stored in the memory to the client to end.

[0228] If so, it means that the file to be downloaded has not been downloaded completely within the second set time. In this case, the download time is obtained by dividing the file size of the file to be downloaded by the pre-download speed.

[0229] Determine whether the download time is greater than a preset threshold. If not, it means that the download time required for the file to be downloaded is short. In this case, the central server continues to download the file to be downloaded, stores the downloaded data in the memory, and synchronously sends the downloaded data in the memory to the client until the download of the file to be downloaded is completed.

[0230] If so, it means that the download time required for the file to be downloaded is long. In this case, the central server divides the value of the file size by the value of the pre-download speed of the file to be downloaded to obtain the total number of fragments of the file to be downloaded, and groups the fragments according to the fragment offsets, and sends each group to the corresponding edge server.

[0231] The steps of shard grouping include:

[0232] The central server pre-establishes a grouping table for the files to be downloaded, creates an entry in the grouping table according to the IP address of the edge server, and records the edge server IP address and the download path of the file to be downloaded in the entry. In addition, the entry also includes a fragment offset array.

[0233] The offsets of the shards are sorted in order from small to large, and based on the above sorting, the offsets of the shards are written into the shard offset array of the corresponding table entry of each edge server in a circular manner.

[0234] like Figure 6 As shown, Figure 6 It is a flow chart of a central server sending fragments to a client provided in an embodiment of the present application.

[0235] After the central server establishes a return channel with a download task in the edge server, it waits for the edge server to send a return. First, the central server can receive the offset of the fragment through the return channel and record the offset of the fragment. Then the central server can receive the fragment data downloaded by the download task through the return channel. The central server cyclically determines whether the offset start bit of the fragment is the same as the offset start bit to be returned. If they are not the same, the fragment is temporarily stored in the memory of the central server and the judgment continues; if they are the same, the fragment data is returned to the client until all the data of the fragment is returned, the offset start bit to be returned is updated, and the return task of the download task is ended.

[0236] like Figure 7 As shown, Figure 7 1 is a flow chart of a file download method provided by an embodiment of the present application. The file download method is applied to an edge server. The edge server is associated with a central server and corresponds to a fragment group. The fragments in the fragment group are allocated to the edge server by the central server according to the offset of the obtained fragment. The file download method may include the following steps:

[0237] S701: Start a download task with the same number of fragments as the fragment group to download each fragment in the fragment group respectively, and summarize a first total download speed of the download task after a first set time, and send the first total download speed to the central server.

[0238] Each edge server can obtain the fragment grouping sent by the central server, and start downloading tasks with the same number of fragments as the fragments in the fragment grouping, and use the download tasks with the same number of fragments to download each fragment in the fragment grouping according to the fragment offset.

[0239] After the download process lasts for a first set time, each edge server may summarize the total download speed of all download tasks in the edge server, that is, the first total download speed, and send it to the central server.

[0240] In some embodiments, the central server is pre-configured with a grouping table, each entry in the grouping table corresponds to an edge server, and each entry includes an edge server IP address, a shard offset array, and a download path of a file to be downloaded.

[0241] After receiving the table entry sent by the central server, the edge server creates download tasks with the same number of shards as the number of shards in the shard offset array of the table entry, wherein each download task corresponds to a shard in the shard offset array;

[0242] For each download task, according to the download path of the file to be downloaded in the table entry and the offset of the segment corresponding to the download task, the download task is started to download the segment.

[0243] S702: Receive the download restriction type issued by the central server. When the download restriction type is the first type, maintain the download tasks for the number of fragments, and send the fragments downloaded by each download task and the offset of the fragments to the central server. When the download restriction type is the second type, end the download tasks for the number of fragments, start a single download task to download each fragment in the fragment group in turn, and send the fragments downloaded by the single download task and the offset of the fragments to the central server, so that the central server can send the fragments obtained from each edge server to the client in turn according to the offset of the fragment.

[0244] Each edge server receives the download restriction type sent by the central server, and downloads each fragment in the fragment group using a corresponding download method according to the download restriction type.

[0245] Specifically, if the download restriction type is the first type, then the number of download tasks for the number of segments continues to be executed, and the segments downloaded by each download task and the offset of the segments are sent to the central server;

[0246] If the download restriction type is the second type, then the number of download tasks for the fragments is recovered, and a task is started to download each fragment in the fragment group in turn, and the fragments downloaded by this task and the fragment offsets are sent to the central server.

[0247] Exemplarily, the first type is flow rate limiting, and the second type is source rate limiting.

[0248] In some embodiments, when the download restriction type is the first type, each edge server maintains a number of download tasks equal to the number of shards. For each download task, the edge server will establish a return channel between the download task and the central server, and use the return channel to first send the offset of the shard downloaded by the download task to the central server.

[0249] Then determine whether the download of the segments downloaded by the download task is completed within the first set time.

[0250] If the download is complete, the downloaded segments are sent to the central server using the return channel, and the download task is completed;

[0251] If the download is not completed, the download task is maintained, and the data downloaded by the download task is sent to the central server using the return channel synchronously until the download of each segment is completed and the download task is terminated. Specifically, if the download is not completed, the data downloaded within the first set time can be sent to the central server using the return channel, and then the data is downloaded and returned until the download of each segment is completed.

[0252] In some embodiments, when the download restriction type is the second type, each edge server ends the download tasks of the number of shards, starts a single download task, and establishes a return channel between the single download task and the central server. According to the order of the offsets of the shards in the shard grouping, each shard in the shard grouping is downloaded in sequence, and the data downloaded by the single download task is sent to the central server synchronously using the return channel. It should be noted that the edge server will use the return channel to send the offset of each shard to the central server before starting to download the shard.

[0253] In some embodiments, when the download restriction type is the second type, each edge server ends the download tasks of the number of shards, starts a single download task, and establishes a return channel between the single download task and the central server. The shard offset array in the table item sent by the central server is traversed, and each shard in the shard offset array is sequentially subjected to a specified processing step, and the specified processing step includes: using the return channel to send the offset of the shard to the central server, and then downloading the shard according to the offset of the shard, and synchronously using the return channel to send the downloaded data to the central server until the shard is downloaded.

[0254] In the embodiment of the present application, each edge server corresponds to a fragment group. Since each edge server eventually returns the downloaded data to the central server in the form of fragments, the central server can save memory usage and reduce memory occupancy time.

[0255] In addition, each edge server initiates a number of fragment download tasks to download each fragment in the fragment group respectively, and summarizes the first total download speed of the download tasks after a first set time, so that the central server summarizes the first total download speed of each edge server to obtain a second total download speed, and determines the download restriction type according to the second total download speed, thereby realizing the identification of the download restriction type.

[0256] In addition, when the download restriction type is the first type, each edge server maintains download tasks for the number of shards. When the download restriction type is the second type, each edge server ends download tasks for the number of shards and starts a single download task to download each shard in the shard group in turn, thereby improving the download speed under different download restriction types in a cluster manner.

[0257] The above content describes the method provided by the present application. The following describes the device provided by the present application:

[0258] See also Figure 8 , is a structural diagram of a file downloading device provided in an embodiment of the present application.

[0259] like Figure 8 As shown, the device may include:

[0260] The fragmentation unit 810 is used to fragment the file to be downloaded according to the pre-download speed and file size of the file to be downloaded through the central server;

[0261] An allocating unit 820, configured to allocate the shards to a plurality of edge servers associated with the central server according to the obtained offsets of the shards through the central server, each edge server corresponding to a shard group;

[0262] A first downloading unit 830 is configured to initiate, through each edge server, a download task with the same number of fragments as the number of fragments in the corresponding fragment group to download each fragment in the fragment group respectively, and summarize a first total download speed of the download task after a first set time, and send the first total download speed to the central server;

[0263] The determining unit 840 is configured to aggregate the first total download speed of each edge server through the central server to obtain a second total download speed, determine a download restriction type according to the second total download speed, and send the download restriction type to each edge server;

[0264] The second download unit 850 is used for maintaining the number of download tasks of the fragments through each edge server when the download restriction type is the first type, and sending the fragments downloaded by each download task and the offset of the fragments to the central server; when the download restriction type is the second type, ending the number of download tasks of the fragments through each edge server, starting a single download task to download each fragment in the fragment group in sequence, and sending the fragments downloaded by the single download task and the offset of the fragments to the central server;

[0265] The sending unit 860 is configured to send the slices obtained from each edge server to the client in sequence according to the offset of the slices through the central server.

[0266] In some embodiments, the device further comprises an acquisition unit, the acquisition unit being configured to acquire, through the central server, a file size of the file to be downloaded according to a download request for the file to be downloaded sent by the client;

[0267] The file to be downloaded is pre-downloaded for a second set time to obtain a pre-download speed of the file to be downloaded.

[0268] In some embodiments, the allocation unit 820 is specifically configured to:

[0269] The central server repeatedly performs the shard allocation step according to the order of the shard offsets until all the obtained shards are allocated to the plurality of edge servers, and the shard allocation step includes allocating a shard to each edge server in turn.

[0270] In some embodiments, the central server is pre-set with a grouping table, each entry in the grouping table corresponds to an edge server, and each entry includes an edge server IP address, a shard offset array, and a download path of the file to be downloaded;

[0271] The allocation unit 820 is further configured to:

[0272] For each shard assigned to each edge server, the offset of the shard is recorded in the shard offset array of the entry corresponding to the edge server;

[0273] According to the edge server IP address in each table entry, each table entry is sent to the corresponding edge server;

[0274] The first downloading unit 830 is specifically used for:

[0275] After receiving the table entry sent by the central server, each edge server creates download tasks with the same number of fragments as the fragment offset array of the table entry, each download task corresponding to a fragment in the fragment offset array;

[0276] For each download task, according to the download path of the file to be downloaded in the table entry and the offset of the segment corresponding to the download task, the download task is started to download the segment.

[0277] In some embodiments, the determining unit 840 is specifically configured to:

[0278] Determining whether the second total download speed is greater than the product of the pre-download speed, the number of edge servers, and a preset ratio;

[0279] If the second total download speed is greater than the product of the pre-download speed, the number of edge servers and the preset ratio, determining that the download restriction type is the first type, and the first type is the flow rate limit;

[0280] Otherwise, it is determined that the download restriction type is the second type, and the second type is source speed limitation.

[0281] In some embodiments, the second downloading unit 850 is specifically used to:

[0282] For each download task, a return channel is established between the download task and the central server;

[0283] Using the return channel, the offset of the segment downloaded by the download task is sent to the central server;

[0284] Determine whether the download of the segment is completed within the first set time;

[0285] If the download is completed, the segment is sent to the central server using the return channel, and the download task is terminated;

[0286] If the download is not completed, the download task is maintained, and the data downloaded by the download task is synchronously sent to the central server using the return channel until the download of the segments is completed, and the download task is terminated.

[0287] In some embodiments, the central server is pre-configured with a to-be-returned offset start bit, and the initial value of the to-be-returned offset start bit is 0; the sending unit 860 is specifically configured to:

[0288] For each acquired slice, the first determination step is executed in a loop until the slice is sent to the client;

[0289] The first determination step comprises:

[0290] Determine whether the offset start bit of the slice is the same as the offset start bit to be returned;

[0291] If the offset start bit of the fragment is different from the offset start bit to be returned, storing the fragment;

[0292] If the offset start bit of the fragment is the same as the offset start bit to be returned, the fragment is sent to the client, and the offset start bit to be returned is updated according to the offset start bit of the fragment.

[0293] In some embodiments, the device further comprises an adjusting unit, wherein the adjusting unit is specifically configured to:

[0294] When the central server determines that the download restriction type is the first type and the product of the pre-download speed and the obtained number of shards is greater than the second total download speed, or when the central server determines that the download restriction type is the second type and the product of the pre-download speed and the number of edge servers is greater than the second total download speed, the number of executable download tasks is obtained according to the second total download speed and the pre-download speed;

[0295] According to the current offset start position to be returned, the number of executable download tasks and the pre-download speed, the download priority adjustment task is executed to control each edge server to preferentially download the segments with low offset.

[0296] The download priority adjustment task includes:

[0297] Obtaining a target offset start position according to the current offset start position to be returned, the number of executable download tasks, and the pre-download speed;

[0298] Determine whether the target offset start bit is greater than or equal to the file size of the file to be downloaded;

[0299] If the target offset start bit is greater than or equal to the file size of the file to be downloaded, a first control instruction is sent to each edge server to control each edge server to download the remaining segments, and the download priority adjustment task is terminated;

[0300] If the target offset starting bit is smaller than the file size of the file to be downloaded, a second control instruction is sent to each edge server to control each edge server to download the segments whose offset starting bit does not exceed the target offset starting bit, stop downloading the segments whose offset starting bit exceeds the target offset starting bit, and repeat the download priority adjustment task when the target offset starting bit is equal to the current offset starting bit to be returned.

[0301] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0302] See also Fig. 9 , is a structural diagram of a file downloading device provided in an embodiment of the present application, where the file downloading device is applied to a central server, and the central server is associated with multiple edge servers.

[0303] like Fig. 9 As shown, the device may include:

[0304] A fragmentation unit 910 is used to fragment the file to be downloaded according to the pre-download speed and file size of the file to be downloaded;

[0305] An allocating unit 920, configured to allocate the shards to the plurality of edge servers according to the obtained offsets of the shards, each edge server corresponding to a shard group;

[0306] A determining unit 930 is configured to aggregate the first total download speed obtained from each edge server to obtain a second total download speed, determine a download restriction type according to the second total download speed, and send the download restriction type to each edge server;

[0307] The sending unit 940 is configured to send the slices obtained from each edge server to the client in sequence according to the offsets of the slices.

[0308] In some embodiments, the device further comprises an acquisition unit, the acquisition unit being configured to acquire, through the central server, a file size of the file to be downloaded according to a download request for the file to be downloaded sent by the client;

[0309] The file to be downloaded is pre-downloaded for a second set time to obtain a pre-download speed of the file to be downloaded.

[0310] In some embodiments, the allocation unit 920 is specifically configured to:

[0311] The central server repeatedly performs the shard allocation step according to the order of the shard offsets until all the obtained shards are allocated to the plurality of edge servers, and the shard allocation step includes allocating a shard to each edge server in turn.

[0312] In some embodiments, the central server is pre-set with a grouping table, each entry in the grouping table corresponds to an edge server, and each entry includes an edge server IP address, a shard offset array, and a download path of the file to be downloaded;

[0313] The allocation unit 920 is further configured to:

[0314] For each shard assigned to each edge server, the offset of the shard is recorded in the shard offset array of the entry corresponding to the edge server;

[0315] According to the edge server IP address in each table entry, each table entry is sent to the corresponding edge server.

[0316] In some embodiments, the determining unit 930 is specifically configured to:

[0317] Determining whether the second total download speed is greater than the product of the pre-download speed, the number of edge servers, and a preset ratio;

[0318] If the second total download speed is greater than the product of the pre-download speed, the number of edge servers and the preset ratio, determining that the download restriction type is the first type, and the first type is the flow rate limit;

[0319] Otherwise, it is determined that the download restriction type is the second type, and the second type is source speed limitation.

[0320] In some embodiments, the central server is pre-configured with a to-be-returned offset start bit, and the initial value of the to-be-returned offset start bit is 0; the sending unit 940 is specifically configured to:

[0321] For each acquired slice, the first determination step is executed in a loop until the slice is sent to the client;

[0322] The first determination step comprises:

[0323] Determine whether the offset start bit of the slice is the same as the offset start bit to be returned;

[0324] If the offset start bit of the fragment is different from the offset start bit to be returned, storing the fragment;

[0325] If the offset start bit of the fragment is the same as the offset start bit to be returned, the fragment is sent to the client, and the offset start bit to be returned is updated according to the offset start bit of the fragment.

[0326] In some embodiments, the device further comprises an adjusting unit, wherein the adjusting unit is specifically configured to:

[0327] When the central server determines that the download restriction type is the first type and the product of the pre-download speed and the obtained number of shards is greater than the second total download speed, or when the central server determines that the download restriction type is the second type and the product of the pre-download speed and the number of edge servers is greater than the second total download speed, the number of executable download tasks is obtained according to the second total download speed and the pre-download speed;

[0328] According to the current offset start position to be returned, the number of executable download tasks and the pre-download speed, the download priority adjustment task is executed to control each edge server to preferentially download the segments with low offset.

[0329] The download priority adjustment task includes:

[0330] Obtaining a target offset start position according to the current offset start position to be returned, the number of executable download tasks, and the pre-download speed;

[0331] Determine whether the target offset start bit is greater than or equal to the file size of the file to be downloaded;

[0332] If the target offset start bit is greater than or equal to the file size of the file to be downloaded, a first control instruction is sent to each edge server to control each edge server to download the remaining segments, and the download priority adjustment task is terminated;

[0333] If the target offset starting bit is smaller than the file size of the file to be downloaded, a second control instruction is sent to each edge server to control each edge server to download the segments whose offset starting bit does not exceed the target offset starting bit, stop downloading the segments whose offset starting bit exceeds the target offset starting bit, and repeat the download priority adjustment task when the target offset starting bit is equal to the current offset starting bit to be returned.

[0334] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0335] See also Fig.10, is a structural diagram of a file downloading device provided in an embodiment of the present application, wherein the file downloading device is applied to an edge server, wherein the edge server is associated with a central server and corresponds to a fragment group, wherein the fragments in the fragment group are allocated to the edge server by the central server according to the offset of the obtained fragments.

[0336] like Fig.10 As shown, the device may include:

[0337] The first downloading unit 1010 is used to start a download task with the same number of fragments as the fragment group to download each fragment in the fragment group respectively, and summarize a first total download speed of the download task after a first set time, and send the first total download speed to the central server;

[0338] The second download unit 1020 is used to receive the download restriction type issued by the central server. When the download restriction type is the first type, the download tasks for the number of fragments are maintained, and the fragments downloaded by each download task and the offsets of the fragments are sent to the central server; when the download restriction type is the second type, the download tasks for the number of fragments are terminated, a single download task is started to download each fragment in the fragment group in turn, and the fragments downloaded by the single download task and the offsets of the fragments are sent to the central server, so that the central server can send the fragments obtained from each edge server to the client in turn according to the offsets of the fragments.

[0339] In some embodiments, the central server is pre-set with a grouping table, each entry in the grouping table corresponds to an edge server, and each entry includes an edge server IP address, a shard offset array, and a download path of the file to be downloaded;

[0340] The first downloading unit 1010 is specifically used for:

[0341] After receiving the table entry sent by the central server, each edge server creates download tasks with the same number of fragments as the fragment offset array of the table entry, each download task corresponding to a fragment in the fragment offset array;

[0342] For each download task, according to the download path of the file to be downloaded in the table entry and the offset of the segment corresponding to the download task, the download task is started to download the segment.

[0343] In some embodiments, the second downloading unit 1020 is specifically used to:

[0344] For each download task, a return channel is established between the download task and the central server;

[0345] Using the return channel, the offset of the segment downloaded by the download task is sent to the central server;

[0346] Determine whether the download of the segment is completed within the first set time;

[0347] If the download is completed, the segment is sent to the central server using the return channel, and the download task is terminated;

[0348] If the download is not completed, the download task is maintained, and the data downloaded by the download task is synchronously sent to the central server using the return channel until the download of the segments is completed, and the download task is terminated.

[0349] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0350] The present application embodiment also provides a hardware structure. Fig.11 , Fig.11 The hardware structure diagram of the electronic device provided in the embodiment of the present application is shown in FIG. Fig.11 As shown, the hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above example of this application.

[0351] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.

[0352] Exemplarily, the above-mentioned machine-readable storage medium may be any electronic, magnetic, optical or other physical storage device, which may contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium may be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.

[0353] It should be noted that, in this article, relational terms such as target and target are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0354] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A file downloading method, characterized in that: The method includes: The central server segments the file to be downloaded according to the pre-download speed and file size of the file to be downloaded; The central server distributes the shards to a plurality of edge servers associated with the central server according to the obtained offsets of the shards, each edge server corresponding to a shard group; Each edge server starts a download task with the same number of fragments as the corresponding fragment group to download each fragment in the fragment group respectively, and summarizes a first total download speed of the download task after a first set time, and sends the first total download speed to the central server; The central server aggregates the first total download speed of each edge server to obtain a second total download speed, determines a download restriction type according to the second total download speed, and sends the download restriction type to each edge server; In the case where the download restriction type is the first type, each edge server maintains the number of download tasks for the number of fragments, and sends the fragments downloaded by each download task and the offset of the fragments to the central server; in the case where the download restriction type is the second type, each edge server ends the number of download tasks for the number of fragments, starts a single download task to download each fragment in the fragment group in turn, and sends the fragments downloaded by the single download task and the offset of the fragment to the central server; The central server sends the fragments obtained from each edge server to the client in sequence according to the offset of the fragments.

2. The method according to claim 1, characterized in that Before segmenting the file to be downloaded, the method further includes: The central server obtains the file size of the file to be downloaded according to the download request for the file to be downloaded sent by the client; The file to be downloaded is pre-downloaded for a second set time to obtain a pre-download speed of the file to be downloaded.

3. The method according to claim 1, characterized in that: The central server distributes the shards to a plurality of edge servers associated with the central server according to the obtained offsets of the shards, including: The central server repeatedly performs the shard allocation step according to the order of the shard offsets until all the obtained shards are allocated to the plurality of edge servers, and the shard allocation step includes allocating a shard to each edge server in turn.

4. The method according to claim 1, characterized in that The central server is pre-set with a grouping table, each entry in the grouping table corresponds to an edge server, and each entry includes an edge server IP address, a shard offset array, and a download path of the file to be downloaded; After allocating the shards to a plurality of edge servers associated with the central server according to the obtained offsets of the shards, the method further includes: For each shard assigned to each edge server, the offset of the shard is recorded in the shard offset array of the entry corresponding to the edge server; According to the edge server IP address in each table entry, each table entry is sent to the corresponding edge server; Each edge server starts a download task with the same number of fragments as the corresponding fragment group to download each fragment in the fragment group, including: After receiving the table entry sent by the central server, each edge server creates download tasks with the same number of fragments as the fragment offset array of the table entry, and each download task corresponds to a fragment in the fragment offset array; For each download task, according to the download path of the file to be downloaded in the table entry and the offset of the segment corresponding to the download task, the download task is started to download the segment.

5. The method according to claim 1, characterized in that The determining the download restriction type according to the second total download speed includes: Determining whether the second total download speed is greater than the product of the pre-download speed, the number of edge servers, and a preset ratio; If the second total download speed is greater than the product of the pre-download speed, the number of edge servers and the preset ratio, determining that the download restriction type is the first type, and the first type is the flow rate limit; Otherwise, it is determined that the download restriction type is the second type, and the second type is source speed limitation.

6. The method according to claim 1, characterized in that The step of sending the downloaded segments and the offsets of the segments for each download task to the central server includes: For each download task, a return channel is established between the download task and the central server; Using the return channel, the offset of the segment downloaded by the download task is sent to the central server; Determine whether the download of the segment is completed within the first set time; If the download is completed, the segment is sent to the central server using the return channel, and the download task is terminated; If the download is not completed, the download task is maintained, and the data downloaded by the download task is synchronously sent to the central server using the return channel until the download of the segments is completed, and the download task is terminated.

7. The method according to claim 1, characterized in that The central server is pre-configured with a to-be-returned offset start bit, the initial value of which is 0, and the fragments obtained from each edge server are sent to the client in sequence according to the fragment offsets, including: For each acquired slice, the first determination step is executed in a loop until the slice is sent to the client; The first determination step comprises: Determine whether the offset start bit of the slice is the same as the offset start bit to be returned; If the offset start bit of the fragment is different from the offset start bit to be returned, storing the fragment; If the offset start bit of the fragment is the same as the offset start bit to be returned, the fragment is sent to the client, and the offset start bit to be returned is updated according to the offset start bit of the fragment.

8. The method according to claim 7, characterized in that The method further comprises: The central server obtains the number of executable download tasks according to the second total download speed and the pre-download speed when it is determined that the download restriction type is the first type and the product of the pre-download speed and the obtained number of shards is greater than the second total download speed, or when it is determined that the download restriction type is the second type and the product of the pre-download speed and the number of edge servers is greater than the second total download speed; According to the current offset start position to be returned, the number of executable download tasks and the pre-download speed, the download priority adjustment task is executed to control each edge server to preferentially download the segments with low offset.

9. The method according to claim 8, characterized in that The download priority adjustment task includes: Obtaining a target offset start position according to the current offset start position to be returned, the number of executable download tasks, and the pre-download speed; Determine whether the target offset start bit is greater than or equal to the file size of the file to be downloaded; If the target offset start bit is greater than or equal to the file size of the file to be downloaded, a first control instruction is sent to each edge server to control each edge server to download the remaining segments, and the download priority adjustment task is terminated; If the target offset starting bit is smaller than the file size of the file to be downloaded, a second control instruction is sent to each edge server to control each edge server to download the segments whose offset starting bit does not exceed the target offset starting bit, stop downloading the segments whose offset starting bit exceeds the target offset starting bit, and repeat the download priority adjustment task when the target offset starting bit is equal to the current offset starting bit to be returned.

10. A file downloading method, characterized in that: Applied to a central server, the central server being associated with a plurality of edge servers, the method comprising: Segmenting the file to be downloaded according to the pre-download speed and file size of the file to be downloaded; According to the obtained offsets of the shards, the shards are allocated to the plurality of edge servers, each edge server corresponding to a shard group; The first total download speed obtained from each edge server is aggregated to obtain a second total download speed, and a download restriction type is determined according to the second total download speed, and the download restriction type is sent to each edge server, so that each edge server maintains the number of download tasks of the fragments in the corresponding fragment group when the download restriction type is the first type, and ends the number of download tasks of the fragments when the download restriction type is the second type, and starts a single download task to download each fragment in the corresponding fragment group in sequence; The shards obtained from each edge server are sent to the client in sequence according to the offset of the shards.

11. A file downloading method, characterized in that: Applied to an edge server, the edge server is associated with a central server and corresponds to a shard group, the shards in the shard group are allocated to the edge server by the central server according to the offset of the obtained shards, the method comprising: Initiate a download task with the same number of fragments as the number of fragments in the fragment group to download each fragment in the fragment group respectively, and summarize a first total download speed of the download task after a first set time, and send the first total download speed to the central server; Receive the download restriction type issued by the central server, and when the download restriction type is the first type, maintain the download tasks for the number of fragments, and send the fragments downloaded by each download task and the offset of the fragment to the central server; when the download restriction type is the second type, end the download tasks for the number of fragments, start a single download task to download each fragment in the fragment group in turn, and send the fragments downloaded by the single download task and the offset of the fragment to the central server, so that the central server will send the fragments obtained from each edge server to the client in turn according to the offset of the fragment.

12. A file downloading device, characterized in that: The device includes: A fragmentation unit, used for fragmenting the file to be downloaded according to the pre-download speed and file size of the file to be downloaded through the central server; an allocating unit, configured to allocate the shards to a plurality of edge servers associated with the central server according to the offsets of the shards obtained through the central server, each edge server corresponding to a shard group; A first download unit is used to start a download task with the same number of fragments as the corresponding fragment group through each edge server to download each fragment in the fragment group respectively, and summarize a first total download speed of the download task after a first set time, and send the first total download speed to the central server; a determining unit, configured to aggregate the first total download speed of each edge server through the central server to obtain a second total download speed, determine a download restriction type according to the second total download speed, and send the download restriction type to each edge server; A second download unit is used for maintaining the number of download tasks of the fragments through each edge server when the download restriction type is the first type, and sending the fragments downloaded by each download task and the offset of the fragments to the central server; when the download restriction type is the second type, ending the number of download tasks of the fragments through each edge server, starting a single download task to download each fragment in the fragment group in turn, and sending the fragments downloaded by the single download task and the offset of the fragments to the central server; The sending unit is used to send the slices obtained from each edge server to the client in sequence according to the offset of the slice through the central server.

13. A file downloading device, characterized in that: Applied to a central server, the central server is associated with a plurality of edge servers, the device comprises: A fragmentation unit, used for fragmenting the file to be downloaded according to the pre-download speed and file size of the file to be downloaded; an allocating unit, configured to allocate the shards to the plurality of edge servers according to the obtained offsets of the shards, each edge server corresponding to a shard group; a determination unit, configured to summarize the first total download speed obtained from each edge server to obtain a second total download speed, determine a download restriction type according to the second total download speed, and send the download restriction type to each edge server, so that each edge server maintains a download task for the number of fragments in a corresponding fragment group when the download restriction type is the first type, terminates the download task for the number of fragments when the download restriction type is the second type, and starts a single download task to sequentially download each fragment in the corresponding fragment group; The sending unit is used to send the slices obtained from each edge server to the client in sequence according to the offset of the slices.

14. A file downloading device, characterized in that: Applied to an edge server, the edge server is associated with a central server and corresponds to a fragment group, the fragments in the fragment group are allocated to the edge server by the central server according to the offset of the obtained fragment, the device comprises: A first download unit is used to start a download task with the same number of fragments as the fragment group to download each fragment in the fragment group respectively, and summarize a first total download speed of the download task after a first set time, and send the first total download speed to the central server; The second download unit is used to receive the download restriction type issued by the central server, and when the download restriction type is the first type, maintain the download tasks for the number of fragments, and send the fragments downloaded by each download task and the offset of the fragment to the central server; when the download restriction type is the second type, end the download tasks for the number of fragments, start a single download task to download each fragment in the fragment group in turn, and send the fragments downloaded by the single download task and the offset of the fragment to the central server, so that the central server will send the fragments obtained from each edge server to the client in turn according to the offset of the fragment.

15. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor is used to execute the machine executable instructions to implement the method according to any one of claims 1 to 11.

16. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are executed by a processor, the method according to any one of claims 1 to 11 is implemented.

17. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • File downloading method and device based on Wi-Fi direct connection, equipment and medium

    CN115622992A