Resource allocation method, device, computer equipment and storage medium

By obtaining the total demand resources and demand gap resources of the target task, and using the available resources in the second resource pool for lending, the problems of resource exclusiveness and task blocking are solved, and resource utilization and task processing efficiency are improved.

CN112698943BActive Publication Date: 2024-09-27北京顺达同行科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011601345.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-29
Publication Date
2024-09-27
Estimated Expiration
2040-12-29

AI Technical Summary

Technical Problem

Existing resource scheduling methods can easily lead to resources being monopolized by one person, resulting in low resource utilization, and tasks submitted early are blocked due to a mismatch between resource requirements and the cluster, affecting task processing efficiency.

Method used

By obtaining the target task to be executed, determining its total demand resources and demand gap resources, and utilizing the available resources in the second resource pool for lending, ensuring that the task can be executed and achieving resource isolation and efficient utilization.

Benefits of technology

It improves resource utilization and task processing efficiency, avoids resource monopoly and task blocking, and ensures the smooth execution of tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112698943B
    Figure CN112698943B
Patent Text Reader

Abstract

The present application provides a resource allocation method, device, computer equipment and storage medium, the method comprising: obtaining a target task to be executed; determining the total required resources corresponding to the target task; when the remaining resources in the first resource pool to which the target task belongs are less than the total required resources, determining the demand gap resources corresponding to the target task; based on the demand gap resources, allocating the available resources in the second resource pool to obtain external area borrowing resources, the external area borrowing resources and the remaining resources are used to execute the target task, the second resource pool and the first resource pool have the same role attributes and different regional attributes. The use of this method can not only improve resource utilization, but also improve task execution efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of resource scheduling, and in particular to a resource allocation method, apparatus, computer equipment and storage medium. Background Art

[0002] Resource scheduling is a resource balancing strategy in the field of big data computing. Its main purpose is to uniformly control and allocate resources for different computing tasks so that the resources of different tasks can be isolated and do not interfere with each other, thereby maximizing resource utilization and improving task execution efficiency.

[0003] However, the existing resource scheduling methods generally adopt the first-in-first-out strategy, which makes it very easy for someone to submit multiple SQLs (Structured Query Language) in a short period of time, resulting in the entire cluster resource being monopolized by one person. At the same time, since it is impossible to determine which of the two SQLs, A and B, has a better match with the current cluster resources, the tasks after resource allocation can only be executed in the order of SQL submission time, which makes it very easy for the following situation to occur: the tasks submitted earlier cannot be executed because their resource requirements do not match the current cluster, blocking the remaining tasks submitted later whose resource requirements match the current cluster, reducing the task processing efficiency.

[0004] Therefore, the existing resource scheduling method has the technical problem of low resource utilization due to unreasonable resource scheduling. Summary of the invention

[0005] Based on this, it is necessary to provide a resource allocation method, device, computer equipment and storage medium to address the above technical problems, so as to reasonably allocate various resources, improve resource utilization and enhance task processing efficiency.

[0006] In a first aspect, the present application provides a resource allocation method, the method comprising:

[0007] Get the target task to be executed;

[0008] Determine the total required resources corresponding to the target task;

[0009] When the remaining resources in the first resource pool corresponding to the target task are less than the total required resources, determining the required unmet resources corresponding to the target task;

[0010] Based on the demand gap resources, the available resources in the second resource pool are allocated to obtain external borrowing resources. The external borrowing resources and the remaining resources are used to execute the target task. The second resource pool and the first resource pool have the same role attributes and different regional attributes.

[0011] In some embodiments of the present application, the step of obtaining the target task to be executed includes:

[0012] Obtaining task processing information of tasks to be executed within a preset time period, wherein the task processing information includes read-in data information, memory consumption information, core number occupancy information, shuffled data information, and aggregation number information;

[0013] According to a preset duration calculation weight, the task processing information is weighted and summed to obtain the resource occupation duration of the task to be executed, wherein the duration calculation weight is determined according to the task processing information of the historical task;

[0014] According to the resource occupation time of the task to be executed, the target task to be executed is obtained.

[0015] In some embodiments of the present application, the to-be-executed tasks include at least two to-be-executed tasks, and the step of acquiring the target task to be executed according to the resource occupation time of the to-be-executed tasks includes:

[0016] Determine the resource occupancy time corresponding to each of the tasks to be executed;

[0017] Based on the resource occupation time, the tasks to be executed are arranged in ascending order to obtain a sequence of tasks to be executed;

[0018] Based on the sequence of tasks to be executed, determining the task priority of each task to be executed, wherein the task priority decreases in sequence in the sequence of tasks to be executed;

[0019] Based on the task priority, determining the task status of each of the to-be-executed tasks, wherein the task status includes a to-be-executed state and a waiting state;

[0020] According to the task status of each of the tasks to be executed, a target task to be executed is acquired, and the task status of the target task is the to-be-executed status.

[0021] In some embodiments of the present application, after determining the task status of each of the tasks to be executed based on the task priority, the method further includes:

[0022] Get the current time;

[0023] If the current time is within the preset idle time period, based on the task priority of each of the tasks to be executed, the first remaining resources in the resource pool to which each of the tasks to be executed belongs and / or the second remaining resources in the candidate resource pool are obtained, so as to execute each of the tasks to be executed through the first remaining resources and / or the second remaining resources, and the candidate resource pool is a resource pool available except the resource pool;

[0024] If the current time is outside the preset idle time period, the step of acquiring the target task to be executed according to the task status of each task to be executed is executed.

[0025] In some embodiments of the present application, after obtaining the target task to be executed, the method further includes:

[0026] Determine the user account corresponding to the target task;

[0027] Acquire at least one task associated with the user account, wherein the at least one task has a corresponding task status, and the task status includes an executing status;

[0028] If the at least one task includes a task in the executing state, stopping execution of the target task until the at least one task does not include a task in the executing state;

[0029] If the at least one task does not include the task in the executing state, the step of determining the total required resources corresponding to the target task is performed.

[0030] In some embodiments of the present application, when the remaining resources in the first resource pool to which the target task belongs are less than the total required resources, the step of determining the required unmet resources corresponding to the target task includes:

[0031] Obtain remaining resources in a first resource pool corresponding to the target task, where the remaining resources are a difference between first total resources in the first resource pool and used resources in the first resource pool;

[0032] When the remaining resources are less than the total required resources, calculating the difference between the total required resources and the remaining resources to obtain a resource difference value;

[0033] Determine the resource difference as the demand gap resource corresponding to the target task.

[0034] In some embodiments of the present application, the step of allocating available resources in the second resource pool based on the demand gap resources to obtain external borrowing resources includes:

[0035] Determine the region to which the first resource pool belongs as a target region, wherein the target region is preset to be associated with at least one regional resource pool, and each of the regional resource pools has the same role attribute, and the role attribute includes at least one of the following: business attribute and research and development attribute;

