Resource Download Speed Control Method, Device, Equipment and Medium in Server Cluster

By dynamically controlling the resource download speed in the server cluster and calculating the ideal download time based on the download weight of the business party, the problem of resource download task congestion in the cloud mobile scenario is solved, and the balanced allocation of bandwidth resources of the server cluster and the satisfaction of resource download requirements of multiple business parties is achieved.

CN118118472BActive Publication Date: 2025-06-13GUANGZHOU DULING TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410364866.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-27
Publication Date
2025-06-13
Estimated Expiration
2044-03-27

AI Technical Summary

Technical Problem

In the cloud mobile scenario, due to bandwidth limitations, the computer room server is prone to congestion in resource download tasks, and the existing static speed limit mode cannot effectively meet the needs of multiple users and massive download tasks.

Method used

By dynamically controlling the resource download speed in the server cluster, the specific methods include obtaining the download time interval and actual time consumption of resource shards, backtracking and obtaining accompanying download tasks, and calculating the ideal download time according to the download weight of the business party. If the actual time consumption is less than the ideal time consumption, then wait for the difference time and execute the download of the next resource shard.

Benefits of technology

In the scenario of multi-service parties and massive download tasks, dynamic speed limit is performed to the smallest unit through resource sharding to ensure the balanced allocation of bandwidth resources of the server cluster to the greatest extent, and effectively meet the resource download needs of each service party.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118118472B_ABST
    Figure CN118118472B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, apparatus, device and medium for controlling the resource download speed in a server cluster, which relates to the field of computer technology, and particularly to the field of cloud mobile phones. The specific implementation solution is as follows: when the download of the current resource shard in the target resource download task is completed, obtain the download time interval and the actual download time consumed corresponding to the current resource shard; retrospectively obtain each accompanying download task executed in the server cluster under the download time interval; calculate the ideal download time consumed corresponding to the current resource shard according to the accompanying download service parties corresponding to the respective accompanying download tasks, the target service party corresponding to the target resource download task, and the download weights of the service parties; if the actual download time consumed is less than the ideal download time consumed, then wait for the difference time between the ideal download time consumed and the actual download time consumed, and then execute the download operation of the next resource shard of the target resource download task. The present disclosure can achieve dynamic speed limiting of the downloaded resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technologies, and more particularly to the field of cloud mobile phone technologies. Specifically, it relates to a method for controlling the resource download speed in a server cluster, a device for controlling the resource download speed in a server cluster, an electronic device, and a non-transitory computer-readable storage medium. Background Art

[0002] In the cloud mobile phone scenario, devices are managed at the computer room level. When implementing high-frequency functions such as cloud mobile phone file upload and mirror file update, it is necessary to first download the required resource files to be uploaded or updated to the computer room server, and then transfer them from the computer room server to the cloud mobile phone. These operations have extremely high requirements for the resource download capabilities of the computer room server. At this time, the computer room server involves a large number of public network resource download tasks. Limited by the limited bandwidth resources of the computer room, it is easy to occur that the download bandwidth is fully utilized, resulting in congestion of resource download tasks.

[0003] Currently, when the computer room server realizes resource download, for each public network download task, it requests resources from the public network resource party in the way of HTTP (Hypertext Transfer Protocol) short links. For the scenario where the download bandwidth is fully utilized, the currently commonly used technical means include modes such as network layer static speed limit or service layer static speed limit. However, no matter which of the above static speed limit modes is adopted, it cannot effectively meet the scenario requirements of multiple users and a large number of download tasks. Summary of the Invention

[0004] The present disclosure provides a method for controlling the resource download speed in a server cluster, a device for controlling the resource download speed in a server cluster, an electronic device, and a non-transitory computer-readable storage medium.

[0005] According to one aspect of the present disclosure, there is provided a method for controlling the resource download speed in a server cluster, including:

[0006] When the download of the current resource shard in the target resource download task is completed, obtain the download time interval corresponding to the current resource shard and the actual download time consumption;

[0007] Retrospectively obtain all accompanying download tasks executed in the server cluster within the download time interval;

[0008] According to the accompanying download service parties corresponding to the respective accompanying download tasks, the target service party corresponding to the target resource download task, and the download weights of the service parties, calculate the ideal download time consumption corresponding to the current resource shard;

[0009] If the actual download time is less than the ideal download time, after waiting for the difference between the ideal download time and the actual download time, perform the download operation on the next resource shard of the target resource download task.

[0010] According to another aspect of the present disclosure, there is also provided a method for controlling the resource download speed in a server cluster, including:

[0011] When detecting a target resource download task, request the total size of the resource file of the target resource from the resource server;

[0012] According to the total size of the resource file feedback by the resource server and the preset shard size, determine the number of shards corresponding to the target resource;

[0013] According to the number of shards, determine the number of threads for performing the target resource download task, and allocate the required resource shards for each thread;

[0014] Trigger each thread in parallel, and within each thread, serially execute the following operations:

[0015] When completing the download of the current resource shard in the target resource download task, obtain the download time interval corresponding to the current resource shard and the actual download time;

[0016] Retrospectively obtain all accompanying download tasks executed in the server cluster under the download time interval;

[0017] According to the accompanying download service parties corresponding to each of the accompanying download tasks, the target service party corresponding to the target resource download task, and the download weights of the service parties, calculate the ideal download time corresponding to the current resource shard;

[0018] If the actual download time is less than the ideal download time, after waiting for the difference between the ideal download time and the actual download time, perform the download operation on the next resource shard of the target resource download task.

[0019] According to another aspect of the present disclosure, there is also provided a device for controlling the resource download speed in a server cluster, including:

[0020] An actual download information acquisition module, configured to obtain the download time interval corresponding to the current resource shard and the actual download time when completing the download of the current resource shard in the target resource download task;

[0021] An accompanying download task retrospective module, configured to retrospectively obtain all accompanying download tasks executed in the server cluster under the download time interval;

[0022] An ideal download time determination module, configured to calculate the ideal download time corresponding to the current resource shard according to the associated download service providers corresponding to each of the associated download tasks, the target service provider corresponding to the target resource download task, and the download weights of the service providers;

[0023] A download speed adjustment module, configured to, if the actual download time is less than the ideal download time, wait for the difference time between the ideal download time and the actual download time, and then execute the download operation for the next resource shard of the target resource download task.

[0024] According to another aspect of the present disclosure, there is also provided a resource download speed control device in a server cluster, including:

[0025] A resource size request module, configured to request the total size of the resource file of the target resource from the resource server when detecting a target resource download task;

[0026] A shard number determination module, configured to determine the number of shards corresponding to the target resource according to the total size of the resource file fed back by the resource server and a preset shard size;

[0027] A resource shard determination module, configured to determine the number of threads for executing the target resource download task according to the number of shards, and allocate the resource shards to be downloaded to each thread;

