Resource allocation method, device, equipment and storage medium based on multiple types
Patent Information
- Application Number
- CN201910658686.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-19
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2040-06-27
AI Technical Summary
The resource allocation granularity of the existing resource allocation methods is relatively coarse, resulting in low rationality of resource allocation.
By receiving resource application requests, obtain current available resources and target application resources, and check resources based on the various types of verification rules in the global allocation rules chain, and allocate more fine -grained resource types for allocation.
Improve the rationality of resource allocation, ensure the allocation of resources on demand, and improve the efficiency of resource utilization.
Smart Images

Figure CN110362409B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of financial technology (Fintech), and in particular to a resource allocation method, device, equipment and computer-readable storage medium based on various types. Background Art
[0002] With the development of computer technology, more and more technologies (big data, distributed, blockchain, artificial intelligence, etc.) are being applied in the financial field. The traditional financial industry is gradually transforming to Fintech, but due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. At present, the definition of resource types in the bank's business system is too simple, that is, when allocating resources, resources are only allocated based on the nominal type of resources, such as CPU, memory, etc. However, the attribute resources under the nominal type will play different roles in different environments. Therefore, the existing resource allocation method only considers the nominal type and quantity of resources, and the rationality of resource allocation is low. Summary of the invention
[0003] The main purpose of the present invention is to propose a resource allocation method, device, equipment and computer-readable storage medium based on multiple types, aiming to solve the technical problem of low resource allocation rationality caused by the coarse resource allocation granularity of the existing resource allocation method.
[0004] To achieve the above object, the present invention provides a resource allocation method based on multiple types, and the resource allocation method based on multiple types includes the following steps:
[0005] When receiving a resource application request, obtaining currently available resources and a target application resource in the resource application request, and when the currently available resources meet the basic application conditions of the target application resource, obtaining a preset global allocation rule chain;
[0006] Acquire the application resource type in the target application resource, determine each type verification rule corresponding to the application resource type in the global allocation rule chain, and perform resource verification on the current available resources and the target application resource based on the each type verification rule;
[0007] If the currently available resources and the target application resources pass the verification of the various types of verification rules, then based on the target application resources, the resources in the currently available resources are correspondingly allocated to the resource requester.
[0008] Optionally, the application resource type includes one or more of a queue name type, a module name type, and a tenant name type, and the steps of obtaining the application resource type in the target application resource, determining each type verification rule corresponding to the application resource type in the global allocation rule chain, and performing resource verification on the current available resources and the target application resource based on the each type verification rule specifically include:
[0009] Obtaining the application resource type in the target application resource, and determining whether the application resource type includes the queue name type;
[0010] If the resource application type includes the queue name type, then determining the queue name verification rule corresponding to the queue name type in the global allocation rule chain, and verifying whether there is a resource in the currently available resources that matches the queue name of the target application resource based on the queue name verification rule;
[0011] If there is a resource in the currently available resources that matches the queue name of the target resource application, then determining whether the resource application type includes the module name type;
[0012] If the requested resource type includes the queue name type, the module name verification rule corresponding to the module name type is determined in the global allocation rule chain, and based on the module name verification rule, it is checked whether there are resources in the currently available resources that match the module name of the target requested resource.
[0013] Optionally, if the resource application type includes the queue name type, after the step of determining a module name verification rule corresponding to the module name type in the global allocation rule chain, and verifying whether there is a resource in the currently available resources that matches the module name of the target application resource based on the module name verification rule, the step further includes:
[0014] If there is a resource in the currently available resources that matches the module name of the target application resource, determining whether the application resource type includes the tenant name type;
[0015] If the resource application type includes the tenant name type, then obtaining the target resource application amount corresponding to the target application resource and the target tenant name of the target application resource, and counting the current resource usage corresponding to the target tenant based on the target tenant name;
[0016] The tenant resource verification rule corresponding to the tenant name type is determined in the global allocation rule chain, and based on the tenant resource verification rule, it is verified whether the total amount of the target resource application amount and the current resource usage does not exceed the preset resource threshold corresponding to the target tenant.
[0017] Optionally, if the currently available resources and the target application resources pass the verification of the various types of verification rules, before the step of correspondingly allocating resources in the currently available resources to the resource requester based on the target application resources, the step further includes:
[0018] If the total amount of the target resource application amount and the current resource usage amount does not exceed the preset resource threshold corresponding to the target tenant, it is determined that the current available resources and the target application resources pass the verification of each type of verification rule;
[0019] The step of allocating resources in the currently available resources to the resource requester based on the target application resources specifically includes:
[0020] Determine, from the currently available resources, resources to be allocated that have passed the queue name verification rule, the module name verification rule, and the tenant resource verification rule;
[0021] Based on the applied resource type and the target resource application amount, the to-be-allocated resource of the shared storage type is preferentially determined as the first allocated resource, and the first allocated resource is allocated to the resource requester.
[0022] Optionally, after the step of determining the resources to be allocated that have passed the queue name verification rule, the module name verification rule, and the tenant resource verification rule in the currently available resources, the step further includes:
[0023] Based on the applied resource type and the target resource application amount, the to-be-allocated resources whose machine status scores exceed a preset score threshold are preferentially determined as second allocated resources, and the second allocated resources are allocated to the resource requester.
[0024] Optionally, after the step of determining the tenant resource verification rule corresponding to the tenant name type in the global allocation rule chain, and verifying whether the total amount of the target resource application amount and the current resource usage amount does not exceed the preset resource threshold corresponding to the target tenant based on the tenant resource verification rule, the step further includes:
[0025] If the total amount of the target resource application amount and the current resource usage exceeds the preset resource threshold corresponding to the target tenant, the resource application request of the target application resource is rejected, and a reminder message is generated that the total amount of resource usage exceeds the preset resource threshold.
[0026] Optionally, before the step of determining the tenant resource verification rule corresponding to the tenant name type in the global allocation rule chain, and verifying whether the total amount of the target resource application amount and the current resource usage amount does not exceed the preset resource threshold corresponding to the target tenant based on the tenant resource verification rule, it also includes:
[0027] Upon receiving a resource threshold setting instruction triggered by a user operation, obtaining an executor number threshold and related resource parameters of a single executor in the resource threshold setting instruction;
[0028] A resource threshold is calculated based on the executor number threshold and relevant resource parameters of a single executor, and the resource threshold is stored.
[0029] Optionally, the resource allocation method based on multiple types further includes:
[0030] When receiving a rule configuration instruction triggered by a user operation, if the rule configuration instruction is a rule adding instruction, obtaining the identifier of the rule to be added in the rule adding instruction and the resource type corresponding to the verification of the rule to be added;
[0031] Add the identifier of the rule to be added and the resource type corresponding to the check of the rule to be added to the preset configuration file, so as to add the rule to be added to the global allocation rule chain;
[0032] If the rule configuration instruction is a rule deletion instruction, obtaining the to-be-shielded rule identifier corresponding to the to-be-shielded rule in the rule deletion instruction and the shielding resource type corresponding to the to-be-shielded rule for verification;
[0033] The identifier of the rule to be shielded and the shielded resource type are added to the configuration file to shield the verification of the rule to be shielded for the application resource corresponding to the shielded resource type.
[0034] In addition, to achieve the above-mentioned purpose, the present invention further provides a resource allocation device based on multiple types, and the resource allocation device based on multiple types includes:
[0035] A rule chain acquisition module is used to acquire the current available resources and the target application resources in the resource application request when receiving the resource application request, and acquire the preset global allocation rule chain when the current available resources meet the basic application conditions of the target application resources;
[0036] A resource verification module, used to obtain the application resource type in the target application resource, determine each type verification rule corresponding to the application resource type in the global allocation rule chain, and perform resource verification on the current available resources and the target application resource based on the each type verification rule;
[0037] The resource allocation module is used to allocate resources in the currently available resources to the resource requester based on the target application resources if the currently available resources and the target application resources pass the verification of each type of verification rules.
[0038] Optionally, the resource application type includes one or more of a queue name type, a module name type, and a tenant name type, and the resource verification module specifically includes:
[0039] A queue name acquisition unit, used to acquire the application resource type in the target application resource, and determine whether the application resource type includes the queue name type;
[0040] A queue name verification unit, configured to determine a queue name verification rule corresponding to the queue name type in the global allocation rule chain if the resource application type includes the queue name type, and verify whether there is a resource in the currently available resources that matches the queue name of the target application resource based on the queue name verification rule;
[0041] A module name acquisition unit, configured to determine whether the resource application type includes the module name type if there is a resource matching the queue name of the target resource application in the currently available resources;
[0042] A module name verification unit is used to determine the module name verification rule corresponding to the module name type in the global allocation rule chain if the requested resource type includes the queue name type, and to verify whether there is a resource in the currently available resources that matches the module name of the target requested resource based on the module name verification rule.
[0043] Optionally, the resource verification module further includes:
[0044] If there is a resource in the currently available resources that matches the module name of the target application resource, determining whether the application resource type includes the tenant name type;
[0045] If the resource application type includes the tenant name type, then obtaining the target resource application amount corresponding to the target application resource and obtaining the target tenant name of the target application resource, and counting the current resource usage corresponding to the target tenant based on the target tenant name;
[0046] The tenant resource verification rule corresponding to the tenant name type is determined in the global allocation rule chain, and based on the tenant resource verification rule, it is verified whether the total amount of the target resource application amount and the current resource usage does not exceed the preset resource threshold corresponding to the target tenant.
[0047] Optionally, the resource allocation module specifically includes:
[0048] A resource determination unit, configured to determine, from the currently available resources, resources to be allocated that have passed the queue name verification rule, the module name verification rule, and the tenant resource verification rule;
[0049] The first allocation unit is configured to preferentially determine the to-be-allocated resources of the shared storage type as the first allocated resources based on the applied resource type and the target resource application amount, and allocate the first allocated resources to the resource requester.
[0050] Optionally, the resource allocation module specifically includes:
[0051] The second allocation unit is used to preferentially determine the to-be-allocated resources whose machine status scores exceed a preset score threshold as second allocated resources based on the applied resource type and the target resource application amount, and allocate the second allocated resources to the resource requester.
[0052] In addition, to achieve the above-mentioned purpose, the present invention also provides a resource allocation device based on multiple types, and the resource allocation device based on multiple types includes: a memory, a processor, and a resource allocation program based on multiple types stored in the memory and executable on the processor, and when the resource allocation program based on multiple types is executed by the processor, the steps of the resource allocation method based on multiple types as described above are implemented.
[0053] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a resource allocation program based on multiple types is stored, and when the resource allocation program based on multiple types is executed by a processor, the steps of the resource allocation method based on multiple types as described above are implemented.
[0054] When receiving a resource application request, the present invention obtains the current available resources and the target application resources in the resource application request, and when the current available resources meet the basic application conditions of the target application resources, obtains a preset global allocation rule chain; obtains the application resource type in the target application resource, determines the various type verification rules corresponding to the application resource type in the global allocation rule chain, and performs resource verification on the current available resources and the target application resource based on the various type verification rules; if the current available resources and the target application resource pass the verification of the various type verification rules, then based on the target application resource, the resources in the current available resources are correspondingly allocated to the resource requester. Through the above manner, the present invention verifies the current available resources based on the basic application conditions of the target application resource and the various type verification rules in the global allocation rule chain, divides the allocated resources into more fine-grained types, and performs resource allocation according to the type verification rules corresponding to each type of resource, thereby improving the rationality of resource allocation and solving the technical problem of low resource allocation rationality caused by the coarse resource allocation granularity of the existing resource allocation method. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;
[0056] Figure 2 It is a flowchart of the first embodiment of the method for allocating resources based on multiple types according to the present invention.
[0057] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0058] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0059] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.
[0060] The resource allocation device according to the embodiment of the present invention can be a PC or a server device, on which a Java virtual machine runs.
[0061] like Figure 1As shown, the resource allocation device based on multiple types may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0062] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0063] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and resource allocation programs based on various types.
[0064] exist Figure 1 In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the resource allocation program based on multiple types stored in the memory 1005, and perform the operations in the following resource allocation method based on multiple types.
[0065] Based on the above hardware structure, various resource allocation method embodiments of the present invention are proposed.
[0066] Reference Figure 2 , Figure 2 This is a flow chart of a first embodiment of a method for allocating resources based on multiple types according to the present invention. The method for allocating resources based on multiple types includes:
[0067] Step S10, when receiving a resource application request, obtaining currently available resources and a target application resource in the resource application request, and when the currently available resources meet the basic application conditions of the target application resource, obtaining a preset global allocation rule chain;
[0068] At present, the definition of resource types in the business system of banks is too simplistic. That is, when allocating resources, resources are only allocated based on the nominal types of resources, such as CPU, memory, etc. That is, the resource classification type is too simplistic. When recording resources, only the nominal types of resources (such as CPU, memory, etc.) are recorded, and the derived types of resources (such as underlying machines, operating environments, execution task categories, etc.) are not considered. However, attribute resources under the nominal type will play different roles in different environments. That is, resources under different attributes will have different functions even if the quantity is the same. Therefore, it is necessary to divide the allocated resources into more fine-grained resource types and then allocate them on demand. The existing resource allocation method only considers the nominal type and quantity of resources, and the rationality of resource allocation is low.
[0069] In this embodiment, in order to solve the technical problem of low rationality of resource allocation due to the coarse granularity of resource allocation in the existing resource allocation method, the currently available resources are verified based on the basic application conditions of the target application resources and the various type verification rules in the global allocation rule chain, and the allocated resources are divided into finer granularity types, and the resources are allocated according to the type verification rules corresponding to each type of resource. Specifically, when defining the resource type and the corresponding table structure, the queue memory, queue core number, queue instance number, queue name, driver memory, driver core number, storage capacity, storage type, module name (such as spark, which means that the resource is only provided to spark-related applications), tenant name, machine name and other attributes of the resource are abstracted into an interface class. When receiving resources reported by the resource provider, as long as there are resources of these types, the definition of the resource type must be inherited, thereby ensuring that the types of all resources in the server and module are refined to the above-mentioned specific type classification granularity. When receiving a resource application request, the currently available resources in the database and the target application resources in the resource application request are obtained. Specifically, firstly, it is determined whether the currently available resources meet the application resource type and the application resource quantity corresponding to the target application resource, wherein the basic application condition is that the currently available resources include the application resource type and the resource quantity corresponding to the application resource type in the currently available resources is greater than the application resource quantity. When it is determined that the currently available resources meet the basic application condition, the currently available resources and the target application resource are further verified according to each type verification rule in the global allocation rule chain pre-stored in the database to determine whether there are relevant resources suitable for the target application resource in the currently available resources.
[0070] For example, suppose the user abstracts the following two types of resources and needs to allocate them at the same time:
[0071] a) Yarn resources are defined by six attributes: queue memory, number of queue cores, number of queue instances, queue name, module name, and tenant name. Users want to meet the resource quantity requirements and only allow allocation when the queue name and module name are the same and do not exceed the tenant's resource usage limit.
[0072] b) Driver resources are defined by six attributes, namely driver memory, number of driver cores, storage capacity, storage type (whether it is a shared storage node, shared storage nodes have faster read and write speeds), module name, tenant name, and machine name. Users need to meet the resource quantity requirements while separately meeting the tenant's resource usage limit and giving priority to allocating resources with higher performance.
[0073] Furthermore, the resource allocation method based on multiple types also includes:
[0074] When receiving a rule configuration instruction triggered by a user operation, if the rule configuration instruction is a rule adding instruction, obtaining the identifier of the rule to be added in the rule adding instruction and the resource type corresponding to the verification of the rule to be added;
[0075] Add the identifier of the rule to be added and the resource type corresponding to the check of the rule to be added to the preset configuration file, so as to add the rule to be added to the global allocation rule chain;
[0076] If the rule configuration instruction is a rule deletion instruction, obtaining the to-be-shielded rule identifier corresponding to the to-be-shielded rule in the rule deletion instruction and the shielding resource type corresponding to the to-be-shielded rule for verification;
[0077] The identifier of the rule to be shielded and the shielded resource type are added to the configuration file to shield the verification of the rule to be shielded for the application resource corresponding to the shielded resource type.
[0078] In this embodiment, when allocating resources, pluggable verification rules defined according to multiple types are supported. The defined rules are added to the global rule chain maintained in the RequestResourceService resource manager. As an interface for uniformly receiving and processing resource applications, RequestResourceService maintains a global rule chain that includes all types of resources, and dynamically adds or removes a verification rule from the rule chain by declaring relevant information of the rule in the configuration file, thereby realizing a flexible pluggable resource management method. Specifically, when a rule configuration instruction triggered by a user operation is received, the instruction type of the rule configuration instruction is determined. If the instruction type is a rule adding instruction, the identifier of the rule to be added and the resource type corresponding to the rule to be added are obtained, and the verification rule is specifically added to the rule chain. The identifier of the rule to be added and the resource type corresponding to the verification of the rule to be added are added to the preset configuration file, so that the rule to be added is declared in the configuration file, thereby adding the rule to be added to the global rule chain. If the instruction type is a rule deleting instruction, a verification rule can be shielded for a specific type of resource, so that the specific type of resource skips the verification of the verification rule. The identifier of the rule to be shielded and the shielding resource type are added to the configuration file so as to declare the shielding rule in the configuration file, thereby shielding the verification of the rule to be shielded for the application resource corresponding to the shielding resource type.
[0079] Step S20, obtaining the application resource type in the target application resource, determining each type verification rule corresponding to the application resource type in the global allocation rule chain, and performing resource verification on the current available resources and the target application resource based on the each type verification rule;
[0080] In this embodiment, all resource applications will enter RequestResourceService for unified processing. After completing the default verification logic such as value checking, RequestResourceService will pass the resource application and the currently available resources in the global rule chain for verification. The verification logic of the verification rule is determined based on the resource type. Once a verification logic is triggered, it will determine whether to continue to the next verification rule or directly reject the application based on the verification result of whether it passes.
[0081] Step S30: If the currently available resources and the target application resources pass the verification of the various types of verification rules, then based on the target application resources, the resources in the currently available resources are correspondingly allocated to the resource requester.
[0082] In this embodiment, the application request of the target application resource can be approved only when the currently available resources and the target application resource pass the verification of each type of verification rules in the global rule chain. Then, the relevant resources in the currently available resources that match the target application resource are allocated to the resource requester of the target application resource.
[0083] When receiving a resource application request, this embodiment obtains the current available resources and the target application resources in the resource application request, and when the current available resources meet the basic application conditions of the target application resources, obtains a preset global allocation rule chain; obtains the application resource type in the target application resource, determines the various type verification rules corresponding to the application resource type in the global allocation rule chain, and performs resource verification on the current available resources and the target application resource based on the various type verification rules; if the current available resources and the target application resource pass the verification of the various type verification rules, then based on the target application resource, the resources in the current available resources are correspondingly allocated to the resource requester. Through the above manner, the present invention verifies the current available resources based on the basic application conditions of the target application resource and the various type verification rules in the global allocation rule chain, divides the allocated resources into more fine-grained types, and performs resource allocation according to the type verification rules corresponding to each type of resource, thereby improving the rationality of resource allocation and solving the technical problem of low resource allocation rationality caused by the coarse resource allocation granularity of the existing resource allocation method.
[0084] Furthermore, based on the first embodiment of the method for allocating resources based on multiple types of resources of the present invention, a second embodiment of the method for allocating resources based on multiple types of resources of the present invention is proposed.
[0085] In this embodiment, the application resource type includes one or more of a queue name type, a module name type, and a tenant name type, and the step S20 specifically includes:
[0086] Obtaining the application resource type in the target application resource, and determining whether the application resource type includes the queue name type;
[0087] If the resource application type includes the queue name type, then determining the queue name verification rule corresponding to the queue name type in the global allocation rule chain, and verifying whether there is a resource in the currently available resources that matches the queue name of the target application resource based on the queue name verification rule;
[0088] If there is a resource in the currently available resources that matches the queue name of the target resource application, then determining whether the resource application type includes the module name type;
[0089] If the requested resource type includes the queue name type, the module name verification rule corresponding to the module name type is determined in the global allocation rule chain, and based on the module name verification rule, it is checked whether there are resources in the currently available resources that match the module name of the target requested resource.
[0090] In this embodiment, the application resource type is divided into finer granularity, such as queue name type, module name type and tenant name type. Specifically, the application resource type in the target application resource is obtained, and it is determined whether the queue name type exists in the application resource type. If it exists, the queue name verification rule corresponding to the queue name type is determined in the global allocation rule chain. That is, the yarn resource part of the target application resource and the currently available resources is checked. Only when the queue name of the target application resource is consistent with that of the currently available resources, can the queue name verification rule be passed. If the queue name type does not exist in the application resource type, the queue name verification rule in the global rule chain is skipped. If the queue name verification rule is not passed, the resource application request of the target application resource is rejected. If the queue name verification rule is passed, it is further determined whether the module name type exists in the application resource type, and the module name verification rule corresponding to the module name type is determined in the global allocation rule chain. That is, it is checked whether the module name in the target application resource is consistent with that in the currently available resources. Only when the module names to which the two belong are consistent can it be passed.
[0091] Furthermore, if the resource application type includes the queue name type, after the step of determining the module name verification rule corresponding to the module name type in the global allocation rule chain, and verifying whether there is a resource in the currently available resources that matches the module name of the target application resource based on the module name verification rule, it also includes:
[0092] If there is a resource in the currently available resources that matches the module name of the target application resource, determining whether the application resource type includes the tenant name type;
[0093] If the resource application type includes the tenant name type, then obtaining the target resource application amount corresponding to the target application resource and obtaining the target tenant name of the target application resource, and counting the current resource usage corresponding to the target tenant based on the target tenant name;
[0094] The tenant resource verification rule corresponding to the tenant name type is determined in the global allocation rule chain, and based on the tenant resource verification rule, it is verified whether the total amount of the target resource application amount and the current resource usage does not exceed the preset resource threshold corresponding to the target tenant.
[0095] In this embodiment, after the currently available resources are verified by the queue name verification rules and the module name verification rules, it is further determined whether the requested resource type includes the tenant name type. If the requested resource type includes the tenant name type, the tenant resource upper limit verification rule corresponding to the tenant name type is determined in the global allocation rule chain. That is, as long as it is recognized that the resource contains the tenant name attribute (inheriting the CreatorResource type interface), the tenant-granular resource verification logic will be triggered. The verification logic is based on the tenant name of the resource application, and counts the total resource usage of the tenant, that is, the current resource usage corresponding to the tenant and the target resource application amount corresponding to the tenant, and compares it with the upper limit of the resources that the tenant can use, that is, the preset resource threshold that the tenant can use. If it does not exceed, it passes.
[0096] Further, before the step of determining the tenant resource verification rule corresponding to the tenant name type in the global allocation rule chain, and verifying whether the total amount of the target resource application amount and the current resource usage amount does not exceed the preset resource threshold corresponding to the target tenant based on the tenant resource verification rule, it also includes:
[0097] Upon receiving a resource threshold setting instruction triggered by a user operation, obtaining an executor number threshold and related resource parameters of a single executor in the resource threshold setting instruction;
[0098] A resource threshold is calculated based on the executor number threshold and relevant resource parameters of a single executor, and the resource threshold is stored.
[0099] In this embodiment, the resource upper limit corresponding to the tenant, that is, the preset resource threshold value, can be set in advance by the user according to the actual situation. Specifically, when a resource threshold setting instruction triggered by a user input operation is received, the executor number threshold value and the relevant resource parameters of a single executor in the resource threshold setting instruction are obtained. Then the resource threshold is calculated based on the executor number threshold value and the relevant resource parameters of a single executor. The resource threshold can be the resource upper limit corresponding to multiple tenants, or it can be the resource upper limit corresponding to a single tenant, and then the resource threshold is allocated to the resource threshold corresponding to each tenant according to the resource usage weight or average. In a specific embodiment, the resource threshold can also be automatically set by the allocation system based on the historical resource upper limit data corresponding to each tenant.
[0100] Furthermore, based on the second embodiment of the method for allocating resources based on multiple types of resources of the present invention, a third embodiment of the method for allocating resources based on multiple types of resources of the present invention is proposed.
[0101] In this embodiment, the step of allocating resources in the currently available resources to the resource requester based on the target application resources specifically includes:
[0102] Determine, from the currently available resources, resources to be allocated that have passed the queue name verification rule, the module name verification rule, and the tenant resource verification rule;
[0103] Based on the applied resource type and the target resource application amount, the to-be-allocated resource of the shared storage type is preferentially determined as the first allocated resource, and the first allocated resource is allocated to the resource requester.
[0104] In this embodiment, different environments may cause different restrictions on resources, and resources are allocated based on storage type or machine performance score. For example, the network environment in which a machine is located is slow, so the resources it provides should be lowered in priority and allocated after other resources are allocated. Specifically, if the total amount of the target resource application amount and the current resource usage exceeds the preset resource threshold corresponding to the target tenant, the resource application request of the target application resource is rejected, and a reminder message that the total resource usage exceeds the preset resource threshold is generated; if the total amount of the target resource application amount and the current resource usage does not exceed the preset resource threshold corresponding to the target tenant, it is determined that the current available resources and the target application resources pass the verification of each type of verification rules. The resources in the currently available resources that are consistent with the queue name and module name of the target application resource are determined as resources to be allocated. The allocation priority of the resources to be allocated is determined based on the storage type corresponding to the resources to be allocated. That is, as long as it is recognized that the resource contains the storage type attribute (inherits the StorageResource type interface), the resources to be allocated that meet the requirements will be sorted according to the logic of shared storage type priority, and the resources to be allocated with the shared storage type at the front of the queue will be determined as the first allocated resources, that is, the shared storage type will be allocated to the resource requester first.
[0105] Furthermore, based on the applied resource type and the target resource application amount, the to-be-allocated resources whose machine status scores exceed a preset score threshold are preferentially determined as second allocated resources, and the second allocated resources are allocated to the resource requester.
[0106] In this embodiment, when it is identified that the resource to be allocated is provided by a separate external server that is not part of the overall computing resources of the queue and can be traced back to the specific machine name provided (inheriting the ServerResource type interface), the machine status score corresponding to the machine is obtained, and the resource to be allocated whose machine status score exceeds the preset score threshold is determined as the second allocated resource, and the second allocated resource is preferentially allocated to the resource requester. In a specific embodiment, based on the sorted queue of resources to be allocated implemented in the previous implementation, the resources of the same sequence can be sorted again from high to low according to the score, and the resources to be allocated with unqualified scores are eliminated, and the resources to be allocated with shared storage type and high machine status scores are preferentially allocated to the resource requester.
[0107] The present invention also provides a resource allocation device based on multiple types, and the resource allocation device based on multiple types includes:
[0108] A rule chain acquisition module is used to acquire the current available resources and the target application resources in the resource application request when receiving the resource application request, and acquire the preset global allocation rule chain when the current available resources meet the basic application conditions of the target application resources;
[0109] A resource verification module, used to obtain the application resource type in the target application resource, determine each type verification rule corresponding to the application resource type in the global allocation rule chain, and perform resource verification on the current available resources and the target application resource based on the each type verification rule;
[0110] The resource allocation module is used to allocate resources in the currently available resources to the resource requester based on the target application resources if the currently available resources and the target application resources pass the verification of each type of verification rules.
[0111] Furthermore, the application resource type includes one or more of a queue name type, a module name type, and a tenant name type, and the resource verification module specifically includes:
[0112] A queue name acquisition unit, used to acquire the application resource type in the target application resource, and determine whether the application resource type includes the queue name type;
[0113] A queue name verification unit, configured to determine a queue name verification rule corresponding to the queue name type in the global allocation rule chain if the resource application type includes the queue name type, and verify whether there is a resource in the currently available resources that matches the queue name of the target application resource based on the queue name verification rule;
[0114] A module name acquisition unit, configured to determine whether the resource application type includes the module name type if there is a resource matching the queue name of the target resource application in the currently available resources;
[0115] A module name verification unit is used to determine the module name verification rule corresponding to the module name type in the global allocation rule chain if the requested resource type includes the queue name type, and to verify whether there is a resource in the currently available resources that matches the module name of the target requested resource based on the module name verification rule.
[0116] Furthermore, the resource verification module also includes:
[0117] If there is a resource in the currently available resources that matches the module name of the target application resource, determining whether the application resource type includes the tenant name type;
[0118] If the resource application type includes the tenant name type, then obtaining the target resource application amount corresponding to the target application resource and obtaining the target tenant name of the target application resource, and counting the current resource usage corresponding to the target tenant based on the target tenant name;
[0119] The tenant resource verification rule corresponding to the tenant name type is determined in the global allocation rule chain, and based on the tenant resource verification rule, it is verified whether the total amount of the target resource application amount and the current resource usage does not exceed the preset resource threshold corresponding to the target tenant.
[0120] Furthermore, the resource allocation module specifically includes:
[0121] A resource determination unit, configured to determine, from the currently available resources, resources to be allocated that have passed the queue name verification rule, the module name verification rule, and the tenant resource verification rule;
[0122] The first allocation unit is configured to preferentially determine the to-be-allocated resources of the shared storage type as the first allocated resources based on the applied resource type and the target resource application amount, and allocate the first allocated resources to the resource requester.
[0123] Furthermore, the resource allocation module specifically includes:
[0124] The second allocation unit is used to preferentially determine the to-be-allocated resources whose machine status scores exceed a preset score threshold as second allocated resources based on the applied resource type and the target resource application amount, and allocate the second allocated resources to the resource requester.
[0125] Furthermore, the resource verification module is also used to:
[0126] If the total amount of the target resource application amount and the current resource usage exceeds the preset resource threshold corresponding to the target tenant, the resource application request of the target application resource is rejected, and a reminder message is generated that the total amount of resource usage exceeds the preset resource threshold.
[0127] Furthermore, the resource allocation device based on multiple types further includes a resource upper limit setting module, so the resource upper limit setting module is also used for:
[0128] Upon receiving a resource threshold setting instruction triggered by a user operation, obtaining an executor number threshold and related resource parameters of a single executor in the resource threshold setting instruction;
[0129] A resource threshold is calculated based on the executor number threshold and relevant resource parameters of a single executor, and the resource threshold is stored.
[0130] Furthermore, the resource allocation device based on multiple types further includes a verification rule configuration module, and the verification rule configuration module is further used to:
[0131] When receiving a rule configuration instruction triggered by a user operation, if the rule configuration instruction is a rule adding instruction, obtaining the identifier of the rule to be added in the rule adding instruction and the resource type corresponding to the verification of the rule to be added;
[0132] Add the identifier of the rule to be added and the resource type corresponding to the check of the rule to be added to the preset configuration file, so as to add the rule to be added to the global allocation rule chain;
[0133] If the rule configuration instruction is a rule deletion instruction, obtaining the to-be-shielded rule identifier corresponding to the to-be-shielded rule in the rule deletion instruction and the shielding resource type corresponding to the to-be-shielded rule for verification;
[0134] The identifier of the rule to be shielded and the shielded resource type are added to the configuration file to shield the verification of the rule to be shielded for the application resource corresponding to the shielded resource type.
[0135] The methods executed by the above-mentioned program modules can refer to various embodiments of the resource allocation methods based on various types of the present invention, which will not be described in detail here.
[0136] The present invention also provides a computer-readable storage medium.
[0137] The computer-readable storage medium of the present invention stores a resource allocation program based on multiple types, and when the resource allocation program based on multiple types is executed by a processor, the steps of the resource allocation method based on multiple types as described above are implemented.
[0138] Among them, the method implemented when the resource allocation program based on multiple types running on the processor is executed can refer to the various embodiments of the resource allocation method based on multiple types of the present invention, which will not be repeated here.
[0139] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0140] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0141] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0142] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A resource allocation method based on multiple types, characterized in that: The resource allocation method based on multiple types includes the following steps: When receiving a resource application request, obtaining currently available resources and a target application resource in the resource application request, and when the currently available resources meet the basic application conditions of the target application resource, obtaining a preset global allocation rule chain; Obtaining the application resource type in the target application resource, and determining whether the application resource type includes a queue name type; If the resource application type includes the queue name type, then determining the queue name verification rule corresponding to the queue name type in the global allocation rule chain, and verifying whether there is a resource in the currently available resources that matches the queue name of the target application resource based on the queue name verification rule; If there is a resource in the currently available resources that matches the queue name of the target resource application, then determining whether the resource application type includes a module name type; If the resource type applied for includes the module name type, a module name verification rule corresponding to the module name type is determined in the global allocation rule chain, and based on the module name verification rule, it is verified whether there is a resource in the currently available resources that matches the module name of the target applied resource; If the currently available resources and the target application resources pass the verification of each type of verification rule, then based on the target application resources, the resources in the currently available resources are correspondingly allocated to the resource requester.
2. The method for allocating resources based on multiple types as claimed in claim 1, characterized in that: After the step of determining a module name verification rule corresponding to the module name type in the global allocation rule chain if the resource type applied for includes the module name type, and verifying whether there is a resource in the currently available resources that matches the module name of the target applied resource based on the module name verification rule, the method further includes: If there is a resource in the currently available resources that matches the module name of the target application resource, then determining whether the application resource type includes a tenant name type; If the resource application type includes the tenant name type, then obtaining the target resource application amount corresponding to the target application resource and the target tenant name of the target application resource, and counting the current resource usage corresponding to the target tenant based on the target tenant name; The tenant resource verification rule corresponding to the tenant name type is determined in the global allocation rule chain, and based on the tenant resource verification rule, it is verified whether the total amount of the target resource application amount and the current resource usage does not exceed the preset resource threshold corresponding to the target tenant.
3. The method for allocating resources based on multiple types as claimed in claim 2, characterized in that: If the currently available resources and the target application resources pass the verification of each type of verification rule, before the step of correspondingly allocating the resources in the currently available resources to the resource requester based on the target application resources, it also includes: If the total amount of the target resource application amount and the current resource usage amount does not exceed the preset resource threshold corresponding to the target tenant, it is determined that the current available resources and the target application resources pass the verification of each type of verification rule; The step of allocating resources in the currently available resources to the resource requester based on the target application resources specifically includes: Determine, from the currently available resources, resources to be allocated that have passed the queue name verification rule, the module name verification rule, and the tenant resource verification rule; Based on the applied resource type and the target resource application amount, the to-be-allocated resource of the shared storage type is preferentially determined as the first allocated resource, and the first allocated resource is allocated to the resource requester.
4. The method for allocating resources based on multiple types as claimed in claim 3, characterized in that: After the step of determining the resources to be allocated that have passed the queue name verification rule, the module name verification rule, and the tenant resource verification rule in the currently available resources, the step further includes: Based on the applied resource type and the target resource application amount, the to-be-allocated resources whose machine status scores exceed a preset score threshold are preferentially determined as second allocated resources, and the second allocated resources are allocated to the resource requester.
5. The method for allocating resources based on multiple types as claimed in claim 2, characterized in that: After the step of determining the tenant resource verification rule corresponding to the tenant name type in the global allocation rule chain, and verifying whether the total amount of the target resource application amount and the current resource usage amount does not exceed the preset resource threshold corresponding to the target tenant based on the tenant resource verification rule, the method further includes: If the total amount of the target resource application amount and the current resource usage exceeds the preset resource threshold corresponding to the target tenant, the resource application request of the target application resource is rejected, and a reminder message is generated that the total amount of resource usage exceeds the preset resource threshold.
6. The method for allocating resources based on multiple types as claimed in claim 2, characterized in that: Before the step of determining the tenant resource verification rule corresponding to the tenant name type in the global allocation rule chain, and verifying whether the total amount of the target resource application amount and the current resource usage amount does not exceed the preset resource threshold corresponding to the target tenant based on the tenant resource verification rule, the step further includes: Upon receiving a resource threshold setting instruction triggered by a user operation, obtaining an executor number threshold and related resource parameters of a single executor in the resource threshold setting instruction; A resource threshold is calculated based on the executor number threshold and relevant resource parameters of a single executor, and the resource threshold is stored.
7. The method for allocating resources based on multiple types according to any one of claims 1 to 6, characterized in that: The resource allocation method based on multiple types also includes: When receiving a rule configuration instruction triggered by a user operation, if the rule configuration instruction is a rule adding instruction, obtaining the identifier of the rule to be added in the rule adding instruction and the resource type corresponding to the verification of the rule to be added; Add the identifier of the rule to be added and the resource type corresponding to the check of the rule to be added to the preset configuration file, so as to add the rule to be added to the global allocation rule chain; If the rule configuration instruction is a rule deletion instruction, obtaining the to-be-shielded rule identifier corresponding to the to-be-shielded rule in the rule deletion instruction and the shielding resource type corresponding to the to-be-shielded rule for verification; The identifier of the rule to be shielded and the shielded resource type are added to the configuration file to shield the verification of the rule to be shielded for the application resource corresponding to the shielded resource type.
8. A resource allocation device based on multiple types, characterized in that: The resource allocation device based on multiple types includes: A rule chain acquisition module is used to acquire the current available resources and the target application resources in the resource application request when receiving the resource application request, and acquire the preset global allocation rule chain when the current available resources meet the basic application conditions of the target application resources; A resource verification module, used to obtain the application resource type in the target application resource, and determine whether the application resource type includes a queue name type; if the application resource type includes the queue name type, determine the queue name verification rule corresponding to the queue name type in the global allocation rule chain, and verify whether there are resources matching the queue name of the target application resource in the currently available resources based on the queue name verification rule; if there are resources matching the queue name of the target application resource in the currently available resources, determine whether the application resource type includes a module name type; if the application resource type includes the module name type, determine the module name verification rule corresponding to the module name type in the global allocation rule chain, and verify whether there are resources matching the module name of the target application resource in the currently available resources based on the module name verification rule; The resource allocation module is used to allocate resources in the currently available resources to the resource requester based on the target application resources if the currently available resources and the target application resources pass the verification of each type of verification rules.
9. The resource allocation device based on multiple types as claimed in claim 8, characterized in that: The resource verification module also includes: If there is a resource in the currently available resources that matches the module name of the target application resource, then determining whether the application resource type includes a tenant name type; If the resource application type includes the tenant name type, then obtaining the target resource application amount corresponding to the target application resource and the target tenant name of the target application resource, and counting the current resource usage corresponding to the target tenant based on the target tenant name; The tenant resource verification rule corresponding to the tenant name type is determined in the global allocation rule chain, and based on the tenant resource verification rule, it is verified whether the total amount of the target resource application amount and the current resource usage does not exceed the preset resource threshold corresponding to the target tenant.
10. The device for allocating resources based on multiple types as claimed in claim 9, characterized in that: The resource allocation module specifically includes: A resource determination unit, configured to determine, from the currently available resources, resources to be allocated that have passed the queue name verification rule, the module name verification rule, and the tenant resource verification rule; The first allocation unit is configured to preferentially determine the to-be-allocated resources of the shared storage type as the first allocated resources based on the applied resource type and the target resource application amount, and allocate the first allocated resources to the resource requester.
11. The device for allocating resources based on multiple types as claimed in claim 10, characterized in that: The resource allocation module specifically includes: The second allocation unit is used to preferentially determine the to-be-allocated resources whose machine status scores exceed a preset score threshold as second allocated resources based on the applied resource type and the target resource application amount, and allocate the second allocated resources to the resource requester.
12. A resource allocation device based on multiple types, characterized in that: The resource allocation device based on multiple types includes: a memory, a processor, and a resource allocation program based on multiple types stored in the memory and executable on the processor. When the resource allocation program based on multiple types is executed by the processor, the steps of the resource allocation method based on multiple types are implemented as described in any one of claims 1 to 7.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a resource allocation program based on multiple types, and when the resource allocation program based on multiple types is executed by a processor, the steps of the resource allocation method based on multiple types as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
YARN based resource management method, device and system
CN105512083A
Method for matching fine granularity resources in cloud computing platform
CN107797863A