[0036] determining a regional resource pool other than the first resource pool among the regional resource pools as the second resource pool;

[0037] Obtaining a preset resource splitting weight corresponding to the second resource pool and available resources in the second resource pool, where the available resources are determined based on the resources in use in the second resource pool;

[0038] Based on the demand gap resources and the resource splitting weights, available resources in the second resource pool are allocated to obtain the external area split resources.

[0039] In some embodiments of the present application, the step of obtaining available resources in the second resource pool includes:

[0040] Acquire the second total resources, reserved resources, and in-use resources in the second resource pool, wherein the in-use resources are resources occupied by tasks in the second resource pool, and the reserved resources are preset resources that cannot be allocated in the second resource pool;

[0041] If the in-use resources are greater than the reserved resources, determining a difference between the second total resources and the in-use resources as the available resources;

[0042] If the in-use resources are less than the reserved resources, a difference between the second total resources and the reserved resources is determined as the available resources.

[0043] In some embodiments of the present application, the step of allocating available resources in the second resource pool based on the demand gap resources to obtain external borrowing resources further includes:

[0044] Obtaining the sum of the split resources in the outer area and the remaining resources to obtain the total available resources corresponding to the target task;

[0045] If the total available resources are less than the total required resources, determining candidate regions other than the target region among the major regions according to the role attribute of the first resource pool, wherein the candidate regions are preset to be associated with at least one candidate regional resource pool;

[0046] Based on a preset large area arrangement order, a target area resource pool in each of the candidate area resource pools is determined, and the candidate large areas to which the target area resource pool belongs are arranged after the target large areas;

[0047] According to the resource difference between the total demand resources and the total available resources, and the preset resource splitting weight corresponding to the target area resource pool, the target available resources in the target area resource pool are obtained, and the target available resources are used to perform the target task in combination with the external area borrowed resources and the remaining resources.

[0048] In a second aspect, the present application provides a resource allocation device, the device comprising:

[0049] A task acquisition module is used to obtain the target task to be executed;

[0050] A resource determination module, used to determine the total required resources corresponding to the target task;

[0051] A gap determination module, used for determining the demand gap resources corresponding to the target task when the remaining resources in the first resource pool corresponding to the target task are less than the total demand resources;

[0052] A resource allocation module is used to allocate available resources in the second resource pool based on the demand gap resources to obtain external borrowing resources. The external borrowing resources and the remaining resources are used to execute the target task. The second resource pool has the same role attributes and different regional attributes as the first resource pool.

[0053] In a third aspect, the present application further provides a server, the server comprising:

[0054] one or more processors;

[0055] Memory; and

[0056] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the resource allocation method.

[0057] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is loaded by a processor to execute the steps in the resource allocation method.

[0058] The above-mentioned resource allocation method, device, computer equipment and storage medium determine the total required resources corresponding to the target task by obtaining the target task to be executed, so that when the remaining resources in the first resource pool corresponding to the target task are less than the total required resources, the available resources in the second resource pool can be allocated based on the demand gap resources corresponding to the target task, thereby obtaining the external area borrowing resources required to execute the target task. Since the present application pre-isolates and divides the resources available for the task by role attributes and regional attributes, the task can use the resources in its exclusive resource pool during the execution process, thereby realizing resource isolation and non-interference of different tasks. At the same time, a resource allocation scheme between the first resource pool and the second resource pool is set up, which can not only improve resource utilization, but also improve task execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0060] Figure 1 is a schematic diagram of a scenario of a resource allocation method in an embodiment of the present application;

[0061] Figure 2 It is a schematic diagram of the division result of the resource pool in an embodiment of the present application;

[0062] Figure 3 It is a flowchart of a resource allocation method in an embodiment of the present application;

[0063] FIG4( a ) is a schematic diagram of resource division of a resource pool in an embodiment of the present application;

[0064] FIG4( b ) is a schematic diagram of resource allocation priorities of a resource pool in an embodiment of the present application;

[0065] Figure 5 It is a specific flow chart of the resource allocation method in an embodiment of the present application;

[0066] Figure 6 is a schematic diagram of the structure of a resource allocation device in an embodiment of the present application;

[0067] Figure 7 It is a schematic diagram of the structure of a computer device in an embodiment of the present application. DETAILED DESCRIPTION

[0068] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0069] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.

[0070] In the description of the present application, it is to be understood that the word "for example" is used to mean "used as an example, illustration or explanation". Any embodiment described as "for example" in the present application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any technician in the field to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.

[0071] In the embodiments of the present application, it should be noted that since the resource allocation method provided in the present application is executed in a computer device, the processing objects of each computer device exist in the form of data or information, such as time, which is actually time information. It can be understood that if resources, quantity, size, etc. are mentioned in subsequent embodiments, they are all corresponding data for processing by the computer device, and the details will not be repeated here.

[0072] In the embodiment of the present application, it should be noted that the resource allocation method provided in the embodiment of the present application can be applied to Figure 1In the resource allocation system shown in the figure. The resource allocation system includes a terminal 100, a server 200 and a database 300. The terminal 100 can be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. Such a device may include: a cellular or other communication device having a single-line display or a multi-line display or a cellular or other communication device without a multi-line display. The terminal 100 can be a desktop terminal or a mobile terminal. The terminal 100 can also be a mobile phone, a tablet computer, a laptop computer, etc. The server 200 can be an independent server, or a server network or a server cluster composed of servers, including but not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of a plurality of servers. The cloud server is composed of a large number of computers or network servers based on cloud computing. The database 300 can be a relational database management system (MySQL) that stores data expressed in SQL (Structured Query Language), such as task request data. In terms of WEB applications, MySQL is one of the best RDBMS (Relational Database Management System) application software, and the SQL language used by MySQL is the most commonly used standardized language for accessing databases.

[0073] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or less computer equipment as shown in Figure 1 Only one server 200 is shown in FIG. 1 . It is understandable that the resource allocation system may also include one or more other servers, which are not specifically limited here. Figure 1 As shown, the resource allocation system may also include a memory for storing data, such as storing SQL record data.

[0074] It should also be noted that Figure 1 The scenario diagram of the resource allocation system shown is only an example. The resource allocation system and scenario described in the embodiment of the present invention are intended to more clearly illustrate the technical solution of the embodiment of the present invention, and do not constitute a limitation on the technical solution provided by the embodiment of the present invention. Ordinary technicians in this field can know that with the evolution of the resource allocation system and the emergence of new business scenarios, the technical solution provided by the embodiment of the present invention is also applicable to similar technical problems.