[0028] A parallel-to-serial execution trigger module, configured to trigger each thread in parallel, and trigger the execution of the serial execution module within each thread;

[0029] A serial execution module, configured to serially execute: when completing the download of the current resource shard in the target resource download task, obtain the download time interval and the actual download time corresponding to the current resource shard; retrospectively obtain all the associated download tasks executed in the server cluster under the download time interval; calculate the ideal download time corresponding to the current resource shard according to the associated download service providers corresponding to each of the associated download tasks, the target service provider corresponding to the target resource download task, and the download weights of the service providers; if the actual download time is less than the ideal download time, wait for the difference time between the ideal download time and the actual download time, and then execute the download operation for the next resource shard of the target resource download task.

[0030] According to another aspect of the present disclosure, there is also provided an electronic device, including:

[0031] At least one processor; and

[0032] A memory communicatively connected to the at least one processor; wherein,

[0033] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the resource download speed control method in the server cluster as described in any one of the embodiments of the present disclosure.

[0034] According to another aspect of the present disclosure, there is also a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the resource download speed control method in the server cluster as described in any one of the embodiments of the present disclosure.

[0035] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. Description of the Drawings

[0036] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:

[0037] Figure 1 is a schematic diagram of a resource download speed control method in a server cluster provided according to an embodiment of the present disclosure;

[0038] Figure 2 is a schematic diagram of another resource download speed control method in a server cluster provided according to an embodiment of the present disclosure;

[0039] Figure 3 is a schematic diagram of yet another resource download speed control method in a server cluster provided according to an embodiment of the present disclosure;

[0040] Figure 4 is a schematic diagram of a resource download speed control method in a server cluster provided according to an embodiment of the present disclosure;

[0041] Figure 5 is a structural diagram of a resource download speed control device in a server cluster provided according to an embodiment of the present disclosure;

[0042] Figure 6 is a structural diagram of another resource download speed control device in a server cluster provided according to an embodiment of the present disclosure;

[0043] Figure 7 is a block diagram of an electronic device for implementing the resource download speed control method in a server cluster according to an embodiment of the present disclosure. Detailed Embodiments

[0044] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, descriptions of well-known functions and structures are omitted below for clarity and conciseness.

[0045] Figure 1 FIG. is a schematic diagram of a method for controlling the resource download speed in a server cluster provided by an embodiment of the present disclosure. This embodiment is applicable to the situation of dynamically limiting the download speed of a specific resource fragment in a target resource during the download process. This method can be executed by a resource download speed control device in the server cluster. The device can be implemented in the form of hardware and / or software and is generally configured in a server in the server cluster for performing resource download tasks. As Figure 1 shown, the method includes:

[0046] S110. When the download of the current resource fragment in the target resource download task is completed, obtain the download time interval corresponding to the current resource fragment and the actual download duration.

[0047] In this embodiment, when a specific target resource needs to be downloaded, a target resource download task can be first generated and assigned to a specific server in the server cluster, and the server can perform fragmented download of the target resource.

[0048] In a specific cloud mobile phone scenario, if a customer wants to upload a target cloud mobile phone file to a set cloud mobile phone, a corresponding target resource download task will be constructed with the target cloud mobile phone file as the target resource to download the target resource from the resource server to the server cluster, and then the target resource will be uploaded to the corresponding cloud mobile phone through the server cluster as an intermediary.

[0049] Correspondingly, the server can complete the download of the current resource fragment in the target resource download task by using the bandwidth resources in the server cluster. After the download of the current resource fragment is completed, the download time interval corresponding to the current resource fragment and the actual download duration can be obtained accordingly.

[0050] Among them, the download time interval can be [t1, t2], where t1 is the start time of the download of the current resource fragment, t2 is the end time of the download of the current resource fragment, and t2 - t1 is the actual download duration corresponding to the current resource fragment, that is, the actual time consumed to download the current resource fragment.

[0051] S120. Retrieve all associated download tasks executed in the server cluster during the retrieved download time interval by tracing back.

[0052] It can be understood that after determining the download time interval, the above download time interval is already equivalent to a historical time interval. Therefore, all associated download tasks executed in the server cluster during this historical time interval can be retrieved by tracing back. Among them, the associated download task can be understood as other download tasks executed during this historical time interval except for the target resource download task. The associated download task can be executed by any server in the server cluster (including the server executing the target resource download task), and this embodiment does not limit this.

[0053] It should be noted again that the associated download task only needs to be in the download state during the download time interval and does not need to be completed within this download time interval. By querying the associated download task, the overall occupancy of the total bandwidth resources in the server cluster by the download tasks can be grasped.

[0054] Specifically, a task query interface can be pre-constructed on each server in the server cluster respectively, which is used to query all download tasks in the server cluster that are in the download state during the set time interval.

[0055] S130. Calculate the ideal download time corresponding to the current resource shard according to the associated download service parties corresponding to each of the associated download tasks, the target service party corresponding to the target resource download task, and the download weights of the service parties.

[0056] In this embodiment, each download task in the server cluster corresponds to a service party that triggers the generation of this download task. This service party can be understood as the user who demands the target resource. Or, in the cloud mobile phone scenario, this service party can be understood as a third-party customer providing cloud mobile phone services (for example, a specific company).

[0057] In this embodiment, matching download weights can be set for each service party in advance. The above download weights can be related to the number of cloud mobile phones deployed by the service party. For example, the more cloud mobile phones a service party deploys, the higher the download weight of this service party. Or, the above download weights can also be related to the required download volume of the service party in the recent period (for example, one week, 15 days or one month, etc.). For example, the higher the required download volume of a service party in the recent period, the higher the download weight of this service party. Or, the above download weights can also be related to the type of cloud mobile phone applications provided by the service party. For example, if the cloud mobile phone application provided by a service party is a livelihood application, a relatively high download weight can be set for this service party.

[0058] In this embodiment, after obtaining the service providers of each associated download task, i.e., the associated download service providers, and the service provider of the target resource download task, i.e., the target service provider, the bandwidth resources (i.e., download speed) that can be provided to the target service provider can be first evaluated by combining the download weights of each service provider and all available bandwidth resources in the server cluster (which can also be understood as the maximum download speed that the server cluster can support when working properly). Finally, according to all the download tasks corresponding to the target service provider in this download time interval, the download speed that can be allocated to the target resource download task can be determined from the download speeds provided to the target service provider.

[0059] Specifically, according to the priority of each download task executed by the target service provider in this download time interval (for example, the priority of updating the mirror file is higher than that of the cloud phone file upload), the required download data volume of each download task executed by the target service provider, and the task issuance time point of each download task executed by the target service provider and other information, the download speed allocated to the target resource download task can be jointly determined. For example, if a download task has a higher priority, a larger required download data volume, and an earlier task issuance time point, the higher the download speed allocated to it.

