Resource dynamic allocation method and device, equipment and medium
By filtering and scheduling host services, adjusting the binding relationship between applications and hosts, the problem of unbalanced resource allocation is solved, and resource utilization and application performance are improved.
Patent Information
- Application Number
- CN202411461331.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-01-14
AI Technical Summary
When the existing technology is used too much in resource management platforms, it will lead to uneven resource allocation, resulting in excessive pressure on a single host and idle other resources, and unable to effectively utilize resources.
By responding to the resource adjustment request initiated by the application, filter out the host service set that meets the conditions according to the application service mapping table, generate a list to be allocated, and traverse the list according to the preset resource scheduling strategy, determine the host service to be allocated, and adjust the application and host. Service binding relationship, update application service mapping table to achieve resource adjustment.
It realizes intelligent and dynamic resource allocation, improves the rationality of resource scheduling and service resource utilization, avoids resource overload or idleness, and ensures effective resource management and application performance.
Smart Images

Figure CN119311419A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence technology and financial technology, and in particular to a resource dynamic allocation method, device, equipment and medium. Background Art
[0002] As long as the industry's business and management systems involve service resources, there will be a resource management platform to implement resource allocation. Taking the human-computer interaction platform as an example, multiple host services (such as ES, SUG, and ENGINE services, which can be called functional services) are deployed in the system and assigned to multiple application carriers (specific robot applications, which are abstract individuals). By establishing a binding relationship between the service and the application, the application can be provided with functions such as index creation (such as ES service, the full name of ElasticSearch, which is a search engine that can be used to process massive data searches. The underlying structure is the index structure, which provides the function of creating indexes), recall (FAQ recall, which is understood as the service function of returning the most matching answer to a user's question) and so on.
[0003] However, when there are too many applications on the management platform, random allocation will lead to resource skew. In extreme cases, if all applications are allocated to one host service, not only will the pressure on a single host be too great, but other resources will also be idle and unable to play their intended value. Therefore, how to implement an intelligent and dynamic resource allocation solution and improve service resource utilization is an urgent problem to be solved. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a resource dynamic allocation method, device, equipment and medium that can be applied to financial technology or other related fields. Its main purpose is to realize an intelligent and dynamic resource allocation plan, improve the rationality of resource scheduling and allocation, and improve the utilization rate of service resources.
[0005] The technical solution of the present invention is as follows:
[0006] A first aspect of the present invention provides a method for dynamic resource allocation, comprising:
[0007] In response to a resource adjustment request initiated by an application, a host service set that meets the adjustment condition is screened from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores a binding relationship between the application and the host service;
[0008] Generate a corresponding list to be allocated based on the selected host service set according to a preset storage structure;
[0009] Traversing the to-be-allocated list according to a preset resource scheduling strategy, and determining a corresponding number of to-be-allocated host services from the host service set;
[0010] The binding relationship between the application currently initiating the request and the host service to be allocated is adjusted according to the resource adjustment request, and the application service mapping table is updated to complete the resource adjustment operation corresponding to the resource adjustment request.
[0011] A second aspect of the present invention provides a resource dynamic allocation device, comprising:
[0012] A resource screening module, for responding to a resource adjustment request initiated by an application, and screening a set of host services that meet the adjustment conditions from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores a binding relationship between an application and a host service;
[0013] A data storage module, used for generating a corresponding list to be allocated according to a preset storage structure for the screened host service set;
[0014] A resource traversal module, used to traverse the to-be-allocated list according to a preset resource scheduling strategy, and determine a corresponding number of to-be-allocated host services from the host service set;
[0015] The resource allocation module is used to adjust the binding relationship between the application currently initiating the request and the host service to be allocated according to the resource adjustment request, and update the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request.
[0016] A third aspect of the present invention provides a computer device, comprising at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor so that the at least one processor can perform the above-mentioned resource dynamic allocation method.
[0019] A fourth aspect of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned resource dynamic allocation method.
[0020] Beneficial effects: The present invention discloses a method, device, equipment and medium for dynamic resource allocation. Compared with the prior art, the embodiment of the present invention responds to a resource adjustment request initiated by an application, and selects a host service set that meets the adjustment conditions from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores the binding relationship between the application and the host service; generates a corresponding list to be allocated for the selected host service set according to a preset storage structure; traverses the list to be allocated according to a preset resource scheduling strategy, and determines a corresponding number of host services to be allocated from the host service set; adjusts the binding relationship between the application that currently initiates the request and the host service to be allocated according to the resource adjustment request, and updates the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request. Through host service screening and resource scheduling strategies, intelligent and dynamic host service traversal and resource scheduling are realized, and the rationality of resource scheduling and allocation and the utilization rate of service resources are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the scheme in the present invention, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 A schematic diagram of an application environment of the resource dynamic allocation method provided by an embodiment of the present invention;
[0023] Figure 2 A flow chart of a method for dynamic resource allocation provided by an embodiment of the present invention;
[0024] Figure 3 A flow chart of step S201 in the resource dynamic allocation method provided in an embodiment of the present invention;
[0025] Figure 4 A flow chart of step S202 in the resource dynamic allocation method provided in an embodiment of the present invention;
[0026] Figure 5 A flow chart of step S203 in the resource dynamic allocation method provided in an embodiment of the present invention;
[0027] Figure 6 Another flow chart of step S203 in the method for dynamic resource allocation provided by an embodiment of the present invention;
[0028] Figure 7 A flow chart of step S204 in the resource dynamic allocation method provided in an embodiment of the present invention;
[0029] Figure 8 A schematic diagram of the functional modules of a resource dynamic allocation device provided by an embodiment of the present invention;
[0030] Fig. 9 A schematic diagram of the hardware structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The embodiments of the present invention are described below in conjunction with the accompanying drawings.
[0032] The resource dynamic allocation method provided by the embodiment of the present invention can be applied in the following aspects: Figure 1 In the application environment of FIG. 1 , it includes a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0033] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only as examples).
[0034] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0035] The server 105 may be a server that provides various services, such as a background server that provides support for the content browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (for example only). The background server may analyze and process the received data such as the user request, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device. The server 105 may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server 105 may also be a server for a distributed system, or a server combined with a blockchain.
[0036] It should be noted that the resource dynamic allocation method provided in the embodiment of the present application can generally be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the resource dynamic allocation device provided in the embodiment of the present invention can also be set in the first terminal device 101, the second terminal device 102 or the third terminal device 103. Alternatively, the resource dynamic allocation method provided in the embodiment of the present invention can also generally be executed by the server 105. Accordingly, the resource dynamic allocation device provided in the embodiment of the present invention can generally be set in the server 105.
[0037] It should be understood that the numbers of the above terminal devices, networks and servers are only illustrative. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0038] like Figure 2 As shown, the resource dynamic allocation method provided by the embodiment of the present invention specifically includes the following steps:
[0039] S201. In response to a resource adjustment request initiated by an application, a host service set meeting adjustment conditions is screened from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores a binding relationship between an application and a host service.
[0040] In this embodiment, the resource management platform allocates multiple host services (such as ES, SUG, and ENGINE services, which can be called functional services) deployed in the service cluster to multiple application carriers (specific robot applications, which are abstract individuals) based on the functional requirements of each application, thereby establishing a binding relationship between the service and the application based on the allocation situation, and maintaining an application service mapping table in real time, that is, the application service mapping table stores the binding relationship between the application and the host service in real time. When the application's demand for service resources changes, for example, more service resources are needed during peak hours or there are idle service resources during off-peak hours, a resource adjustment request can be initiated to the resource management platform. At this time, the platform selects a set of host services that meet the adjustment conditions from the service cluster based on the currently maintained application service mapping table as the basis for dynamic resource allocation.
[0041] For example, suppose a banking application needs more computing resources to handle transactions during peak hours. The application initiates a resource adjustment request through the resource management platform. The platform selects the host service set that meets the adjustment conditions based on the application service mapping table, which records the binding relationship between the application and the host service (such as ES, SUG, and ENGINE services), thereby ensuring the pertinence and effectiveness of resource allocation. The mapping table quickly locates the host service set that can provide the required services, laying the foundation for the next step of resource allocation.
[0042] S202: Generate a corresponding to-be-allocated list according to a preset storage structure for the screened host service set.
[0043] In this embodiment, based on the data of the screened host service set, such as the host service name, the number of applications that have been allocated to the service, the upper limit of the service allocation, the service performance index, and the current load, etc., these data are stored according to the preset storage structure to generate a comprehensive and structured list to be allocated, which can flexibly sort the relevant data of the host service according to the needs, such as ascending or descending order based on the number of allocated applications, or ascending or descending order based on the service performance index, etc. Such a list not only helps the resource management platform to understand the status of each host service more intuitively, but also facilitates intelligent resource scheduling based on these data, thereby improving the efficiency and accuracy of resource allocation.
[0044] S203: traverse the to-be-allocated list according to a preset resource scheduling strategy, and determine a corresponding number of to-be-allocated host services from the host service set.
[0045] In this embodiment, based on the structured storage of the list to be allocated, the list to be allocated is traversed according to the preset resource scheduling strategy. The specific resource scheduling strategy can be load balancing, priority allocation, etc., and can also be flexibly set according to demand to meet the resource scheduling needs of different scenarios such as expansion scenarios or reduction scenarios. For example, in the expansion scenario, host services with a small number of applications and more free memory are given priority, and in the reduction scenario, host services with a large number of applications are given priority to be unbound. Through the preset resource scheduling strategy, the resource management platform traverses all host services in the list to be allocated and determines the corresponding number of host services to be allocated. For example, if a host service is close to its processing capacity limit, it may not be selected to ensure the reliability and stability of the host service. Through intelligent scheduling strategies, resource allocation is optimized, resource overload or idleness is avoided, and the stability and response speed of the overall service are improved.
[0046] S204: Adjust the binding relationship between the application currently initiating the request and the host service to be allocated according to the resource adjustment request, and update the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request.
[0047] In this embodiment, after obtaining the corresponding number of host services to be allocated from the list to be allocated, the binding relationship between the application currently initiating the request and the host service to be allocated is adjusted according to the resource adjustment request. For example, the bank application is transferred from the current ES service with a heavy load to the new ES service, and the application service mapping table is updated to reflect this change, thereby ensuring that the resource adjustment request is effectively executed, realizing intelligent and dynamic resource scheduling, providing the required resources for the application, and ensuring the continuity and dynamism of resource management, improving resource utilization and application performance.
[0048] In the above embodiment, the present invention discloses a method for dynamic resource allocation, which responds to a resource adjustment request initiated by an application, selects a set of host services that meet the adjustment conditions from a service cluster according to a currently maintained application service mapping table, wherein the binding relationship between the application and the host service is stored in the application service mapping table; generates a corresponding list to be allocated according to a preset storage structure for the selected host service set; traverses the list to be allocated according to a preset resource scheduling strategy, and determines a corresponding number of host services to be allocated from the host service set; adjusts the binding relationship between the application that currently initiates the request and the host service to be allocated according to the resource adjustment request, and updates the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request. Through host service screening and resource scheduling strategies, intelligent and dynamic host service traversal and resource scheduling are realized, and the rationality of resource scheduling and allocation and the utilization rate of service resources are improved.
[0049] In one embodiment, Figure 3 As shown, step S201 includes:
[0050] S301, receiving a resource adjustment request initiated by an application, parsing and obtaining an application ID, a service type, a resource adjustment type, and a resource adjustment quantity carried in the resource adjustment request;
[0051] S302: Obtain a currently maintained application service mapping table, filter the service cluster according to the application ID, service type, resource adjustment type, and binding relationship in the application service mapping table, and obtain a host service set that meets the adjustment conditions.
[0052] In this embodiment, when an application initiates a resource adjustment request, it will carry data of several fields, including application ID, service type, resource adjustment type and resource adjustment quantity, wherein the application ID is the unique identifier of the application initiating the request, which is used by the resource management platform to allocate a suitable host service and finally maintain the binding relationship; the service type is the service type required by the current request, such as ES, NSG, Engine, etc.; the resource adjustment type includes expansion adjustment and reduction adjustment; the resource adjustment quantity is the number of expansion or reduction. Suppose that a bank's online trading system (application) needs more computing resources to handle the surge in transaction requests during the peak trading period of the market. The system initiates a resource adjustment request through the resource management platform, and the request contains the application ID (for example: the trading system ID is TS123), service type (such as database service), resource adjustment type (such as increasing computing resources) and resource adjustment quantity (such as increasing 5 computing units). After receiving the request, the platform first parses and obtains the key information in the resource adjustment request, including application ID, service type, resource adjustment type and resource adjustment quantity, which will be used as the basis for subsequent screening of the host service set.
[0053] The resource management platform obtains and queries the currently maintained application service mapping table, and screens the service cluster based on the parsed application ID, service type, resource adjustment type, and binding relationship in the application service mapping table, so that it can intelligently screen out the appropriate host service set that meets the adjustment conditions from the service cluster according to the specific needs of the application. This not only improves the flexibility and efficiency of resource allocation, but also ensures the rationality and fairness of resource allocation, avoiding excessive concentration or waste of resources.
[0054] In one embodiment, step S302 includes:
[0055] Get the currently maintained application service mapping table;
[0056] When the resource adjustment type is capacity expansion adjustment, according to the application ID, the service type and the binding relationship in the application service mapping table, the host services under the service type that are not bound to the application ID and have not reached the allocation upper limit are screened from the service cluster to generate the host service set;
[0057] When the resource adjustment type is a shrinking adjustment, the host service bound to the application ID is screened out from the service cluster according to the binding relationship between the application ID and the application service mapping table to generate the host service set.
[0058] In this embodiment, under different resource adjustment requests, the screening and filtering methods for service clusters are different, so as to meet the needs of different adjustment scenarios. Specifically, first obtain the currently maintained application service mapping table, which records the binding relationship between each application and the host service. For example, the mapping table may show that application A is bound to database services DB1 and DB2, and application B is bound to database service DB3. When a resource adjustment request is received, the platform first accesses this mapping table to determine which services are currently used by which applications, so as to quickly obtain the current resource allocation status and provide the necessary basic data for subsequent resource adjustments.
[0059] In the scenario of expansion adjustment, when screening host services that meet the adjustment conditions, the host services of the same type that are not bound to the application ID and have not reached the upper limit of allocation are screened from the service cluster according to the binding relationship in the application ID, service type and application service mapping table, and a host service set is generated. That is, when expanding capacity, the hosts with the same service type as the requested service, which are not assigned to the current application ID and have not been fully allocated are filtered out to ensure that new requests can be met in a timely manner and will not exceed the carrying capacity of a single host service. For example, application C needs more database service capabilities and initiates a capacity expansion adjustment request. The platform checks the mapping table based on the ID of application C and the requested service type (database service), and finds that DB4 and DB5 have not yet been bound to application C, and their current allocation has not reached the preset upper limit, then DB4 and DB5 are added to the set of host services to be allocated. By intelligently screening available resources, it helps to balance resource loads, prevent any single service from being overloaded, and maximize resource utilization.
[0060] In the scaling down scenario, when screening host services that meet the adjustment conditions, the host services that have been bound to the application ID are screened from the service cluster according to the binding relationship in the application ID and application service mapping table to generate the host service set. That is, when scaling down, the host services that have been assigned to the current application ID are filtered out. For example, application A no longer needs so many database services and initiates a scaling down adjustment request. At this time, the platform will query the mapping table and identify that the database services that have been bound to application A are DB1, DB2, and DB3. The platform will then add these services to the set of host services to be allocated, so that more accurate resource recovery operations can be performed later, improving resource utilization and reducing resource waste.
[0061] In one embodiment, Figure 4 As shown, step S202 includes:
[0062] S401, obtaining the number of applications allocated to each host service in the host service set;
[0063] S402, using the number of allocated applications as a key and the corresponding host service as a value to generate corresponding key-value pair data;
[0064] S403: sort all key-value pair data according to the size of the key, and construct a corresponding list to be allocated.
[0065] In this embodiment, when generating a list to be allocated based on the filtered host service set, the number of applications allocated to each host service is used as a basis, so that the current load of each filtered host service can be obtained. For example, the filtered host service set includes database services DB1, DB2, and DB3. By querying the application service mapping table, it is obtained that database service DB1 has been allocated to 3 applications, database service DB2 has been allocated to 5 applications, and database service DB3 has been allocated to 2 applications. Based on the obtained data, it can be determined during allocation which services can receive more applications or need to reduce the load.
[0066] To facilitate statistical sorting, the acquired data is stored in a key-value pair structure. When creating a key-value pair, the key is the number of allocated applications and the value is the corresponding host service name, such as {3:["DB1"]}; {5:["DB2"]}; {2:["DB3"]}; If there are multiple services with the same number of allocated applications, they will share a key. For example, if the database service DB4 is also allocated to 2 applications, the key-value pair data {2:["DB3","DB4"]} is generated. Services are stored in a structured and classified manner according to the number of applications they are allocated, which is convenient for subsequent processing and makes resource allocation decisions clearer and more efficient.
[0067] All generated key-value pair data are sorted by the size of the key (i.e., the number of allocated applications) to construct the corresponding list to be allocated. Specifically, they can be sorted from small to large, such as {2:["DB3","DB4"]}; {3:["DB1"]}; {5:["DB2"]}. This list shows that DB3 and DB4 have the lightest load (2 applications have been allocated), followed by DB1 (3 applications have been allocated), and DB2 has the heaviest load (5 applications have been allocated). This allows the lightest load service to be prioritized for allocation during resource allocation, especially when expanding capacity, so as to achieve load balancing, improve resource utilization, and avoid overload as much as possible. Alternatively, they can be sorted from large to small, such as {5:["DB2"]}; {3:["DB1"]}; {2:["DB3","DB4"]}. This sorting method allows the host service with the most applications to be prioritized for shrinking during resource allocation, especially when shrinking capacity. By generating categories to be allocated through structured sorting, the platform can allocate new requests more intelligently, optimize the overall resource allocation strategy, and ensure service stability and responsiveness.
[0068] In one embodiment, Figure 5 As shown, step S203 includes:
[0069] S501, traversing the to-be-allocated list in a corresponding traversal order according to a preset resource scheduling strategy;
[0070] S502, initializing an accumulation list, adding the traversed host service to the accumulation list each time a key-value pair is traversed, and comparing the number of host services in the accumulation list with the number of resource adjustments in the resource adjustment request;
[0071] S503: When the number of host services in the cumulative list is greater than or equal to the resource adjustment number in the resource adjustment request, stop the traversal operation and intercept the cumulative list to determine the host services to be allocated that are the same as the resource adjustment number.
[0072] In this embodiment, the preset resource scheduling strategy includes determining the host service to be allocated according to the priority principle, and the priority principle refers to giving priority to allocating host services with fewer bound applications when expanding capacity, and giving priority to reducing host services with more bound applications when shrinking capacity. Under this resource scheduling strategy, the list to be allocated is traversed in the corresponding traversal order, and the list to be allocated is sorted according to the number of applications allocated to the service, such as: DB3 and DB4 (2 applications have been allocated), DB1 (3 applications have been allocated), DB2 (5 applications have been allocated), then in the expansion scenario, it can be traversed in ascending order of the number of applications, so as to give priority to traversing the host service with a small number of allocated applications, and in the shrinking scenario, it can be traversed in descending order of the number of applications, so as to give priority to traversing the host service with a large number of allocated applications.
[0073] When determining the host service to be allocated, first initialize a cumulative list. When traversing each key-value pair data in the corresponding traversal order, add the traversed host service to the cumulative list, and compare the number of host services in the cumulative list with the number of resource adjustments in the resource adjustment request. For example, if 6 services need to be expanded, in the list to be allocated, there are 3 host services corresponding to key-0, 2 host services corresponding to key-2, and 2 host services corresponding to key-3. Start traversing from key-0, get 3 host services to add to the cumulative list, at this time the number of host services in the cumulative list is less than 6, continue traversing; traverse to key-2, get 2 host services to add to the cumulative list, at this time the number of host services in the cumulative list is less than 6, continue traversing; traverse to key-3, get 2 host services to add to the cumulative list, at this time the number of host services in the cumulative list is 7, which is greater than 6, so stop the traversal operation, intercept the cumulative list, and get 1 of the 2 host services corresponding to key-3 to meet the expansion quantity.
[0074] By traversing the to-be-allocated list in order to determine the exact number of host services to be allocated, the resource adjustment request is ensured to be accurately met, avoiding over-allocation or under-allocation of resources. By intercepting the to-be-allocated host services with the same number as the resource adjustment, the platform achieves precise control and effective management of resources.
[0075] In one embodiment, Figure 6 As shown, step S203 also includes:
[0076] S601, identifying whether each host service to be allocated in the accumulation list has exclusive resource configuration, and obtaining a corresponding exclusive host service;
[0077] S602: confirm whether the number of applications currently allowed to be allocated by the exclusive host service is zero. If it is zero, remove the exclusive host service from the host services to be allocated;
[0078] S603: Continue to traverse the to-be-allocated list, and add the same number of host services as those to be removed to the accumulated list.
[0079] In this embodiment, the preset resource scheduling strategy can also include a custom upper limit principle on the basis of the priority principle. The custom upper limit principle refers to the ability to set an exclusive configuration for a specified host service. The exclusive configuration is used to set the upper limit on the number of applications that are allowed to be allocated on the host service if the host service has been allocated to an application. This is different from the upper limit on the allocation of the host service in the above embodiment. The upper limit on the allocation of a host service represents a general upper limit, which is based on its own configuration considerations, while the upper limit on the number of applications in the exclusive configuration is for exclusive use by a certain application. Therefore, there is a premise that the application is allocated to a certain application, which allows resources to be better used exclusively, avoids interference caused by balanced allocation, better avoids resource competition, and ensures the operating stability of important applications.
[0080] In the capacity expansion scenario, after determining the corresponding number of host services to be allocated from the host service set, further identify whether each host service to be allocated in the cumulative list has exclusive resource configuration, and obtain the corresponding exclusive host service. The specific exclusive resource configuration structure can be: appId1|serviceType(ES) can be left blank|num such as 2, appId2|serviceType(FAQ)|2..., with "," as a separator, each section is a type of application configuration. Take the first section as an example, where appId1 represents the application ID, serviceType: such as ES, FAQ, represents the type of host service assigned to appId1, and if it is not filled in, it represents any host service, num: such as 2, represents the upper limit of the number of applications allowed to be allocated on the host service after the host service is allocated to the application, that is, after the host service is allocated to the application Id1, only 2 more applications are allowed to be allocated.
[0081] For the identified exclusive host service, the platform needs to further confirm whether the number of applications currently allowed to be allocated by the exclusive host service is zero. For example, database service DB1 is the exclusive host service of application A, and is configured to only allow one application to be allocated after being allocated to application A. Therefore, if DB1 has currently allocated two applications including application A, the number of applications currently allowed to be allocated is zero. The database service DB1 is removed from the host services to be allocated, and the list to be allocated is continued to be traversed, so as to add the same number of host services as those to be removed to the cumulative list to ensure that the adjustment data requirements in the resource adjustment request are met.
[0082] In one embodiment, Figure 7 As shown, step S204 includes:
[0083] S701, confirming, according to the resource adjustment request, whether the currently requested resource adjustment operation is a capacity expansion operation or a capacity reduction operation;
[0084] S702: When it is a capacity expansion operation, the application currently initiating the request is bound to the host service to be allocated, and the application service mapping table is updated;
[0085] S703: When it is a scaling-down operation, unbind the application that currently initiates the request from the host service to be allocated, and update the application service mapping table.
[0086] In this embodiment, after the host service to be allocated is determined, the resource adjustment operation of the current request is confirmed as an expansion operation or a reduction operation based on the resource adjustment request. After confirming as an expansion operation, the platform binds the application that currently initiates the request with the host service to be allocated. For example, if database services DB3, DB4, and DB1 are host services to be allocated, the platform will perform a binding operation to assign these services to the online trading system that currently initiates the request. The application service mapping table is then updated to record the new binding relationship. After confirming as a reduction operation, the platform will perform an unbinding operation to unbind the application that currently initiates the request from the previously bound host service (such as database service DB2), and remove these binding relationships from the application service mapping table, thereby reducing the resource usage of the application, ensuring the accuracy and timeliness of resource release, and optimizing service resource configuration.
[0087] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.
[0088] Further references Figure 8 , as a response to the above Figure 2 The present invention provides an embodiment of a resource dynamic allocation device, and the device embodiment is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0089] like Figure 8 As shown, the resource dynamic allocation device 80 described in this embodiment includes:
[0090] The resource screening module 801 is used to respond to the resource adjustment request initiated by the application and screen out a set of host services that meet the adjustment conditions from the service cluster according to the currently maintained application service mapping table, wherein the application service mapping table stores the binding relationship between the application and the host service;
[0091] The data storage module 802 is used to generate a corresponding list to be allocated according to a preset storage structure for the screened host service set;
[0092] The resource traversal module 803 is used to traverse the to-be-allocated list according to a preset resource scheduling strategy, and determine a corresponding number of to-be-allocated host services from the host service set;
[0093] The resource allocation module 804 is used to adjust the binding relationship between the application currently initiating the request and the host service to be allocated according to the resource adjustment request, and update the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request.
[0094] The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions, which are more suitable for describing the resource dynamic allocation execution process than programs. For the specific implementation methods of each module, please refer to the corresponding method embodiments above, which will not be repeated here.
[0095] In one embodiment, the resource screening module 801 includes:
[0096] A request receiving unit, configured to receive a resource adjustment request initiated by an application, and parse and obtain an application ID, a service type, a resource adjustment type, and a resource adjustment quantity carried in the resource adjustment request;
[0097] The resource screening unit is used to obtain the currently maintained application service mapping table, screen the service cluster according to the application ID, service type, resource adjustment type and the binding relationship in the application service mapping table, and obtain a host service set that meets the adjustment conditions.
[0098] In one embodiment, the resource screening unit includes:
[0099] A mapping table acquisition unit, used to acquire the currently maintained application service mapping table;
[0100] A first screening unit is configured to, when the resource adjustment type is capacity expansion adjustment, screen out host services that are not bound to the application ID and have not reached the upper allocation limit under the service type from the service cluster according to the application ID, the service type, and the binding relationship in the application service mapping table, and generate the host service set;
[0101] The second screening unit is used to screen out the host service bound to the application ID from the service cluster according to the binding relationship between the application ID and the application service mapping table when the resource adjustment type is a shrinking adjustment, and generate the host service set.
[0102] In one embodiment, the data storage module 802 includes:
[0103] A quantity acquisition unit, used to acquire the quantity of applications allocated to each host service in the host service set;
[0104] a key-value pair generating unit, configured to use the number of the allocated applications as a key and the corresponding host service as a value to generate corresponding key-value pair data;
[0105] The list generation unit is used to sort all key-value pair data according to the size of the key and construct a corresponding list to be allocated.
[0106] In one embodiment, the resource traversal module 803 includes:
[0107] A traversal unit, used for traversing the to-be-allocated list in a corresponding traversal order according to a preset resource scheduling strategy;
[0108] An adding comparison unit is used to initialize an accumulation list, add the traversed host service to the accumulation list each time a key-value pair data is traversed, and compare the number of host services in the accumulation list with the number of resource adjustments in the resource adjustment request;
[0109] The interception unit is used to stop the traversal operation and intercept the cumulative list when the number of host services in the cumulative list is greater than or equal to the resource adjustment number in the resource adjustment request, and determine the host service to be allocated that is the same as the resource adjustment number.
[0110] In one embodiment, the resource traversal module 803 further includes:
[0111] An identification unit, used to identify whether each host service to be allocated in the accumulation list has an exclusive resource configuration, and obtain a corresponding exclusive host service;
[0112] a removal unit, configured to confirm whether the number of applications currently allowed to be allocated by the exclusive host service is zero, and if so, remove the exclusive host service from the host services to be allocated;
[0113] The supplement unit is used to continue traversing the to-be-allocated list and supplement the host services with the same number as the eliminated number to the accumulated list.
[0114] In one embodiment, the resource allocation module 804 includes:
[0115] An operation confirmation unit, configured to confirm, according to the resource adjustment request, whether the resource adjustment operation currently requested is a capacity expansion operation or a capacity reduction operation;
[0116] A first allocation unit is used to bind the application that currently initiates the request with the host service to be allocated and update the application service mapping table when it is a capacity expansion operation;
[0117] The second allocation unit is used to, when the operation is a capacity reduction operation, unbind the application that currently initiates the request from the host service to be allocated, and update the application service mapping table.
[0118] In the above embodiment, the present invention discloses a resource dynamic allocation device, which responds to a resource adjustment request initiated by an application, selects a host service set that meets the adjustment conditions from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores the binding relationship between the application and the host service; generates a corresponding list to be allocated according to a preset storage structure for the selected host service set; traverses the list to be allocated according to a preset resource scheduling strategy, and determines a corresponding number of host services to be allocated from the host service set; adjusts the binding relationship between the application that currently initiates the request and the host service to be allocated according to the resource adjustment request, and updates the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request. Through host service screening and resource scheduling strategies, intelligent and dynamic host service traversal and resource scheduling are realized, thereby improving the rationality of resource scheduling and allocation and the utilization rate of service resources.
[0119] Another embodiment of the present invention provides a computer device, such as Fig. 9 As shown, the computer device 90 includes:
[0120] One or more processors 901 and memory 902, Fig. 9 A processor 901 is used as an example for the description. The processor 901 and the memory 902 may be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.
[0121] Processor 901 is used to complete various control logics of computer device 90, which can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component or any combination of these components. In addition, processor 901 can also be any traditional processor, microprocessor or state machine. Processor 901 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.
[0122] The memory 902 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the resource dynamic allocation method in the embodiment of the present invention. The processor 901 executes various functional applications and data processing of the computer device 90 by running the non-volatile software programs, instructions and units stored in the memory 902, that is, implements the resource dynamic allocation method in the above method embodiment.
[0123] The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device 90, etc. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 902 may optionally include a memory remotely arranged relative to the processor 901, and these remote memories may be connected to the computer device 90 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. One or more units are stored in the memory 902, and when executed by one or more processors 901, the steps of the resource dynamic allocation method in any of the above-mentioned method embodiments are executed.
[0124] In the above embodiment, the present invention discloses a computer device, which responds to a resource adjustment request initiated by an application, selects a set of host services that meet the adjustment conditions from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores the binding relationship between the application and the host service; generates a corresponding list to be allocated according to a preset storage structure for the selected host service set; traverses the list to be allocated according to a preset resource scheduling strategy, and determines a corresponding number of host services to be allocated from the host service set; adjusts the binding relationship between the application that currently initiates the request and the host service to be allocated according to the resource adjustment request, and updates the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request. Through host service screening and resource scheduling strategies, intelligent and dynamic host service traversal and resource scheduling are realized, and the rationality of resource scheduling allocation and service resource utilization are improved.
[0125] An embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the steps of the resource dynamic allocation method in any of the above method embodiments are executed.
[0126] In the above embodiment, the present invention discloses a non-volatile computer-readable storage medium, which responds to a resource adjustment request initiated by an application, selects a set of host services that meet the adjustment conditions from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores the binding relationship between the application and the host service; generates a corresponding list to be allocated according to a preset storage structure for the selected host service set; traverses the list to be allocated according to a preset resource scheduling strategy, and determines a corresponding number of host services to be allocated from the host service set; adjusts the binding relationship between the application that currently initiates the request and the host service to be allocated according to the resource adjustment request, and updates the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request. Through host service screening and resource scheduling strategies, intelligent and dynamic host service traversal and resource scheduling are realized, and the rationality of resource scheduling allocation and service resource utilization are improved.
[0127] 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, 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, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0128] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0129] In summary, the present invention discloses a method, device, equipment and medium for dynamic resource allocation, the method comprising: in response to a resource adjustment request initiated by an application, selecting a set of host services that meet the adjustment conditions from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores the binding relationship between the application and the host service; generating a corresponding list to be allocated according to a preset storage structure for the selected host service set; traversing the list to be allocated according to a preset resource scheduling strategy, and determining a corresponding number of host services to be allocated from the host service set; adjusting the binding relationship between the application that currently initiates the request and the host service to be allocated according to the resource adjustment request, and updating the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request. Through host service screening and resource scheduling strategies, intelligent and dynamic host service traversal and resource scheduling are realized, and the rationality of resource scheduling and allocation and the utilization rate of service resources are improved.
[0130] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the processes of the above-mentioned method embodiments when executed. The storage medium can be a memory, a disk, a floppy disk, a flash memory, an optical storage device, etc.
[0131] It should be noted that if any software tools or components other than those of the Company appear in the embodiments of the present application, they are merely used for illustration and do not represent actual use. It should be understood that the application of the present invention is not limited to the above examples, and that those skilled in the art can make improvements or changes based on the above description, and all such improvements and changes shall fall within the scope of protection of the claims attached to the present invention.
Claims
1. A method for dynamic resource allocation, characterized in that: include: In response to a resource adjustment request initiated by an application, a host service set that meets the adjustment condition is screened from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores a binding relationship between the application and the host service; Generating a corresponding list to be allocated according to a preset storage structure for the selected host service set; Traversing the to-be-allocated list according to a preset resource scheduling strategy, and determining a corresponding number of to-be-allocated host services from the host service set; The binding relationship between the application currently initiating the request and the host service to be allocated is adjusted according to the resource adjustment request, and the application service mapping table is updated to complete the resource adjustment operation corresponding to the resource adjustment request.
2. The method for dynamic resource allocation according to claim 1, characterized in that: The responding to the resource adjustment request initiated by the application, screening out a host service set that meets the adjustment condition from the service cluster according to the currently maintained application service mapping table, includes: Receive a resource adjustment request initiated by an application, parse and obtain the application ID, service type, resource adjustment type, and resource adjustment quantity carried in the resource adjustment request; The currently maintained application service mapping table is obtained, and the service cluster is screened according to the application ID, service type, resource adjustment type, and the binding relationship in the application service mapping table to obtain a host service set that meets the adjustment condition.
3. The method for dynamic resource allocation according to claim 2, characterized in that: The obtaining of the currently maintained application service mapping table, screening the service cluster according to the application ID, service type, resource adjustment type and the binding relationship in the application service mapping table, and obtaining a host service set that meets the adjustment condition, includes: Get the currently maintained application service mapping table; When the resource adjustment type is capacity expansion adjustment, according to the application ID, the service type and the binding relationship in the application service mapping table, the host services under the service type that are not bound to the application ID and have not reached the allocation upper limit are screened from the service cluster to generate the host service set; When the resource adjustment type is a shrinking adjustment, the host service bound to the application ID is screened out from the service cluster according to the binding relationship between the application ID and the application service mapping table to generate the host service set.
4. The method for dynamic resource allocation according to claim 1, characterized in that: The step of generating a corresponding list to be allocated according to a preset storage structure for the screened host service set includes: Obtain the number of applications allocated to each host service in the host service set; Using the number of the allocated applications as a key and the corresponding host service as a value, generating corresponding key-value pair data; Sort all key-value pair data by key size and construct the corresponding list to be allocated.
5. The method for dynamic resource allocation according to claim 4, characterized in that: The traversing the to-be-allocated list according to a preset resource scheduling strategy to determine a corresponding number of to-be-allocated host services from the host service set includes: Traversing the to-be-allocated list in a corresponding traversal order according to a preset resource scheduling strategy; Initialize an accumulation list, add the traversed host service to the accumulation list each time a key-value pair is traversed, and compare the number of host services in the accumulation list with the number of resource adjustments in the resource adjustment request; When the number of host services in the cumulative list is greater than or equal to the resource adjustment number in the resource adjustment request, the traversal operation is stopped and the cumulative list is intercepted to determine the host services to be allocated that are the same as the resource adjustment number.
6. The method for dynamic resource allocation according to claim 5, characterized in that: The step of traversing the to-be-allocated list according to a preset resource scheduling strategy and determining a corresponding number of to-be-allocated host services from the host service set further includes: Identify whether each host service to be allocated in the accumulation list has exclusive resource configuration, and obtain the corresponding exclusive host service; confirming whether the number of applications currently allowed to be allocated by the exclusive host service is zero, and if so, removing the exclusive host service from the host services to be allocated; Continue to traverse the to-be-allocated list, and add the same number of host services as those to be removed to the accumulated list.
7. The method for dynamic resource allocation according to claim 1, characterized in that: The step of adjusting the binding relationship between the application currently initiating the request and the host service to be allocated according to the resource adjustment request, and updating the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request, includes: Confirming, according to the resource adjustment request, that the currently requested resource adjustment operation is a capacity expansion operation or a capacity reduction operation; When it is a capacity expansion operation, the application currently initiating the request is bound to the host service to be allocated, and the application service mapping table is updated; When it is a scaling-down operation, the application currently initiating the request is unbound from the host service to be allocated, and the application service mapping table is updated.
8. A resource dynamic allocation device, characterized in that: include: A resource screening module, for responding to a resource adjustment request initiated by an application, and screening a set of host services that meet the adjustment conditions from a service cluster according to a currently maintained application service mapping table, wherein the application service mapping table stores a binding relationship between an application and a host service; A data storage module, used for generating a corresponding list to be allocated according to a preset storage structure for the screened host service set; A resource traversal module, used to traverse the to-be-allocated list according to a preset resource scheduling strategy, and determine a corresponding number of to-be-allocated host services from the host service set; The resource allocation module is used to adjust the binding relationship between the application currently initiating the request and the host service to be allocated according to the resource adjustment request, and update the application service mapping table to complete the resource adjustment operation corresponding to the resource adjustment request.
9. A computer device, characterized in that: comprising at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the resource dynamic allocation method according to any one of claims 1 to 7.
10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the resource dynamic allocation method according to any one of claims 1 to 7.