[0075] Finally, it should be noted that the resource allocation method provided in the embodiment of the present application divides resources into roles, regions and areas in advance in order to allocate various resources and improve resource utilization. Figure 2 As shown, it is a schematic diagram of resource pool division provided by the embodiment of the present application, in which "business" and "R&D" represent the role attributes of the resource pool, "East China" and "South China" represent the regional attributes (large-region attributes) of the resource pool, and "Nanjing" and "Guangdong" represent the regional attributes (regional attributes) of the resource pool. Through the above-mentioned resource division method based on role, large region, and regional attributes, resources can be isolated according to the user's role, avoiding resource grabbing between R&D and business users, thereby improving resource utilization.

[0076] See also Figure 3 The present application embodiment provides a resource allocation method, which is mainly applied to the above Figure 1 Taking the server 200 in FIG. 1 as an example, the method includes steps S301 to S304, which are specifically as follows:

[0077] S301, obtaining a target task to be executed.

[0078] Among them, the tasks involved in the embodiments of the present application may refer to SQL query tasks, which are used to query SQL statements that are being executed or have been executed; the target task may be the target task currently to be executed by the server 200, that is, the SQL query task currently submitted by the server 200 for analysis.

[0079] Specifically, the resource allocation system provided in the embodiment of the present application includes a MySQL database, which can be set in the server 200, or in another server or platform, for storing the SQL query tasks (hereinafter referred to as SQL) submitted by the user as described above, so that the server 200 can obtain each SQL analysis and allocate resources in time, so that its tasks can be executed smoothly. It should be noted that the SQL stored in the MySQL database is not the target task, and the determination of the target task needs to be based on the analysis results of the server 200. Therefore, the server 200 can obtain one or more SQLs through the MySQL database, and then analyze each SQL to determine the target task to be executed. The target task acquisition steps involved in this embodiment will be described in detail below.

[0080] In one embodiment, this step includes: obtaining task processing information of tasks to be executed within a preset time period, the task processing information including read-in data information, memory consumption information, core occupancy information, shuffled data information and aggregation times information; calculating weights according to preset duration, performing weighted summation processing on the task processing information to obtain the resource occupancy duration of the tasks to be executed, the duration calculation weights being determined based on task processing information of historical tasks; obtaining the target task to be executed based on the resource occupancy duration of the tasks to be executed.

[0081] The preset time period refers to the historical time period for recording the SQL submission time, for example, within the previous 30 minutes, within the previous 2 hours, etc. It can be understood that the preset time period in this embodiment can be a time period accumulated with the current computer time as the end time, or a time period limited by the preset start and end times. For example, the time period accumulated with the current computer time as the end time can be within the past 30 minutes with the current computer time as the end time; the time period limited by the preset start and end times can be from 10 o'clock to 11 o'clock yesterday, etc.

[0082] Among them, the tasks to be executed may refer to SQL query tasks stored in the MySQL database. All tasks are tasks to be executed, but they are not necessarily target tasks that the server 200 will currently process.

[0083] Among them, the task processing information can be obtained through the SQL execution plan, including: the read data information may be, memory consumption information, core occupancy information, shuffle data information and aggregation times information; the read data information may refer to the size of the read (input) data, expressed as "InputData"; the memory consumption information may refer to the size of the consumed memory, expressed as "Memory"; the core occupancy information may refer to the number of CPU (Central Processing Unit) cores occupied, expressed as "Core"; the shuffle data information may refer to the shuffle data size, expressed as "ShuffleData"; the aggregation times information may refer to the number of aggregation calculations, expressed as "groupByData".

[0084] The duration calculation weight may be a preset duration calculation weight corresponding to different task processing information, specifically a calculation weight of resource occupation duration, which may be obtained through linear regression analysis of historical data or may be manually set. If obtained through historical data analysis, it may be determined through task processing information analysis of historical SQL query tasks, and if manually set, it may be set based on the experience of experienced personnel.

[0085] Among them, resource occupation time may refer to the length of time that resources in the resource pool are occupied, expressed as "Time". In the embodiment of the present application, the larger the "Time", the longer the task occupies the resources, and vice versa, the smaller the "Time", the shorter the task occupies the resources. In the embodiment of the present application, the priority determination of the task, that is, the determination of the target task with the highest priority, actually depends on the specific size of the resource occupation time. See the analysis of the embodiment below for details.

[0086] Specifically, before the server 200 obtains the target task to be executed, it first needs to obtain the tasks to be executed within the preset time period, that is, obtain the SQL query tasks stored in the MySQL database and submitted in accordance with the preset time period, and then obtain the task processing information of each SQL query task, including read-in data information, memory consumption information, core occupancy information, shuffled data information, and aggregation times information. After the server 200 obtains the processing information of each task, it can evaluate the time consumption of SQL and determine the priority of each SQL, so as to define the SQL with the highest priority as the target task for immediate execution. The time consumption evaluation method for SQL can be to calculate the weight according to the preset duration, and perform weighted summation processing on the processing information of each task. The calculation formula is as follows:

[0087] A×Core+B×Memory+C×InputData+D×ShuffleData+E×groupByData=Time

[0088] Among them, A, B, C, D, and E are all calculation weights for the duration of information processing for different tasks.

[0089] More specifically, after the server 200 obtains the SQL within the preset time period and obtains the corresponding resource occupancy time according to the task processing information of each SQL, it can compare the resource occupancy time of each task to be executed, so as to obtain the target task to be executed using the comparison result. The resource occupancy time analysis step involved in this embodiment will be described in detail below.

[0090] In one embodiment, the tasks to be executed include at least two tasks to be executed, and the step of obtaining the target task to be executed based on the resource occupancy time of the tasks to be executed includes: determining the resource occupancy time corresponding to each of the tasks to be executed; arranging each of the tasks to be executed in ascending order based on the resource occupancy time to obtain a sequence of tasks to be executed; determining the task priority of each of the tasks to be executed based on the sequence of tasks to be executed, and the task priority decreases in order in the sequence of tasks to be executed; determining the task status of each of the tasks to be executed based on the task priority, and the task status includes a to-be-executed state and a waiting state; obtaining the target task to be executed based on the task status of each of the tasks to be executed, and the task status of the target task is the to-be-executed state.

[0091] Specifically, the server 200 obtains the resource occupancy time Time of each task SQL to be executed, and can arrange them in ascending order according to the resource occupancy time to obtain a sequence with increasing time values, and further obtain a sequence of tasks to be executed.

[0092] For example, server 200 obtains three tasks to be executed: SQL1, SQL2 and SQL3. The resource occupancy time of SQL1 is 30 minutes, the resource occupancy time of SQL2 is 15 minutes, and the resource occupancy time of SQL3 is 18 minutes. Then the task sequence to be executed finally obtained by server 200 is SQL2, SQL3, and SQL1.