[0060] Furthermore, according to this download speed and the data volume size of the current resource shard (which can also be understood as the shard size), the ideal download time corresponding to the current resource shard can be determined.

[0061] Correspondingly, this ideal download time can be understood as the most appropriate time required to download this current resource shard after fully considering the bandwidth resource balance among multiple service providers and the bandwidth balance among each download task under the same service provider.

[0062] S140. If the actual download time is less than the ideal download time, wait for the difference time between the ideal download time and the actual download time, and then perform the download operation on the next resource shard of the target resource download task.

[0063] In this embodiment, if the actual download time is less than the ideal download time, it means that the bandwidth resources of the server cluster consumed for downloading this current resource shard are greater than the bandwidth resources that this current resource shard should occupy. Therefore, if the download speed of the target resource download task is not restricted, it will cause the imbalance of bandwidth resource allocation and affect the download performance of other service providers or other download tasks of this target service provider.

[0064] Correspondingly, in this embodiment, the difference time between the ideal download time and the actual download time is calculated, and after waiting for this difference time, the download operation of the next resource shard of the target resource download task is continued. Through the above settings, the download time of the current resource shard is forced to be constrained under the ideal download time, and then the download speed excessively occupied by the current resource shard can be returned to other download tasks during this difference time, so as to ensure the balanced allocation of bandwidth resources in the server cluster to the greatest extent.

[0065] The technical solution of this embodiment of the present disclosure, when completing the download of the current resource shard in the target resource download task, obtains the download time interval corresponding to the current resource shard and the actual download time; retrospectively obtains all accompanying download tasks executed in the server cluster under the download time interval; calculates the ideal download time corresponding to the current resource shard according to the accompanying download service parties corresponding to each accompanying download task, the target service party corresponding to the target resource download task, and the download weights of the service parties; if the actual download time is less than the ideal download time, then after waiting for the difference time between the ideal download time and the actual download time, the technical means of performing the download operation of the next resource shard of the target resource download task can perform effective dynamic speed limit with the resource shards in the download task as the smallest unit in the scenario of multiple service parties and massive download tasks, ensure the balanced allocation of bandwidth resources in the server cluster to the greatest extent, and effectively meet the resource download requirements of each service party.

[0066] Figure 2 FIG. is a schematic diagram of another method for controlling the resource download speed in a server cluster provided by an embodiment of the present disclosure. This embodiment is optimized based on the above embodiments. In this embodiment, the operation of "calculating the ideal download time corresponding to the current resource shard according to the accompanying download service parties corresponding to each accompanying download task, the target service party corresponding to the target resource download task, and the download weights of the service parties" is further refined.

[0067] Correspondingly, as Figure 2 shown, the method may specifically include:

[0068] S210. When completing the download of the current resource shard in the target resource download task, obtain the download time interval corresponding to the current resource shard and the actual download time.

[0069] S220. Retrospectively obtain all accompanying download tasks executed in the server cluster under the download time interval.

[0070] S230. Calculate the first download speed allocation ratio corresponding to the current resource shard according to the download weights of each accompanying download service party and the target service party.

[0071] In this embodiment, the first download speed allocation ratio can be understood as: among all the bandwidth resources of the server cluster, the proportional value of the bandwidth resources that can be allocated to the target service party for download and use.

[0072] Optionally, calculating the first download speed allocation ratio corresponding to the current resource shard according to the download weights of each of the accompanying download service parties and the target service party may include:

[0073] Extract the service party identifiers in each of the accompanying download tasks, and perform deduplication processing on the extracted service party identifiers to obtain each of the accompanying download service parties; if the target service party is included in each of the accompanying download service parties, then accumulate and sum the download weights of each of the accompanying download service parties to obtain the total service party weight in the download time interval; calculate the ratio of the download weight of the target service party to the total service party weight as the first download speed allocation ratio.

[0074] Specifically, considering that download tasks emerge in response to the resource download requirements of service parties, therefore, a service party identifier can be carried in each download task to uniquely identify a service party. Correspondingly, after determining all the accompanying download tasks, by respectively extracting the service party identifiers in each accompanying download task and performing deduplication processing on the extracted service party identifiers, all the accompanying download service parties corresponding to each accompanying download task executed in the download time interval can be finally obtained.

[0075] Furthermore, if the target service party is included in all the accompanying download service parties, it indicates that the target service party also has other task download requirements in this download time interval. At this time, the download weights of each of the accompanying download service parties can be directly accumulated and summed to obtain the total service party weight in the download time interval, and calculate the ratio of the download weight of the target service party to the total service party weight as the first download speed allocation ratio.

[0076] In a specific example, assume that the target service party is service party 1, and all the accompanying download service parties are service party 1, service party 2, and service party 3. Assume that the download weight of service party 1 is A1, the download weight of service party 2 is A2, and the download weight of service party 3 is A3, then the first download speed allocation ratio is A1 / (A1 + A2 + A3).

[0077] Through the above settings, it can be effectively realized that in the same time interval, the bandwidth resources in the server cluster can be evenly distributed among multiple different service parties, avoiding the absolute occupation of the cluster bandwidth resources by one or a few service parties, so as to improve the resource download satisfaction of the service parties.

[0078] Based on the above embodiments, after obtaining each of the accompanying download service providers, it may further include:

[0079] If the target service provider is not included in each of the accompanying download service providers, then sum up the download weights of each of the accompanying download service providers to obtain a cumulative result; calculate the sum of the cumulative result and the download weight of the target service provider to obtain the total weight of the service providers in the download time interval; calculate the ratio of the download weight of the target service provider to the total weight of the service providers as the first download speed allocation ratio.

[0080] Through the above settings, it can further ensure that the number of service providers is used, rather than the number of tasks downloaded by the service providers, to allocate bandwidth resources, so as to meet the resource download requirements of each service provider at the same time.

[0081] In this alternative embodiment, if the target service provider is included in all the accompanying download service providers, it means that the target service provider has no other task download requirements in this download time interval. Therefore, when accumulating the total weight of the service providers in the download time interval, the download weight of this target service provider needs to be further added.

[0082] In another specific example, assume that the target service provider is service provider 1, and all the accompanying download service providers are service provider 2, service provider 3, and service provider 4. Assume that the download weight of service provider 1 is A1, the download weight of service provider 2 is A2, the download weight of service provider 3 is A3, and the download weight of service provider 4 is A4. Then the first download speed allocation ratio is A1 / (A1 + A2 + A3 + A4).

[0083] S240. Calculate a second download speed allocation ratio corresponding to the current resource shard according to the number of download tasks belonging to the target service provider in each of the accompanying download tasks.

[0084] In this embodiment, the second download speed allocation ratio can be understood as: among all the bandwidth resources allocated by the server cluster for the target service provider to download, the proportion value of the bandwidth resources that can be allocated for the current resource shard to download.

[0085] In an alternative embodiment of this embodiment, calculating a second download speed allocation ratio corresponding to the current resource shard according to the number of download tasks belonging to the target service provider in each of the accompanying download tasks may include:

[0086] Obtain the number of download tasks belonging to the target service provider in each of the accompanying download tasks, and increment the number of download tasks by one to obtain the total number of download tasks of the target service provider in the download time interval; calculate the reciprocal of the total number of download tasks as the second download speed allocation ratio corresponding to the current resource shard.

[0087] In this alternative embodiment, all download tasks of the target service provider are considered to have the same level of importance. Thus, the second download speed allocation ratio can be directly determined according to the number of download tasks belonging to the target service provider in each of the accompanying download tasks.

[0088] Specifically, if the number of download tasks is 5, the second download speed allocation ratio is 1 / (1 + 5) = 1 / 6.

[0089] Through the above settings, it is possible to evenly distribute all the bandwidth resources allocated by the server cluster for the target service provider to use for downloading among all the download tasks belonging to the target service provider, ensuring that the above bandwidth resources are evenly distributed among all the download tasks to simultaneously meet the download requirements of different download tasks of the same service provider.

[0090] In another alternative embodiment of this embodiment, the task weights of different download tasks in the target service provider can be first set. For example, the task weight of each download task can be determined according to one or more of the foregoing priority of each download task, the required download data volume, and the task issuance time point. Then, in combination with the task weights, the second download speed allocation ratio is determined.

[0091] In a specific example, the number of download tasks belonging to the target service provider in each of the accompanying download tasks is 2, namely download task 1 and download task 2. By calculation, the task weight of download task 1 is determined to be B1, the task weight of download task 2 is determined to be B2, and the task weight of the target resource download task is B3. Then, the second download speed allocation ratio can be determined as B3 / (B1 + B2 + B3).

[0092] Through the above settings, all the bandwidth resources allocated by the server cluster for the target service provider to use for downloading are subjected to a certain degree of inclination processing according to the importance of different download tasks, so as to meet the download requirements of important download tasks to the greatest extent.

[0093] S250. Calculate the ideal download speed corresponding to the current resource shard according to the first download speed allocation ratio, the second download speed allocation ratio, and the standard download speed of the server cluster.

[0094] Specifically, the result of the standard download speed * the first download speed allocation ratio * the second download speed allocation ratio can be used as the ideal download speed corresponding to the current resource shard.

[0095] Among them, the standard download speed is the maximum cluster download speed when the server cluster does not reach the resource bandwidth limit and can provide the optimal download performance. Specifically, the ideal download speed can be determined according to experience or actual measurement results, and this embodiment does not limit this.

[0096] S260. Calculate the ideal download time corresponding to the current resource shard according to the ideal download speed and the shard size of the current resource shard.

[0097] In this embodiment, by calculating the result of dividing the shard size by the ideal download speed, the ideal download time corresponding to the current resource shard is obtained.

[0098] S270. If the actual download time is less than the ideal download time, wait for the difference time between the ideal download time and the actual download time, and then perform the download operation on the next resource shard of the target resource download task.

[0099] The technical solution of the embodiment of the present disclosure calculates the first download speed allocation ratio corresponding to the current resource shard by calculating the download weights of each accompanying download service party and the target service party; calculates the second download speed allocation ratio corresponding to the current resource shard according to the number of download tasks belonging to the target service party in each accompanying download task; calculates the ideal download speed corresponding to the current resource shard according to the first download speed allocation ratio, the second download speed allocation ratio, and the standard download speed of the server cluster; calculates the ideal download time corresponding to the current resource shard according to the ideal download speed and the shard size of the current resource shard. This technical means can not only avoid the problem that the bandwidth usage reaches the upper limit (commonly known as bandwidth saturation) when there are a large number of public network resource downloads in the server cluster at the same time, resulting in download congestion and download failure, but also avoid the problem that when sharing download resources among multiple service parties, when the download resource demand of a single service party surges, it affects the normal downloads of all other service parties. It can ensure the balanced allocation of bandwidth resources in the server cluster to the greatest extent in the scenario of multiple service parties and a large number of download tasks.

[0100] Figure 3 It is a schematic diagram of another method for controlling the resource download speed in a server cluster provided according to an embodiment of the present disclosure. This embodiment optimizes the above embodiments as the technology. In this embodiment, the process of determining the download weights of each service party is further refined.

[0101] Correspondingly, as Figure 3 described, the method may specifically include:

[0102] S310. Whenever the download weight update condition of the service provider is met, obtain the historical monitoring time that matches the download weight update condition of the service provider.

[0103] Among them, the download weight update condition of the service provider can be understood as the trigger condition for the download weight update operation of the service provider. It can be a simple time trigger condition. For example, the download weight update operation of the service provider is performed once every month or two months. Or, the resource download satisfaction of each service provider can be obtained in real time. When the resource download satisfaction of a service provider is lower than the preset satisfaction threshold, it is determined that the download weight update condition of the service provider is met.

[0104] The historical monitoring time is a historical time interval, and its value can be preset according to the actual situation. For example, starting from the current time point, trace back 1 month or 2 months, etc.

[0105] S320. Under the historical monitoring time, collect the total data download volume of each download task executed by each service provider in the server cluster.

[0106] S330. Determine the download weight corresponding to each service provider according to the total data download volume of each service provider.

[0107] In this embodiment, the total data download volume of the service provider in the recent period can be used as the basis for determining the download weight of the service provider. Typically, the larger the total data download volume of a service provider, the greater the download weight of the service provider.

[0108] Through the above settings, the download weight of the service provider can be dynamically updated according to the actual download requirements of the service provider, and the bandwidth resources of the server cluster can be evenly distributed among multiple service providers in a more scientific way.

[0109] Furthermore, other factors can also be considered when determining the download weight of the service provider. For example, in the cloud mobile phone application scenario, the number of cloud mobile phones deployed by the service provider can be further considered. The more cloud mobile phones, the greater the download weight of the service provider. Or, the cloud mobile phone application operation attributes of the service provider can be further considered, such as game type, livelihood type, or consulting type, etc. Furthermore, the download weights of different service providers can be set according to the cloud mobile phone application operation attributes.

[0110] Of course, those skilled in the art can select appropriate reference factors to determine the download weight of the service provider according to the actual application scenario, and this embodiment does not limit this.

[0111] S340. When the download of the current resource slice in the target resource download task is completed, obtain the download time interval corresponding to the current resource slice and the actual download time consumption.

[0112] S350. Retroactively obtain all associated download tasks executed in the server cluster within the download time interval.

[0113] S360. Calculate the ideal download time consumption corresponding to the current resource slice according to the associated download service parties corresponding to each of the associated download tasks, the target service party corresponding to the target resource download task, and the download weights of the service parties.