[0093] More specifically, since the more resource-consuming SQL is, the longer it theoretically takes to execute under certain hardware resources, the more complex the SQL is, the more time it takes to occupy resources, and complex SQL may affect the rationality of resource scheduling, that is, the previous SQL may be too complex and execute too slowly, causing subsequent simple SQL to be blocked and unable to execute. Therefore, the embodiment of the present application proposes to prioritize the tasks to be executed, that is, to set the SQL with relatively short resource occupancy time to high priority and the SQL with relatively long resource occupancy time to low priority. After obtaining the sorted sequence of tasks to be executed, the server 200 can determine the priority of each task to be executed in the sequence.

[0094] For example, the task sequence to be executed currently obtained by the server 200 is: SQL2, SQL3, SQL1. Based on the order of the tasks in the sequence, it can be known that SQL2 has the highest priority, SQL3 has a priority after SQL2, and SQL1 has the lowest priority.

[0095] Furthermore, since the purpose of dividing the task priorities is to determine the execution order of the tasks to be executed, so as to give priority to simple SQL and postpone the processing of complex SQL, so as to improve resource utilization. Therefore, after the server 200 determines the task priority of each task to be executed based on the sequence of tasks to be executed, in order to clarify the processing sequence of each task to be executed, the task status of each task to be executed can be modified, that is, the task status of the task with the highest priority is set to: waiting state; the task status of the task with the lower priority is set to: waiting state, and the task status of each SQL is updated in the MySQL database, so that other platforms, servers or terminals can query in real time. Finally, the server 200 can set the SQL in the waiting state as the target task. If the target task is executed, the server 200 can modify the task status of each task to be executed in turn according to the sequence of tasks to be executed, so as to execute each task to be executed in order.

[0096] In one embodiment, after determining the task status of each of the tasks to be executed based on the task priority, the method further includes: obtaining the current time; if the current time is within a preset idle time period, then based on the task priority of each of the tasks to be executed, obtaining the first remaining resources in the resource pool to which each of the tasks to be executed belongs, and / or the second remaining resources in the candidate resource pool, so as to execute each of the tasks to be executed through the first remaining resources and / or the second remaining resources, the candidate resource pool being a resource pool available other than the resource pool; if the current time is outside the preset idle time period, executing the step of obtaining the target task to be executed according to the task status of each of the tasks to be executed.

[0097] Among them, the current time can be the network time queried by the server 200 through the Internet. The time is limited by the time zone, that is, there are differences in time in different time zones. This application will take Beijing time as an example. For example, the current time is 10:00 a.m. Beijing time on January 1, 2020. It can be understood that although the current time in the example of the embodiment of the present application is Beijing time, it is not excluded that in other embodiments, it can also be the time of other time zones, or the time obtained by the server 200 based on the preset timing rules. The setting of the timing rules depends on the actual business needs.

[0098] The off-peak time period refers to the low-peak time period of resource usage, for example, from 21:00 to 24:00 (0:00 the next day), from 0:00 to 7:00, etc.

[0099] Among them, the first remaining resources refer to the remaining resources in the resource pool corresponding to the currently executed task; the second remaining resources refer to the remaining resources in other resource pools except the resource pool corresponding to the current task. It can be understood that each resource pool has a resource upper limit, that is, the total resources that can be stored in the resource pool are limited, and the remaining resources = total resources - used resources. The used resources can be resources that are being used and occupied by other parallel businesses, or they can be resources that have been consumed by historical tasks and cannot be used again.

[0100] Specifically, the present application proposes that after the server 200 has evaluated the time consumption of each SQL, determined the priority, modified the task status, and updated the database record, it can analyze the task execution time to provide different task execution resource scheduling methods, that is, since there is generally a peak in task execution, if the tasks during the peak period are to be successfully and effectively executed, it is necessary to ensure that the resource pool corresponding to the task can reserve a minimum resource for use. The minimum resource is called a reserved resource. The reserved resource cannot be shared and is exclusive to the task source that has been divided and determined for roles, regions, and areas. However, there is no clustering of tasks during off-peak hours, and there is often a situation where the resources of resource pool A are continuously idle, while resource pool B cannot meet the needs of task execution.

[0101] Therefore, for tasks submitted during peak and off-peak periods, this application provides two resource allocation methods: (1) If the current time of SQL task execution is within the preset off-peak period, the server 200 does not need to consider the restrictions on "reserved resources" in each resource pool. If the remaining resources in the resource pool corresponding to the task (corresponding to roles, regions, and areas) are insufficient, the remaining resources in other resource pools can be borrowed to obtain sufficient resources to execute the task. For example, the business party in East China-Nanjing submitted an SQL task, and the current time of executing the task is within the off-peak period. During the execution of the task, the server 200 found that the remaining resources in the resource pool corresponding to the East China-Nanjing business party were seriously insufficient. In this case, the resources in the resource pool corresponding to the South China-Guangdong business party can be borrowed. At this time, it is not necessary to care whether there are non-borrowable reserved resources in the borrowed resource pool. (2) If the current time of SQL task execution is outside the preset off-peak period, the server 200 may need to consider the restrictions on "reserved resources" in each resource pool. Regarding the second resource allocation method, it will be analyzed in detail below.

[0102] In one embodiment, after obtaining the target task to be executed, the method further includes: determining the user account to which the target task corresponds; obtaining at least one task associated with the user account, wherein the at least one task has a corresponding task status, and the task status includes an executing status; if the at least one task includes a task in the executing status, stopping the execution of the target task until the at least one task does not include a task in the executing status; if the at least one task does not include a task in the executing status, executing the step of determining the total required resources corresponding to the target task.

[0103] Specifically, the SQL submitted by the user should be associated with his user account, and the server 200 can obtain the user account corresponding to each SQL. In order to prevent individuals from submitting SQL multiple times, which may lead to the monopolization of resources by individuals and reduce resource utilization, this application sets up a resource monopoly prevention scheme, which will be described in detail in this embodiment: by determining the user account corresponding to the currently executed target task, it is obtained whether the user account has other SQL being executed. If so, the execution of the target task is suspended until the SQL submitted by the previous order is completed and then restarted; otherwise, the target task can continue to be executed.

[0104] S302: Determine the total required resources corresponding to the target task.

[0105] Among them, total required resources refer to the total amount of resources required to perform the target tasks.

[0106] Specifically, the total required resources of the target task can be directly obtained through the server 200, or can be obtained through analysis by the server 200, that is, according to the indicators to be achieved by the target task and the preset resource usage estimation table, the total required resources corresponding to the target task are determined.

[0107] S303: When the remaining resources in the first resource pool to which the target task belongs are less than the total required resources, determine the required unmet resources corresponding to the target task.

[0108] The first resource pool refers to the resource pool to which the target task belongs. For example, if the target task is the SQL submitted by business personnel in the East China region and Nanjing region, then Figure 2 The Nanjing resource pool in the East China region under the business role shown in is the first resource pool.