[0114] S370. Determine whether the actual download time consumption is less than the ideal download time consumption: if so, execute S380; otherwise, execute S390.

[0115] S380. After waiting for the difference time between the ideal download time consumption and the actual download time consumption, execute the download operation for the next resource slice of the target resource download task.

[0116] S390. Directly execute the download operation for the next resource slice of the target resource.

[0117] In the embodiments of the present disclosure, if it is determined that the actual download time consumption is greater than the ideal download time consumption, it means that insufficient bandwidth resources are provided to the current resource slice during the download process of the current resource slice of the target resource. Furthermore, there is no need to limit the speed of the above download process, and the download operation for the next resource slice of the target resource can be directly started. Through the above settings, an effective dynamic speed limit process can be further realized, and the dynamic balance of bandwidth resources in the server cluster can be achieved.

[0118] The technical solution of the embodiments of the present disclosure can dynamically update the download weights of the service parties according to the actual download requirements of the service parties by obtaining the historical monitoring time matching the service party download weight update condition whenever the service party download weight update condition is met; collecting the total data download amounts of each download task executed by each of the service parties in the server cluster at the historical monitoring time; and determining the download weights corresponding to each of the service parties according to the total data download amounts of each of the service parties, so as to achieve the balanced distribution of bandwidth resources in the server cluster among multiple service parties in a more scientific manner.

[0119] Figure 4It is a schematic diagram of a method for controlling the resource download speed in a server cluster provided by an embodiment of the present disclosure. This embodiment is applicable to the situation of dynamically limiting the download speed of the entire target resource download task during the complete download process of the target resource download task. This method can be executed by a resource download speed control device in the server cluster, and this device can be implemented in the form of hardware and / or software, and is generally configured in the server in the server cluster for executing the resource download task. As Figure 4 shown, the method includes:

[0120] S410. When detecting a target resource download task, request the total size of the resource file of the target resource from the resource server.

[0121] In this embodiment, in order to implement dynamic speed limiting in units of resource shards, after the server receives the target resource download task triggered by the target service party, it first requests the data volume size of the target resource, that is, the total size of the resource file, from the resource server storing the target resource.

[0122] S420. Determine the number of shards corresponding to the target resource according to the total size of the resource file fed back by the resource server and a preset shard size.

[0123] In this embodiment, a fixed shard size can be preset (of course, the shard size can also be determined dynamically), such as 1M, 2M, or 10M, etc., and the number of shards for the target resource is determined based on the ratio of the total size of the resource file divided by the shard size.

[0124] S430. Determine the number of threads for executing the target resource download task according to the number of shards, and allocate the resource shards required for download to each thread.

[0125] It can be understood that if the number of shards is small, only one thread can be started to execute the target resource download task; if the number of shards is large, two or more threads can be selected to jointly execute the target resource download task.

[0126] In a specific example, if the number of shards is 20, 2 threads can be started, thread 1 and thread 2, and the resource shards numbered 1-10 are allocated to thread 1 for download, and the resource shards numbered 11-20 are allocated to thread 2 for download.

[0127] S440. Trigger each thread in parallel, and serially execute the following S450-S480 within each thread.

[0128] In this embodiment, since different threads execute different resource shard download tasks, the execution of each thread can be controlled in a parallel manner. And within each thread, the dynamic speed limit process during the download of each resource shard is realized in a serial execution manner.

[0129] S450. When the download of the current resource shard in the target resource download task is completed, obtain the download time interval corresponding to the current resource shard and the actual download duration.

[0130] S460. Retroactively obtain all the accompanying download tasks executed in the server cluster within the download time interval.

[0131] S470. Calculate the ideal download duration corresponding to the current resource shard according to the accompanying download service providers corresponding to the respective accompanying download tasks, the target service provider corresponding to the target resource download task, and the download weights of the service providers.

[0132] S480. If the actual download duration is less than the ideal download duration, wait for the difference time between the ideal download duration and the actual download duration, and then execute the download operation for the next resource shard of the target resource download task.

[0133] The technical solution of the embodiment of the present disclosure, by obtaining the download time interval corresponding to the current resource shard and the actual download duration when the download of the current resource shard in the target resource download task is completed; retroactively obtaining all the accompanying download tasks executed in the server cluster within the download time interval; calculating the ideal download duration corresponding to the current resource shard according to the accompanying download service providers corresponding to the respective accompanying download tasks, the target service provider corresponding to the target resource download task, and the download weights of the service providers; if the actual download duration is less than the ideal download duration, waiting for the difference time between the ideal download duration and the actual download duration and then executing the download operation for the next resource shard of the target resource download task, can perform effective dynamic speed limit with the resource shards in the download task as the smallest unit in the scenario of multiple service providers and massive download tasks, ensure the balanced allocation of bandwidth resources in the server cluster to the greatest extent, and effectively meet the resource download requirements of each service provider.

[0134] As an implementation of the above resource download speed control method in each server cluster, the present disclosure also provides an optional embodiment of an execution device for implementing the above resource download speed control method in each server cluster.

[0135] Figure 5 It is a structural diagram of a resource download speed control device in a server cluster provided according to an embodiment of the present disclosure. As Figure 5As shown in the figure, the device specifically includes: an actual download information acquisition module 510, an accompanying download task backtracking module 520, an ideal download time determination module 530, and a download speed adjustment module 540, where:

[0136] The actual download information acquisition module 510 is configured to obtain a download time interval and an actual download time corresponding to the current resource shard when completing the download of the current resource shard in the target resource download task;

[0137] The accompanying download task backtracking module 520 is configured to backtrack and obtain all accompanying download tasks executed in the server cluster during the download time interval;

[0138] The ideal download time determination module 530 is configured to calculate an ideal download time corresponding to the current resource shard according to the accompanying download service parties corresponding to the respective accompanying download tasks, the target service party corresponding to the target resource download task, and the download weights of the service parties;

[0139] The download speed adjustment module 540 is configured to, if the actual download time is less than the ideal download time, wait for the difference time between the ideal download time and the actual download time, and then execute the download operation of the next resource shard of the target resource download task.

[0140] The technical solution of the embodiment of the present disclosure obtains a download time interval and an actual download time corresponding to the current resource shard when completing the download of the current resource shard in the target resource download task; backtracks and obtains all accompanying download tasks executed in the server cluster during the download time interval; calculates an ideal download time corresponding to the current resource shard according to the accompanying download service parties corresponding to the respective accompanying download tasks, the target service party corresponding to the target resource download task, and the download weights of the service parties; and if the actual download time is less than the ideal download time, waits for the difference time between the ideal download time and the actual download time, and then executes the download operation of the next resource shard of the target resource download task. By means of this technical means, in a scenario of multiple service parties and a large number of download tasks, effective dynamic speed limit can be performed with the resource shard of the download task as the smallest unit, and the balanced distribution of bandwidth resources in the server cluster can be ensured to the greatest extent, effectively meeting the resource download requirements of each service party.

[0141] Based on the above embodiments, the ideal download time determination module includes:

[0142] The first ratio calculation unit is configured to calculate a first download speed allocation ratio corresponding to the current resource shard according to the download weights of the respective accompanying download service parties and the target service party;

[0143] A second ratio calculation unit, configured to calculate a second download speed allocation ratio corresponding to the current resource shard according to the number of download tasks belonging to the target service provider in each of the accompanying download tasks;

[0144] An ideal download speed calculation unit, configured to calculate an ideal download speed corresponding to the current resource shard according to the first download speed allocation ratio, the second download speed allocation ratio, and the standard download speed of the server cluster;

[0145] An ideal download time calculation unit, configured to calculate an ideal download time corresponding to the current resource shard according to the ideal download speed and the shard size of the current resource shard.

[0146] Based on the above embodiments, wherein the first ratio calculation unit is specifically configured to:

[0147] Extract the service provider identifiers in each of the accompanying download tasks, and perform a deduplication process on the extracted service provider identifiers to obtain each of the accompanying download service providers;

[0148] If the target service provider is included in each of the accompanying download service providers, then accumulate and sum the download weights of each of the accompanying download service providers to obtain the total service provider weight in the download time interval;

[0149] Calculate the ratio of the download weight of the target service provider to the total service provider weight as the first download speed allocation ratio.

[0150] Based on the above embodiments, the first ratio calculation unit is further configured to:

[0151] After obtaining each of the accompanying download service providers, if the target service provider is not included in each of the accompanying download service providers, then accumulate and sum the download weights of each of the accompanying download service providers to obtain an accumulation result;

[0152] Calculate the sum of the accumulation result and the download weight of the target service provider to obtain the total service provider weight in the download time interval;

[0153] Calculate the ratio of the download weight of the target service provider to the total service provider weight as the first download speed allocation ratio.

[0154] Based on the above embodiments, wherein the second ratio calculation unit is specifically configured to:

[0155] Obtain the number of download tasks belonging to the target service provider in each of the accompanying download tasks, and perform an increment operation on the number of download tasks to obtain the total number of download tasks of the target service provider in the download time interval;

[0156] Calculate the reciprocal of the total amount of the download tasks as the second download speed allocation ratio corresponding to the current resource shard.

[0157] Based on the above embodiments, it further includes a normal download module for:

[0158] After calculating the ideal download duration corresponding to the current resource shard, if the actual download duration is greater than or equal to the ideal download duration, directly execute the download operation for the next resource shard of the target resource.

[0159] Based on the above embodiments, it further includes a download weight determination module for:

[0160] Whenever the service provider download weight update condition is satisfied, obtain the historical monitoring time that matches the service provider download weight update condition;

[0161] At the historical monitoring time, collect the total data download amounts of the download tasks executed by each service provider in the server cluster;

[0162] Determine the download weights corresponding to each service provider according to the total data download amounts of each service provider.

[0163] The above product can execute the method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects for executing the method.

[0164] As an implementation of the resource download speed control method in the above server clusters, the present disclosure also provides an optional embodiment of an execution device for implementing the resource download speed control method in the above server clusters.

[0165] Figure 6 It is a structural diagram of a resource download speed control device in a server cluster provided according to an embodiment of the present disclosure. As Figure 6 shown, the device specifically includes:

[0166] A resource size request module 610, configured to request the total size of the resource file of the target resource from a resource server when detecting a target resource download task;

[0167] A shard number determination module 620, configured to determine the number of shards corresponding to the target resource according to the total size of the resource file fed back by the resource server and a preset shard size;

[0168] A resource shard determination module 630, configured to determine the number of threads for executing the target resource download task according to the number of shards, and allocate the resource shards required for each thread;

[0169] A parallel-to-serial execution trigger module 640, configured to trigger each thread in parallel and, within each thread, trigger the execution of a serial execution module 650;

[0170] The serial execution module 650 is configured to perform serial execution: when the download of the current resource shard in the target resource download task is completed, obtain the download time interval corresponding to the current resource shard and the actual download duration; retrospectively obtain all associated download tasks executed in the server cluster during the download time interval; calculate the ideal download duration corresponding to the current resource shard according to the associated download service providers corresponding to the associated download tasks, the target service provider corresponding to the target resource download task, and the download weights of the service providers; if the actual download duration is less than the ideal download duration, wait for the difference time between the ideal download duration and the actual download duration, and then perform the download operation on the next resource shard of the target resource download task.

[0171] Through the technical solution of the embodiment of the present disclosure, when the download of the current resource shard in the target resource download task is completed, the download time interval corresponding to the current resource shard and the actual download duration are obtained; retrospectively obtain all associated download tasks executed in the server cluster during the download time interval; calculate the ideal download duration corresponding to the current resource shard according to the associated download service providers corresponding to the associated download tasks, the target service provider corresponding to the target resource download task, and the download weights of the service providers; if the actual download duration is less than the ideal download duration, wait for the difference time between the ideal download duration and the actual download duration, and then perform the download operation on the next resource shard of the target resource download task. This technical means can perform effective dynamic speed limit with the resource shards in the download task as the smallest unit in the scenario of multiple service providers and a large number of download tasks, and ensure the balanced allocation of bandwidth resources in the server cluster to the greatest extent, effectively meeting the resource download requirements of each service provider.

[0172] The above product can execute the method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the executed method.

[0173] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, and disclosure of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0174] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0175] Figure 7FIG. shows a schematic block diagram of an exemplary electronic device 700 that can be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, for example, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0176] As Figure 7 shown, the device 700 includes a computing unit 701 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0177] A plurality of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0178] The computing unit 701 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 executes the various methods and processes described above, for example: executing the resource download speed control method in a server cluster as described in any embodiment of the present disclosure. For example, in some embodiments, the resource download speed control method in a server cluster as described in any embodiment of the present disclosure can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the resource download speed control method in a server cluster as described in any embodiment of the present disclosure can be executed. Alternatively, in other embodiments, the computing unit 701 can be configured to execute a resource download speed control method in a server cluster as described in any embodiment of the present disclosure by any other suitable means (for example, by means of firmware).

[0179] That is, when the download of the current resource shard in the target resource download task is completed, obtain the download time interval corresponding to the current resource shard and the actual download time consumption; retrospectively obtain all the accompanying download tasks executed in the server cluster during the download time interval; calculate the ideal download time consumption corresponding to the current resource shard according to the accompanying download service parties corresponding to each of the accompanying download tasks, the target service party corresponding to the target resource download task, and the download weights of the service parties; if the actual download time consumption is less than the ideal download time consumption, wait for the difference time between the ideal download time consumption and the actual download time consumption, and then execute the download operation of the next resource shard of the target resource download task.

[0180] Or, it is configured to execute another resource download speed control method in a server cluster as described in any embodiment of the present disclosure.