[0109] Among them, since remaining resources = total resources - used resources, the remaining resources in the first resource pool = (the first total resources in the first resource pool) - (the used resources in the first resource pool). For example, if the first total resources in the first resource pool are "10G" and the used resources in the first resource pool are "7G", then the remaining resources in the first resource pool are "3G".

[0110] Specifically, the execution of SQL requires sufficient resources. If resources are insufficient, resources need to be reasonably scheduled and allocated. In order to isolate various types of resources to ensure that the execution of each SQL does not interfere with each other and promote task execution efficiency, this application pre-divided the resource pool into roles + regions, as shown below: Figure 2 The independent resource pools shown in the figure, therefore, when the remaining resources in the first resource pool to which the target task belongs are less than the total required resources, it indicates that the remaining available resources in the corresponding resource pool are insufficient, and the required gap resources corresponding to the target task can be determined, so as to dispatch the resources in other resource pools to enable the target task to be executed smoothly. The required gap resource determination steps involved in this embodiment will be described in detail below.

[0111] In one embodiment, this step includes: obtaining the remaining resources in the first resource pool corresponding to the target task, the remaining resources being the difference between the first total resources in the first resource pool and the used resources in the first resource pool; when the remaining resources are less than the total required resources, calculating the difference between the total required resources and the remaining resources to obtain a resource difference; determining the resource difference as the demand gap resources corresponding to the target task.

[0112] Specifically, when the remaining resources in the first resource pool to which the target task belongs are less than its total required resources, the difference between the total required resources and the remaining resources can be calculated as the demand gap resources corresponding to the target task.

[0113] For example, if the first total resource in the first resource pool is "10G", the used resources in the first resource pool are "7G", and the remaining resources in the first resource pool are "3G", and the total required resources of the target task are "5G", then the remaining resources in the first resource pool are less than the total required resources, and the required gap resources corresponding to the target task are "5-3=2G". It can be understood that although the resource unit is expressed as "G" in this embodiment and the above embodiments, it does not exclude that it can also be "MB", "KB", etc. in actual application scenarios.

[0114] S304: Based on the demand gap resources, available resources in the second resource pool are allocated to obtain external zone borrowing resources.

[0115] The second resource pool refers to other resource pools except the first resource pool.

[0116] Among them, available resources refer to other resources in the resource pool except reserved resources. Reserved resources are fixed resources that are exclusively used for tasks corresponding to the resource pool and do not need to be shared with tasks corresponding to other resource pools.

[0117] Specifically, if the server 200 analyzes and determines the demand gap resources corresponding to the target task, it is necessary to allocate the available resources in the second resource pool to obtain the external borrowing resources provided by the second resource pool, so that the external borrowing resources are combined with the remaining resources in the first resource pool to enable the target task to be successfully executed. The steps for obtaining external borrowing resources involved in this embodiment will be described in detail below.

[0118] In one embodiment, this step includes: determining the region to which the first resource pool corresponds as the target region, the target region is preset to be associated with at least one regional resource pool, and the role attributes of each of the regional resource pools are the same, and the role attributes include at least one of the following: business attributes, R&D attributes; determining the regional resource pool other than the first resource pool in each of the regional resource pools as the second resource pool; obtaining the preset resource splitting weight corresponding to the second resource pool, and the available resources in the second resource pool, the available resources are determined according to the resources in use in the second resource pool; based on the demand gap resources and the resource splitting weight, allocating the available resources in the second resource pool to obtain the external area split resources.

[0119] Among them, the regional resource pool refers to both the region-specific resource pool corresponding to each role and the region-specific resource pool in a certain region. For example, the Nanjing regional resource pool and the Guangdong regional resource pool corresponding to the "business" role; the Nanjing regional resource pool is the resource pool that belongs exclusively to Nanjing in the East China region; the Guangdong regional resource pool is the resource pool that belongs exclusively to Guangdong in the South China region.

[0120] The resource splitting weight refers to a preset weight for splitting resources in proportion, for example, 2, 5, etc.

[0121] Specifically, Figure 2What is shown is a schematic diagram of resource pool division provided in an embodiment of the present application. The specific division method has been described in detail above, but what is not explained above is that when the resource pool is divided, the total number of resources corresponding to different roles is limited, and the total resources corresponding to different regions are also limited. Therefore, the total resources obtained by each region under different roles can be divided according to the resource division weights of each region. For example, the total resources corresponding to the "business" role are "20G". There are currently four regions: East China, South China, West China, and North China, and the resource division weights of each region are 1, 3, 2, and 4 in sequence. The total resources of the East China region are "2G", the total resources of the South China region are "6G", the total resources of the West China region are "4G", and the total resources of the North China region are "8G". Similarly, the total resources obtained by each region under different regions can be divided according to the resource allocation weight of each region. For example, the total resources of the North China region under the "business" role are "8G". There are two regions in the North China region: Beijing and Harbin. The resource allocation weight of Beijing is 7 and the resource allocation weight of Harbin is 3. Then the total resources of the Beijing region under the "business" role are "5.6G" and the total resources of the Harbin region under the "business" role are "2.4G".

[0122] More specifically, after server 200 analyzes and determines the demand gap resources corresponding to the target task, it can allocate the available resources in the second resource pool to obtain the external area borrowing resources provided by the second resource pool. The specific allocation method is: if it is necessary to obtain the demand gap resources of the target task, it can give priority to borrowing resources from other resource pools belonging to the same large area as the first resource pool. This large area may only include the first resource pool, or it may include other resource pools except the first resource pool. Therefore, if the resources of the first resource pool are insufficient, the resources of the resource pool of the same level can be scheduled and allocated first.

[0123] For example, in the resource pool division diagram shown in FIG4(a), if the first resource pool is the East China-Shanghai resource pool under the "business" role, and the remaining resources of the first resource pool are not enough to perform the target task at this moment, the required demand gap resources can be borrowed from the Hangzhou resource pool and the Nanjing resource pool, which belong to the East China region. At this time, the East China region is the target region, and the Hangzhou resource pool and the Nanjing resource pool are the second resource pools. After the server 200 determines all the second resource pools, it can obtain and determine the external area split resources according to the preset resource split weights corresponding to the second resource pools and the available resources in each second resource pool. For example, when the resource split weight of the Nanjing resource pool is "6" and the resource split weight of the Hangzhou resource pool is "4", and a total of "10G" memory needs to be borrowed at this time (the demand gap resource is "10G"), it is necessary to borrow the external area split resources with a memory size of 6÷(6+4)×10=6G from the Nanjing resource pool, and borrow the external area split resources with a memory size of "4G" from the Hangzhou resource pool. If the available resources of the Nanjing resource pool are greater than "6G" and the available resources of the Hangzhou resource pool are greater than "4G", the external area split resources can be successfully obtained; if the available resources of the Nanjing resource pool are less than "6G" and / or the available resources of the Hangzhou resource pool are less than "4G", other resource allocation schemes need to be adopted to obtain sufficient external area split resources to meet the demand gap resources. Other resource allocation schemes involved in this embodiment will be described in detail below.