[0181] That is: when a target resource download task is detected, request the total size of the resource file of the target resource from the resource server;

[0182] Determine the number of shards corresponding to the target resource according to the total size of the resource file fed back by the resource server and the preset shard size;

[0183] Determine the number of threads for executing the target resource download task according to the number of shards, and allocate the resource shards to be downloaded to each thread;

[0184] Trigger each thread in parallel, and within each thread, serially execute the following operations:

[0185] When the download of the current resource shard in the target resource download task is completed, obtain the download time interval corresponding to the current resource shard and the actual download time consumption;

[0186] Retrospectively obtain all the accompanying download tasks executed in the server cluster during the download time interval;

[0187] Calculate the ideal download time consumption corresponding to the current resource shard according to the accompanying download service providers corresponding to the accompanying download tasks, the target service provider corresponding to the target resource download task, and the download weights of the service providers;

[0188] If the actual download time consumption is less than the ideal download time consumption, wait for the difference time between the ideal download time consumption and the actual download time consumption, and then execute the download operation of the next resource shard of the target resource download task.

[0189] The various embodiments of the systems and techniques described above in this article can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs, the one or more computer programs being executable and / or interpretable on a programmable system including at least one programmable processor, the programmable processor can be a dedicated or general-purpose programmable processor, receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0190] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a dedicated computer, or other programmable data processing devices, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program codes can be executed entirely on the machine, partially on the machine, executed partially on the machine and partially on a remote machine as an independent software package, or executed entirely on a remote machine or server.

[0191] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0192] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).

[0193] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0194] A computer system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services. The server can also be a server of a distributed system or a server combined with blockchain.

[0195] Artificial intelligence is a discipline that studies the use of computers to simulate certain thinking processes and intelligent behaviors of humans (such as learning, reasoning, thinking, planning, etc.), and has both hardware-level technologies and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include several major directions such as computer vision technology, speech recognition technology, natural language processing technology, machine learning / deep learning technology, big data processing technology, and knowledge graph technology.

[0196] Cloud computing refers to a technical system that accesses an elastic and scalable shared physical or virtual resource pool through a network. The resources can include servers, operating systems, networks, software, applications, and storage devices, etc., and the resources can be deployed and managed in a on-demand and self-service manner. Through cloud computing technology, it can provide efficient and powerful data processing capabilities for the application and model training of technologies such as artificial intelligence and blockchain.

[0197] It should be understood that various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions provided in this disclosure can be achieved, and no limitations are imposed herein.

[0198] The above specific embodiments do not constitute a limitation to the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.

Claims

1. A method for controlling resource download speed in a server cluster, comprising: When the download of the current resource segment in the target resource download task is completed, the download time interval and the actual download time corresponding to the current resource segment are obtained; Backtracking to obtain all accompanying download tasks executed in the server cluster during the download time interval; wherein the accompanying download tasks are other download tasks executed during the download time interval except the target resource download task; and the accompanying download tasks are in a downloading state during the download time interval and do not need to complete the download during the download time interval; Calculate a first download speed allocation ratio corresponding to the current resource slice according to the download weights of each of the accompanying download service parties and the target service party; wherein the first download speed allocation ratio is a ratio of bandwidth resources allocated to the target service party for download in all bandwidth resources of the server cluster; Calculate a second download speed allocation ratio corresponding to the current resource slice according to the number of download tasks belonging to the target business party in each of the accompanying download tasks; wherein the second download speed allocation ratio is the proportion of bandwidth resources allocated to the current resource slice for downloading in all bandwidth resources allocated by the server cluster to the target business party for downloading; Calculating an ideal download speed corresponding to the current resource slice according to the first download speed allocation ratio, the second download speed allocation ratio, and a standard download speed of the server cluster; Calculating an ideal download time corresponding to the current resource fragment according to the ideal download speed and the fragment size of the current resource fragment; If the actual downloading time is less than the ideal downloading time, the downloading operation of the next resource segment of the target resource downloading task is performed after waiting for the difference time between the ideal downloading time and the actual downloading time.

2. The method according to claim 1, wherein: The calculating, according to the download weights of the accompanying download service parties and the target service party, a first download speed allocation ratio corresponding to the current resource slice comprises: Extracting a business party identifier from each of the accompanying download tasks, and performing deduplication processing on the extracted business party identifiers to obtain each of the accompanying download business parties; If the target service provider is included in each of the accompanying download service providers, the download weights of each of the accompanying download service providers are accumulated and summed to obtain a total weight of the service providers in the download time interval; A ratio of the download weight of the target service provider to the total weight of the service providers is calculated as the first download speed allocation ratio.

3. The method according to claim 2, after obtaining each of the accompanying download service providers, further comprising: If the target service provider is not included in the accompanying download service providers, the download weights of the accompanying download service providers are accumulated and summed to obtain an accumulated result; Calculate the sum of the accumulated result and the download weight of the target service provider to obtain the total weight of the service provider in the download time interval; A ratio of the download weight of the target service provider to the total weight of the service providers is calculated as the first download speed allocation ratio.

4. The method according to claim 1, wherein: The calculating, according to the number of download tasks belonging to the target service party in each of the accompanying download tasks, a second download speed allocation ratio corresponding to the current resource slice comprises: Obtaining the number of download tasks belonging to the target business party in each of the accompanying download tasks, and adding one to the number of download tasks to obtain the total number of download tasks of the target business party in the download time interval; The inverse of the total amount of the download task is calculated as a second download speed allocation ratio corresponding to the current resource slice.

5. The method according to any one of claims 1 to 4, after calculating the ideal download time corresponding to the current resource fragment, further comprising: If the actual downloading time is greater than or equal to the ideal downloading time, the downloading operation of the next resource segment of the target resource is directly executed.

6. The method according to any one of claims 1 to 4, further comprising: Whenever a business party download weight update condition is met, a historical monitoring time matching the business party download weight update condition is obtained; Collecting the total amount of data downloaded by each download task executed by each of the business parties in the server cluster during the historical monitoring time; According to the total amount of data downloaded by each of the business parties, a download weight corresponding to each of the business parties is determined.

7. A method for controlling resource download speed in a server cluster, comprising: When a target resource download task is detected, the total resource file size of the target resource is requested from the resource server; Determine the number of shards corresponding to the target resource according to the total size of the resource file fed back by the resource server and the preset shard size; According to the number of shards, determine the number of threads used to execute the target resource download task, and allocate the resource shards required to be downloaded to each thread; Trigger each thread in parallel, and execute the following operations serially within each thread: When the download of the current resource segment in the target resource download task is completed, the download time interval and the actual download time corresponding to the current resource segment are obtained; Backtracking to obtain all accompanying download tasks executed in the server cluster during the download time interval; wherein the accompanying download tasks are other download tasks executed during the download time interval except the target resource download task; and the accompanying download tasks are in a downloading state during the download time interval and do not need to complete the download during the download time interval; Calculate a first download speed allocation ratio corresponding to the current resource slice according to the download weights of each of the accompanying download service parties and the target service party; wherein the first download speed allocation ratio is a ratio of bandwidth resources allocated to the target service party for download in all bandwidth resources of the server cluster; Calculate a second download speed allocation ratio corresponding to the current resource slice according to the number of download tasks belonging to the target business party in each of the accompanying download tasks; wherein the second download speed allocation ratio is the proportion of bandwidth resources allocated to the current resource slice for downloading in all bandwidth resources allocated by the server cluster to the target business party for downloading; Calculating an ideal download speed corresponding to the current resource slice according to the first download speed allocation ratio, the second download speed allocation ratio, and a standard download speed of the server cluster; Calculating an ideal download time corresponding to the current resource fragment according to the ideal download speed and the fragment size of the current resource fragment; If the actual downloading time is less than the ideal downloading time, the downloading operation of the next resource segment of the target resource downloading task is performed after waiting for the difference time between the ideal downloading time and the actual downloading time.

8. A resource download speed control device in a server cluster, comprising: The actual download information acquisition module is used to acquire the download time interval and the actual download time corresponding to the current resource fragment when the download of the current resource fragment in the target resource download task is completed; The accompanying download task backtracking module is used to backtrack and obtain all the accompanying download tasks executed in the server cluster during the download time interval; wherein the accompanying download tasks are other download tasks executed during the download time interval except the target resource download task; and the accompanying download tasks are in a downloading state during the download time interval and do not need to complete the download during the download time interval; The module for determining the ideal downloading time includes: A first ratio calculation unit is used to calculate a first download speed allocation ratio corresponding to the current resource slice according to the download weights of each of the accompanying download service parties and the target service party; wherein the first download speed allocation ratio is a ratio of bandwidth resources allocated to the target service party for download in all bandwidth resources of the server cluster; A second ratio calculation unit is used to calculate a second download speed allocation ratio corresponding to the current resource slice according to the number of download tasks belonging to the target business party in each of the accompanying download tasks; wherein the second download speed allocation ratio is a ratio of bandwidth resources allocated to the current resource slice for downloading in all bandwidth resources allocated by the server cluster to the target business party for downloading; an ideal download speed calculation unit, configured to calculate an ideal download speed corresponding to the current resource slice according to the first download speed allocation ratio, the second download speed allocation ratio, and a standard download speed of the server cluster; An ideal download time calculation unit, used to calculate an ideal download time corresponding to the current resource fragment according to the ideal download speed and the fragment size of the current resource fragment; The download speed adjustment module is used to execute the download operation of the next resource segment of the target resource download task after waiting for the difference time between the ideal download time and the actual download time if the actual download time is less than the ideal download time.

9. The device according to claim 8, wherein: The first ratio calculation unit is specifically configured to: Extracting a business party identifier from each of the accompanying download tasks, and performing deduplication processing on the extracted business party identifiers to obtain each of the accompanying download business parties; If the target service provider is included in each of the accompanying download service providers, the download weights of each of the accompanying download service providers are accumulated and summed to obtain a total weight of the service providers in the download time interval; A ratio of the download weight of the target service provider to the total weight of the service providers is calculated as the first download speed allocation ratio.

10. The apparatus according to claim 9, wherein the first ratio calculation unit is further configured to: After obtaining the accompanying download service providers, if the accompanying download service providers do not include the target service provider, the download weights of the accompanying download service providers are accumulated and summed to obtain an accumulated result; Calculate the sum of the accumulated result and the download weight of the target service provider to obtain the total weight of the service provider in the download time interval; A ratio of the download weight of the target service provider to the total weight of the service providers is calculated as the first download speed allocation ratio.

11. The device according to claim 8, wherein: The second ratio calculation unit is specifically used for: Obtaining the number of download tasks belonging to the target business party in each of the accompanying download tasks, and adding one to the number of download tasks to obtain the total number of download tasks of the target business party in the download time interval; The inverse of the total amount of the download task is calculated as a second download speed allocation ratio corresponding to the current resource slice.

12. The device according to any one of claims 8 to 11, further comprising a normal download module, configured to: After calculating the ideal downloading time corresponding to the current resource fragment, if the actual downloading time is greater than or equal to the ideal downloading time, the downloading operation of the next resource fragment of the target resource is directly performed.

13. The apparatus according to any one of claims 8 to 12, further comprising a download weight determination module, configured to: Whenever a business party download weight update condition is met, a historical monitoring time matching the business party download weight update condition is obtained; Collecting the total amount of data downloaded by each download task executed by each of the business parties in the server cluster during the historical monitoring time; According to the total amount of data downloaded by each of the business parties, a download weight corresponding to each of the business parties is determined.

14. A resource download speed control device in a server cluster, comprising: The resource size request module is used to request the total resource file size of the target resource from the resource server when a target resource download task is detected; A shard quantity determination module, configured to determine the number of shards corresponding to the target resource according to the total size of the resource file fed back by the resource server and a preset shard size; A resource slice determination module, used to determine the number of threads for executing the target resource download task according to the number of slices, and allocate the resource slice required to be downloaded to each thread; A parallel-serial execution triggering module is used to trigger each thread in parallel and trigger the execution of the serial execution module in each thread; A serial execution module, for serial execution: when completing the download of the current resource fragment in the target resource download task, obtaining the download time interval and actual download time corresponding to the current resource fragment; backtracking to obtain all accompanying download tasks executed in the server cluster within the download time interval; wherein the accompanying download tasks are other download tasks executed within the download time interval except the target resource download task; and the accompanying download tasks are in a downloading state within the download time interval and do not need to complete the download within the download time interval; according to the download weights of each of the accompanying download business parties and the target business party, calculating the first download speed allocation ratio corresponding to the current resource fragment; wherein the first download speed allocation ratio is the proportion of bandwidth resources allocated to the target business party for download in all bandwidth resources of the server cluster; according to each of the accompanying download business parties According to the number of download tasks belonging to the target business party in the download task, the second download speed allocation ratio corresponding to the current resource slice is calculated; wherein the second download speed allocation ratio is the proportion of bandwidth resources allocated to the current resource slice for download in all bandwidth resources allocated by the server cluster to the target business party for download; according to the first download speed allocation ratio, the second download speed allocation ratio and the standard download speed of the server cluster, the ideal download speed corresponding to the current resource slice is calculated; according to the ideal download speed and the slice size of the current resource slice, the ideal download time corresponding to the current resource slice is calculated; if the actual download time is less than the ideal download time, the download operation of the next resource slice of the target resource download task is performed after waiting for the difference between the ideal download time and the actual download time.

15. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-6.

17. A computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Resource downloading method and related device

    CN111327695A