[0124] In one embodiment, the step of obtaining available resources in the second resource pool includes: obtaining second total resources, reserved resources and in-use resources in the second resource pool, the in-use resources are resources occupied by tasks in the second resource pool, and the reserved resources are preset resources that cannot be allocated in the second resource pool; if the in-use resources are greater than the reserved resources, determining the difference between the second total resources and the in-use resources as the available resources; if the in-use resources are less than the reserved resources, determining the difference between the second total resources and the reserved resources as the available resources.

[0125] Specifically, the above embodiment has explained in detail how to allocate the available resources of the second resource pool, but has not explained how to obtain the available resources of the second resource pool. Therefore, this embodiment will explain in detail how to obtain the available resources of the second resource pool: before the server 200 allocates the available resources of the second resource pool, it is necessary to first obtain the second total resources, reserved resources, and in-use resources in the second resource pool, and then compare the in-use resources with the reserved resources. If the in-use resources are greater than the reserved resources, the available resources can be determined as the difference between the second total resources and the in-use resources; conversely, if the in-use resources are less than the reserved resources, the available resources can be determined as the difference between the second total resources and the reserved resources.

[0126] For example, if the second total resources in the second resource pool are "10G", the reserved resources are "5G", and the resources in use are "7G", then the resources in use are greater than the reserved resources, and the available resources are "10-7=3G". For another example, if the second total resources in the second resource pool are "10G", the reserved resources are "5G", and the resources in use are "3G", then the resources in use are less than the reserved resources, and the available resources are "10-5=5G". It can be understood that although this embodiment clarifies how to determine the available resources when the resources in use are equal to the reserved resources, it can be seen from the above example that when the resources in use are equal to the reserved resources, the available resources are at most "10-5=5G". In other words, the tasks corresponding to each resource pool give priority to the reserved resources in the resource pool to which it belongs. When the reserved resources are used and there are still idle resources, the resources in the resource pool other than the reserved resources can be loaned out and split; when the reserved resources are not idle or even insufficient, only the excess resources in the resource pool can be loaned out and split.

[0127] In one embodiment, the method further includes: obtaining the sum of the external area split resources and the remaining resources to obtain the total available resources corresponding to the target task; if the total available resources are less than the total demand resources, determining the candidate areas other than the target area in each area according to the role attributes of the first resource pool, and the candidate areas are preset to be associated with at least one candidate area resource pool; based on a preset area arrangement order, determining the target area resource pool in each candidate area resource pool, and the candidate area corresponding to the target area resource pool is arranged after the target area; according to the resource difference between the total demand resources and the available total resources, and the preset resource splitting weight corresponding to the target area resource pool, obtaining the target available resources in the target area resource pool, and the target available resources are used to perform the target task in combination with the external area borrowed resources and the remaining resources.

[0128] Among them, the candidate regional resource pool is the regional resource pool of the candidate region; the candidate region refers to the region that is not the region to which the first resource pool belongs; the target regional resource pool refers to the regional resource pool of the candidate region arranged after the target region. For example, the region to which the first resource pool belongs is "North China", and the candidate regions include "East China", "South China" and "West China" in sequence. Then the candidate regional resource pool includes "East China-Hangzhou Resource Pool", "East China-Nanjing Resource Pool", "South China-Shenzhen Resource Pool", "South China-Guangzhou Resource Pool", "West China-Yunnan Resource Pool", "West China-Guiyang Resource Pool", and the target regional resource pool should be "East China-Hangzhou Resource Pool" and "East China-Nanjing Resource Pool", because "East China" is arranged after "North China". It can be understood that although this embodiment proposes that resources can be allocated according to the order of region arrangement, it does not exclude that in other embodiments, resources can also be allocated by specifying resource pools.

[0129] Specifically, the above embodiment has explained in detail how to allocate the available resources of the second resource pool, and emphasized that when there is a demand for resource allocation, priority should be given to borrowing resources from resource pools in different regions of the same region, but it does not explain how and where to allocate resources when the resource pools in different regions of the same region still cannot meet the target task. Therefore, this embodiment will further explain that when the sum of the split resources in the external area corresponding to the resource pools in each region in the target region and the remaining resources in the first resource pool, that is, the sum of the resources that can currently match the target task is still less than the total required resources required to execute the task, the server 200 can continue to borrow resources from resource pools in different regions in turn according to the preset resource allocation rules. However, it should be noted that the regional resource pool that can be used as a backup resource pool-candidate resource should be a resource pool with the same role attribute as the first resource pool. Based on this rule, the resource allocation priority of each second resource pool can be determined.

[0130] For example, as shown in Figure 4(b), when the remaining resources of the first resource pool "East China-Shanghai Resource Pool" are insufficient, the resource allocation priority of each second resource pool is reduced in sequence to: "East China-Hangzhou Resource Pool", "East China-Nanjing Resource Pool", and "South China-Guangzhou Resource Pool".

[0131] The resource allocation method described in the above embodiment determines the total required resources corresponding to the target task by obtaining the target task to be executed, so that when the remaining resources in the first resource pool corresponding to the target task are less than the total required resources, the available resources in the second resource pool can be allocated based on the demand gap resources corresponding to the target task, thereby obtaining the external area borrowing resources required to execute the target task. Since the resources available to the task are pre-isolated and divided according to role attributes and regional attributes, the task can use the resources in its exclusive resource pool during execution, thereby realizing resource isolation and non-interference of different tasks. At the same time, a resource allocation scheme is set between the first resource pool and the second resource pool, which can not only improve resource utilization, but also improve task execution efficiency.

[0132] In order to enable those skilled in the art to fully understand the resource allocation scheme proposed in this application, this application also provides an application scenario, which applies the above-mentioned resource allocation method. Specifically, the application of the resource allocation method in this application scenario is as follows: Figure 5As shown, by obtaining the target task to be executed, the total required resources corresponding to the target task are determined, so that when the remaining resources in the first resource pool corresponding to the target task are less than the total required resources, the available resources in the second resource pool can be allocated based on the demand gap resources corresponding to the target task, thereby obtaining the external borrowing resources required to execute the target task. Since the resources available for the task are pre-isolated and divided according to role attributes and regional attributes, the task can use the resources in its exclusive resource pool during execution, so as to achieve resource isolation and non-interference of different tasks. At the same time, a resource allocation scheme between the first resource pool and the second resource pool is set, which can not only improve the utilization rate of resources, but also improve the efficiency of task execution.

[0133] In order to better implement the resource allocation method in the embodiment of the present application, based on the resource allocation method, the embodiment of the present application also provides a resource allocation device, such as Figure 6 As shown, the resource allocation device 600 includes:

[0134] The task acquisition module 610 is used to acquire the target task to be executed;

[0135] A resource determination module 620 is used to determine the total required resources corresponding to the target task;

[0136] A gap determination module 630 is used to determine the demand gap resources corresponding to the target task when the remaining resources in the first resource pool corresponding to the target task are less than the total demand resources;

[0137] The resource allocation module 640 is used to allocate the available resources in the second resource pool based on the demand gap resources to obtain external area borrowing resources. The external area borrowing resources and the remaining resources are used to execute the target task. The second resource pool has the same role attributes and different regional attributes as the first resource pool.

[0138] In some embodiments of the present application, the task acquisition module 610 is also used to obtain task processing information of tasks to be executed within a preset time period, the task processing information including read-in data information, memory consumption information, core occupancy information, shuffled data information and aggregation number information; according to a preset duration calculation weight, the task processing information is weighted and summed to obtain the resource occupancy duration of the task to be executed, and the duration calculation weight is determined based on the task processing information of historical tasks; according to the resource occupancy duration of the task to be executed, the target task to be executed is acquired.

[0139] In some embodiments of the present application, the tasks to be executed include at least two tasks to be executed, and the task acquisition module 610 is also used to determine the resource occupancy time corresponding to each of the tasks to be executed; based on the resource occupancy time, each of the tasks to be executed is arranged in ascending order to obtain a sequence of tasks to be executed; based on the sequence of tasks to be executed, the task priority of each of the tasks to be executed is determined, and the task priority decreases in order in the sequence of tasks to be executed; based on the task priority, the task status of each of the tasks to be executed is determined, and the task status includes a to-be-executed state and a waiting state; according to the task status of each of the tasks to be executed, the target task to be executed is obtained, and the task status of the target task is the to-be-executed state.

[0140] In some embodiments of the present application, the task acquisition module 610 is also used to obtain the current time; if the current time is within the preset idle time period, then based on the task priority of each task to be executed, the first remaining resources in the resource pool to which each task to be executed belongs, and / or the second remaining resources in the candidate resource pool are obtained, so as to execute each task to be executed through the first remaining resources and / or the second remaining resources, and the candidate resource pool is a resource pool available other than the resource pool; if the current time is outside the preset idle time period, the step of obtaining the target task to be executed according to the task status of each task to be executed is executed.

[0141] In some embodiments of the present application, the resource allocation device 600 also includes an account verification module, which is used to determine the user account to which the target task corresponds; obtain at least one task associated with the user account, and the at least one task has a corresponding task status, and the task status includes an executing state; if the at least one task includes a task in the executing state, stop executing the target task until the at least one task does not include a task in the executing state; if the at least one task does not include a task in the executing state, perform the step of determining the total required resources corresponding to the target task.

[0142] In some embodiments of the present application, the gap determination module 630 is also used to obtain the remaining resources in the first resource pool corresponding to the target task, and the remaining resources are the difference between the first total resources in the first resource pool and the used resources in the first resource pool; when the remaining resources are less than the total required resources, the difference between the total required resources and the remaining resources is calculated to obtain the resource difference; and the resource difference is determined as the demand gap resources corresponding to the target task.

[0143] In some embodiments of the present application, the resource allocation module 640 is also used to determine the region to which the first resource pool corresponds as a target region, the target region is preset to be associated with at least one regional resource pool, and the role attributes of each of the regional resource pools are the same, and the role attributes include at least one of the following: business attributes, R&D attributes; determine the regional resource pool other than the first resource pool in each of the regional resource pools as the second resource pool; obtain the preset resource splitting weight corresponding to the second resource pool, and the available resources in the second resource pool, the available resources are determined based on the resources in use in the second resource pool; based on the demand gap resources and the resource splitting weight, allocate the available resources in the second resource pool to obtain the external area split resources.

[0144] In some embodiments of the present application, the resource allocation module 640 is also used to obtain the second total resources, reserved resources and in-use resources in the second resource pool, the in-use resources are the resources occupied by tasks in the second resource pool, and the reserved resources are the preset resources that cannot be allocated in the second resource pool; if the in-use resources are greater than the reserved resources, the difference between the second total resources and the in-use resources is determined as the available resources; if the in-use resources are less than the reserved resources, the difference between the second total resources and the reserved resources is determined as the available resources.

[0145] In some embodiments of the present application, the resource allocation module 640 is also used to obtain the sum of the external area split resources and the remaining resources to obtain the total available resources corresponding to the target task; if the total available resources are less than the total required resources, then according to the role attributes of the first resource pool, determine the candidate regions other than the target region in the major regions, and the candidate regions are preset to be associated with at least one candidate area resource pool; based on the preset area arrangement order, determine the target area resource pool in each of the candidate area resource pools, and the candidate region corresponding to the target area resource pool is arranged after the target area; according to the resource difference between the total required resources and the available total resources, and the preset resource splitting weight corresponding to the target area resource pool, obtain the target available resources in the target area resource pool, and the target available resources are used to perform the target task in combination with the external area borrowed resources and the remaining resources.

[0146] In the above embodiment, the total required resources corresponding to the target task are determined by acquiring the target task to be executed, so that when the remaining resources in the first resource pool corresponding to the target task are less than the total required resources, the available resources in the second resource pool can be allocated based on the demand gap resources corresponding to the target task, thereby obtaining the external borrowing resources required to execute the target task. Since the resources available to the task are pre-isolated and divided according to role attributes and regional attributes, the task can use the resources in its exclusive resource pool during execution, thereby realizing resource isolation and non-interference of different tasks. At the same time, a resource allocation scheme between the first resource pool and the second resource pool is set, which can not only improve resource utilization, but also improve task execution efficiency.

[0147] In some embodiments of the present application, the resource allocation device 600 may be implemented in the form of a computer program. The computer program may be implemented in a computer program such as Figure 7 The memory of the computer device may store various program modules constituting the resource allocation device 600, for example, Figure 6 The task acquisition module 610, resource determination module 620, gap determination module 630 and resource allocation module 640 are shown. The computer program composed of various program modules enables the processor to execute the steps of the resource allocation method of each embodiment of the present application described in this specification.

[0148] For example, Figure 7 The computer device shown can be Figure 6 The task acquisition module 610 in the resource allocation device 600 shown executes step S201. The computer device can execute step S202 through the resource determination module 620. The computer device can execute step S203 through the gap determination module 630. The computer device can execute step S204 through the resource allocation module 640. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external computer device through a network connection. When the computer program is executed by the processor, a resource allocation method is implemented.

[0149] Those skilled in the art will understand that Figure 7The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0150] In some embodiments of the present application, a computer device is provided, comprising one or more processors; a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor in the steps of the resource allocation method. The steps of the resource allocation method here may be the steps of the resource allocation method in each of the above embodiments.

[0151] In some embodiments of the present application, a computer-readable storage medium is provided, which stores a computer program, and the computer program is loaded by a processor, so that the processor executes the steps of the resource allocation method described above. The steps of the resource allocation method here can be the steps of the resource allocation method in each of the above embodiments.

[0152] The above is a detailed introduction to a resource allocation method, device, computer equipment and storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A resource allocation method, characterized in that: The method comprises: The resources available for the task are pre-isolated and divided into resource roles and regional attributes, wherein the role attributes include at least one of the following: business attributes and R&D attributes; Get the target task to be executed; Determine the total required resources corresponding to the target task; When the remaining resources in the first resource pool corresponding to the target task are less than the total required resources, determining the required unmet resources corresponding to the target task; Determine a region corresponding to the first resource pool as a target region, wherein the target region is preset to be associated with at least one regional resource pool, and the role attributes of the regional resource pools are the same; Determine a regional resource pool other than the first resource pool among the regional resource pools as a second resource pool; Obtaining a preset resource splitting weight corresponding to the second resource pool and available resources in the second resource pool, where the available resources are determined based on the resources in use in the second resource pool; Based on the demand gap resources and the resource splitting weights, the available resources in the second resource pool are allocated to obtain external area borrowing resources. The external area borrowing resources and the remaining resources are used to execute the target task. The second resource pool and the first resource pool have the same role attributes and different regional attributes.

2. The resource allocation method according to claim 1, characterized in that: The step of obtaining the target task to be executed includes: Obtaining task processing information of tasks to be executed within a preset time period, wherein the task processing information includes read-in data information, memory consumption information, core number occupancy information, shuffled data information, and aggregation number information; According to a preset duration calculation weight, the task processing information is weighted and summed to obtain the resource occupation duration of the task to be executed, wherein the duration calculation weight is determined according to the task processing information of the historical task; According to the resource occupation time of the task to be executed, the target task to be executed is obtained.

3. The resource allocation method according to claim 2, characterized in that: The tasks to be executed include at least two tasks to be executed, and the step of acquiring the target task to be executed according to the resource occupation time of the tasks to be executed includes: Determine the resource occupancy time corresponding to each of the tasks to be executed; Based on the resource occupation time, the tasks to be executed are arranged in ascending order to obtain a sequence of tasks to be executed; Based on the sequence of tasks to be executed, determining the task priority of each task to be executed, wherein the task priority decreases in sequence in the sequence of tasks to be executed; Based on the task priority, determining the task status of each of the to-be-executed tasks, wherein the task status includes a to-be-executed state and a waiting state; According to the task status of each of the tasks to be executed, a target task to be executed is acquired, and the task status of the target task is the to-be-executed status.

4. The resource allocation method according to claim 3, characterized in that: After determining the task status of each of the tasks to be executed based on the task priority, the method further includes: Get the current time; If the current time is within the preset idle time period, based on the task priority of each of the tasks to be executed, the first remaining resources in the resource pool to which each of the tasks to be executed belongs and / or the second remaining resources in the candidate resource pool are obtained, so as to execute each of the tasks to be executed through the first remaining resources and / or the second remaining resources, and the candidate resource pool is a resource pool available except the resource pool; If the current time is outside the preset idle time period, the step of acquiring the target task to be executed according to the task status of each task to be executed is executed.

5. The resource allocation method according to claim 1, characterized in that: After obtaining the target task to be executed, the method further includes: Determine the user account corresponding to the target task; Acquire at least one task associated with the user account, wherein the at least one task has a corresponding task status, and the task status includes an executing status; If the at least one task includes a task in the executing state, stopping execution of the target task until the at least one task does not include a task in the executing state; If the at least one task does not include the task in the executing state, the step of determining the total required resources corresponding to the target task is performed.

6. The resource allocation method according to claim 1, characterized in that: The step of determining the demand gap resources corresponding to the target task when the remaining resources in the first resource pool corresponding to the target task are less than the total demand resources includes: Obtain remaining resources in a first resource pool corresponding to the target task, where the remaining resources are a difference between first total resources in the first resource pool and used resources in the first resource pool; When the remaining resources are less than the total required resources, calculating the difference between the total required resources and the remaining resources to obtain a resource difference value; Determine the resource difference as the demand gap resource corresponding to the target task.

7. The resource allocation method according to claim 1, characterized in that: The step of acquiring available resources in the second resource pool includes: Acquire the second total resources, reserved resources, and in-use resources in the second resource pool, wherein the in-use resources are resources occupied by tasks in the second resource pool, and the reserved resources are preset resources that cannot be allocated in the second resource pool; If the in-use resources are greater than the reserved resources, determining a difference between the second total resources and the in-use resources as the available resources; If the in-use resources are less than the reserved resources, a difference between the second total resources and the reserved resources is determined as the available resources.

8. The resource allocation method according to claim 1, characterized in that: The method further comprises: Obtaining the sum of the split resources in the outer area and the remaining resources to obtain the total available resources corresponding to the target task; If the total available resources are less than the total required resources, determining candidate regions other than the target region among the major regions according to the role attribute of the first resource pool, wherein the candidate regions are preset to be associated with at least one candidate regional resource pool; Based on a preset large area arrangement order, a target area resource pool in each of the candidate area resource pools is determined, and the candidate large areas to which the target area resource pool belongs are arranged after the target large areas; According to the resource difference between the total demand resources and the total available resources, and the preset resource splitting weight corresponding to the target area resource pool, the target available resources in the target area resource pool are obtained, and the target available resources are used to perform the target task in combination with the external area borrowed resources and the remaining resources.

9. A resource allocation device, characterized in that: The device comprises: The task acquisition module is used to pre-isolate and divide the resources available for the task by role attributes and regional attributes, wherein the role attributes include at least one of the following: business attributes and R&D attributes; and to acquire the target task to be executed; A resource determination module, used to determine the total required resources corresponding to the target task; A gap determination module, used for determining the demand gap resources corresponding to the target task when the remaining resources in the first resource pool corresponding to the target task are less than the total demand resources; A resource allocation module is used to determine the region to which the first resource pool corresponds as a target region, the target region is preset to be associated with at least one regional resource pool, and the role attributes of the regional resource pools are the same; determine the regional resource pools other than the first resource pool in the regional resource pools as second resource pools; obtain the preset resource splitting weight corresponding to the second resource pool, and the available resources in the second resource pool, the available resources are determined based on the resources in use in the second resource pool; based on the demand gap resources and the resource splitting weight, the available resources in the second resource pool are allocated to obtain external area borrowing resources, the external area borrowing resources and the remaining resources are used to execute the target task, the second resource pool and the first resource pool have the same role attributes and different regional attributes.

10. A computer device, characterized in that: The computer device comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the resource allocation method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the resource allocation method according to any one of claims 1 to 8.