Multi-tenant-based resource allocation method and device, computer equipment, readable storage medium and program product

By obtaining tenants' comprehensive behavioral scores and using a long short-term memory network model to predict future query frequencies, resource allocation is dynamically adjusted, solving the problem of unreasonable resource allocation in a multi-tenant environment and achieving efficient and flexible resource management and service quality assurance.

CN121597406APending Publication Date: 2026-03-03CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511706005.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-20
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

In a multi-tenant environment, the index creation mechanism of traditional distributed search engine clusters cannot respond to changes in tenant query volume in a timely manner, resulting in unreasonable resource allocation and affecting service quality.

Method used

By obtaining the comprehensive behavioral scores of each tenant, the query frequency in future periods is predicted using a long short-term memory network model. Combined with an optimization function, resource allocation is dynamically adjusted to ensure the rationality and efficiency of resource allocation.

Benefits of technology

It enables real-time dynamic adjustment of tenant query load, avoiding the impact of sudden query peaks on cluster performance, ensuring the rationality and efficiency of resource allocation, and improving service quality and cluster resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597406A_ABST
    Figure CN121597406A_ABST
Patent Text Reader

Abstract

The invention relates to a multi-tenant-based resource allocation method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: acquiring a comprehensive behavior score of each tenant; wherein the comprehensive behavior score is determined based on the priority of each tenant in the search engine cluster and the tenant behavior data of each tenant in the current time period; a target optimization function is obtained, and the target optimization function is determined based on the tenant behavior data of the current time period and the query frequency of the future time period; the query frequency of the future time period is determined based on a long short-term memory network model; solving the target optimization function to obtain a resource allocation scheme; and adjusting the resource allocation scheme according to the comprehensive behavior score of each tenant to obtain an adjusted resource allocation scheme, and executing the adjusted resource allocation scheme. By adopting the method, the resources can be reasonably allocated according to the actual requirements of the tenants, and resource waste and uneven allocation are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data technology, and in particular to a multi-tenant-based resource allocation method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology

[0002] With the increasing demand for distributed search engines like Elasticsearch, especially in multi-tenant environments, it is often necessary to deploy distributed search engine clusters to provide independent index management and query services for different tenants. Elasticsearch is a distributed search engine based on Lucene, widely used for text search and analysis in big data environments.

[0003] In traditional technologies, index creation in distributed search engine clusters typically employs a global load balancing strategy, which distributes the indexes of multiple tenants across all nodes in the cluster to ensure load balancing and high data availability across all nodes.

[0004] However, the current static index allocation mechanism cannot respond in a timely manner when a tenant's query volume changes drastically, resulting in unreasonable resource allocation and affecting the tenant's service quality. Summary of the Invention

[0005] Therefore, it is necessary to provide a multi-tenant-based resource allocation method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can reasonably allocate resources to address the aforementioned technical problems.

[0006] Firstly, this application provides a resource allocation method based on multi-tenancy, the method comprising:

[0007] Obtain the comprehensive behavior score of each tenant; wherein the comprehensive behavior score is determined based on the priority of each tenant in the search engine cluster and the tenant behavior data of each tenant in the current time period;

[0008] Obtain the target optimization function, wherein the target optimization function is determined based on the tenant behavior data of the current time period and the query frequency of future time periods; the query frequency of future time periods is determined based on the processing of the tenant behavior data of the current time period using a long short-term memory network model;

[0009] Solve the objective function to obtain the resource allocation scheme;

[0010] The resource allocation scheme is adjusted based on the comprehensive behavioral scores of each tenant to obtain the adjusted resource allocation scheme, and the adjusted resource allocation scheme is then executed.

[0011] In one embodiment, obtaining the target optimization function includes:

[0012] Obtain the tenant behavior data of each tenant in the search engine cluster during the current time period;

[0013] The tenant behavior data is quantified to obtain a tenant behavior feature vector;

[0014] Based on the tenant behavior feature vector, determine the initial optimization function;

[0015] The initial optimization function is optimized based on the query frequency of the future time period to obtain the target optimization function.

[0016] In one embodiment, the tenant behavior data includes query frequency, data increment, and query latency; determining the initial optimization function based on the tenant behavior feature vector includes:

[0017] Based on the query frequency feature vector corresponding to the query frequency and the data increment feature vector corresponding to the data increment, the resource consumption function of the tenant's node in the search engine cluster is determined.

[0018] Based on the query latency feature vector corresponding to the query latency, determine the tenant's query latency function on the node;

[0019] The initial optimization function is determined based on the resource consumption function and query latency function of the node in the search engine cluster.

[0020] In one embodiment, optimizing the initial optimization function based on the query frequency of the future time period to obtain the target optimization function includes:

[0021] The target optimization function is obtained by replacing the query frequency in the initial optimization function with the query frequency in the future time period.

[0022] In one embodiment, obtaining the comprehensive behavioral score of each tenant includes:

[0023] Obtain the current time period's tenant behavior data for each tenant in the search engine cluster; wherein, the tenant behavior data includes query frequency, data increment, and query latency;

[0024] The tenant behavior data is quantified to determine the behavior feature vector of each tenant; wherein, the tenant behavior data includes query frequency feature vector, data increment feature vector and query latency feature vector;

[0025] Replace the query frequency feature vector with a query frequency feature vector for a future time period; wherein the query frequency feature vector for the future time period is determined based on the query frequency of the future time period.

[0026] Based on the query frequency feature vector of the future time period, the data increment feature vector, and the query delay feature vector, the initial behavior score of each tenant is determined;

[0027] Based on the priority of each tenant in the search engine cluster, the initial behavior score of each tenant is adjusted to obtain the comprehensive behavior score of each tenant.

[0028] In one embodiment, the adjusted resource allocation scheme includes the target node to which each tenant's index should be allocated, and the resource quota for each tenant; executing the adjusted resource allocation scheme includes:

[0029] Based on the target node to which each tenant's index should be assigned, the indexes of each tenant are migrated to the corresponding target node in the search engine cluster;

[0030] Based on the resource quotas of each tenant, configure the CPU quota, memory quota, and storage space quota of each tenant on the target node.

[0031] Secondly, this application also provides a multi-tenant-based resource allocation apparatus, the apparatus comprising:

[0032] The first acquisition module is used to acquire the comprehensive behavior score of each tenant; wherein, the comprehensive behavior score is determined based on the priority of each tenant in the search engine cluster and the tenant behavior data of each tenant in the current time period;

[0033] The second acquisition module is used to acquire the target optimization function, wherein the target optimization function is determined based on the tenant behavior data of the current time period and the query frequency of the future time period; the query frequency of the future time period is determined based on the long short-term memory network model to process the tenant behavior data of the current time period.

[0034] The solution module is used to solve the objective optimization function to obtain the resource allocation scheme;

[0035] The allocation execution module is used to adjust the resource allocation scheme according to the comprehensive behavior score of each tenant, obtain the adjusted resource allocation scheme, and execute the adjusted resource allocation scheme.

[0036] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method.

[0037] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.

[0038] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method.

[0039] The aforementioned multi-tenant-based resource allocation method, apparatus, computer equipment, computer-readable storage medium, and computer program product first obtain the comprehensive behavioral score of each tenant. This comprehensive behavioral score is determined based on the priority of each tenant in the search engine cluster and their current time-period tenant behavior data. Second, an objective optimization function is obtained. This objective optimization function is determined based on the current time-period tenant behavior data and the query frequency for future time periods. The query frequency for future time periods is determined by processing the current time-period tenant behavior data using a Long Short-Term Memory (LSTM) network model. Solving the objective optimization function yields a resource allocation scheme. Predicting the query frequency for future time periods provides a reference for subsequent dynamic index creation, avoiding the impact of sudden query peaks on cluster performance. Finally, the resource allocation scheme is adjusted based on the comprehensive behavioral scores of each tenant, resulting in an adjusted resource allocation scheme, which is then executed. By combining the comprehensive behavioral scores of each tenant and the resource allocation scheme obtained based on the objective function, node resources are dynamically adjusted in real time to ensure the rationality and efficiency of resource allocation. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 This is a flowchart illustrating a multi-tenant-based resource allocation method in one embodiment;

[0042] Figure 2 This is a flowchart illustrating the process of obtaining the target optimization function in one embodiment;

[0043] Figure 3 This is a flowchart illustrating the process of determining an initial optimization function based on tenant behavior feature vectors in one embodiment.

[0044] Figure 4 This is a flowchart illustrating the process of obtaining the comprehensive behavioral score of each tenant in one embodiment;

[0045] Figure 5 This is a schematic diagram of a multi-tenant-based resource allocation method in another embodiment;

[0046] Figure 6 This is a structural block diagram of a multi-tenant-based resource allocation device in one embodiment;

[0047] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0049] In one embodiment, such as Figure 1 As shown, a multi-tenant-based resource allocation method is provided. This embodiment illustrates the method by applying it to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps S102 to S108. Wherein:

[0050] Step S102: Obtain the comprehensive behavioral score for each tenant.

[0051] The overall behavioral score is determined based on the priority of each tenant in the search engine cluster and their current time-based tenant behavior data. A higher overall behavioral score indicates a more urgent need for resources. This applies to search engine clusters such as Elasticsearch clusters. Tenant behavior data forms the basis for subsequent resource allocation decisions.

[0052] Optionally, the terminal obtains the priority of each tenant in the Elasticsearch cluster and the tenant behavior data of each tenant in the current time period; and determines the comprehensive behavior score of each tenant in the Elasticsearch cluster based on the priority of each tenant and the tenant behavior data of each tenant in the current time period.

[0053] Step S104: Obtain the target optimization function.

[0054] The objective optimization function is determined based on the tenant behavior data of the current period and the query frequency of the future period; the query frequency of the future period is determined based on the long short-term memory network model to process the tenant behavior data of the current period.

[0055] To anticipate changes in tenant query load, the terminal employs a Long Short-Term Memory (LSTM) network model. Based on current tenant behavior data, such as query frequency, it converts the query frequency into a query frequency feature vector to predict future query frequencies, thereby optimizing resource allocation. The future query frequency is denoted as... The basic formula for the Long Short-Term Memory (LSTM) network model is shown in formula (1):

[0056] Formula (1)

[0057] In the formula, Represents the hidden state of an LSTM cell, used to store long-term dependency information in a time series. Represents the sigmoid activation function , and These represent the weight matrix and bias term of the input and hidden state, respectively. This represents the current input time. This represents the hidden state at the previous moment. This represents the query frequency at prediction time t+k, used to adjust resource allocation strategies in advance. This represents the output layer weight matrix. This represents the output layer bias term.

[0058] Optionally, using an LSTM model, the terminal can predict the query frequency for future periods based on tenant behavior data for the current period and tenant behavior data for historical periods.

[0059] Optionally, the terminal determines the target optimization function based on the tenant behavior data of the current time period and the query frequency of future time periods, and the terminal obtains the target optimization function.

[0060] Step S106: Solve the objective optimization function to obtain the resource allocation scheme.

[0061] Optionally, the terminal obtains a resource allocation scheme by solving the objective optimization function using mixed-integer programming or a heuristic algorithm. Examples of heuristic algorithms include genetic algorithms.

[0062] Furthermore, the terminal uses a genetic algorithm for global search to generate an initial population and iteratively evolve it; linear programming or integer programming is used for local fine-grained search of high-quality solutions; node capacity constraints and tenant SLA requirements are considered during the optimization process; the optimal tenant and node allocation matrix and resource quota configuration, i.e., the resource allocation scheme, are output. This completes the solution of the objective optimization function.

[0063] Step S108: Adjust the resource allocation scheme according to the comprehensive behavior score of each tenant to obtain the adjusted resource allocation scheme, and execute the adjusted resource allocation scheme.

[0064] Optionally, the terminal adjusts the resource allocation of the top X% of tenants in the overall behavior score within the resource allocation scheme, where X is greater than 0. For example, the top 20% of tenants in the overall behavior score are allocated to high-performance nodes in the search engine cluster; the bottom 20% of tenants in the overall behavior score are allocated to shared nodes in the search engine cluster. The terminal executes the adjusted resource allocation scheme to distribute the tenant's index shards to the corresponding nodes in the search engine cluster and configures the nodes with the resources required by the tenant.

[0065] Optionally, the terminal continuously monitors the tenant's resource usage over a certain period, dynamically adjusts the tenant's overall behavior score, and adjusts the minimization objective function in real time based on actual usage behavior, thereby adjusting index allocation. When a tenant's query behavior or data increment changes significantly, the system can respond promptly, dynamically adjusting node resources to ensure the rationality and efficiency of resource allocation.

[0066] The multi-tenant-based resource allocation method described above first obtains the comprehensive behavioral score of each tenant. This score is determined based on the priority of each tenant in the search engine cluster and their current-time tenant behavior data. Second, it obtains the objective optimization function, which is determined based on the current-time tenant behavior data and the query frequency for future periods. The future query frequency is determined by processing the current-time tenant behavior data using a Long Short-Term Memory (LSTM) network model. Solving the objective optimization function yields the resource allocation scheme. Predicting the future query frequency provides a reference for subsequent dynamic index creation, avoiding the impact of sudden query spikes on cluster performance. Finally, the resource allocation scheme is adjusted based on the comprehensive behavioral scores of each tenant, resulting in an adjusted scheme, which is then executed. By combining the comprehensive behavioral scores of each tenant with the resource allocation scheme obtained from the objective function, node resources are dynamically adjusted in real time to ensure the rationality and efficiency of resource allocation.

[0067] In one exemplary embodiment, such as Figure 2 As shown, obtaining the target optimization function includes the following steps S202 to S208. Wherein:

[0068] Step S202: Obtain the current time period's tenant behavior data for each tenant in the search engine cluster.

[0069] Step S204: Quantize the tenant behavior data to obtain the tenant behavior feature vector.

[0070] Among them, tenant behavior data includes query frequency, data increment, and query delay.

[0071] Query frequency represents the number of query requests made by tenant i per unit of time, i.e., the pressure of processing queries. Query frequency = T_i / Δt, where T_i is the total number of queries made by tenant i, and Δt is the observation time interval.

[0072] Data increment represents the amount of data written by tenant i per unit time, which is also the pressure of data storage growth. Data increment = W_i / Δt, where W_i is the amount of data written per unit time.

[0073] Query latency represents the average latency of tenant i's query. ,in, This is the response time for each query. This represents the number of queries.

[0074] Optionally, the terminal obtains the total number of queries, the amount of data written per unit time, the number of queries, and the response time of each query for each tenant in the search engine cluster during the current time period, and calculates the behavioral data of each tenant in real time, such as the query frequency, data increment, and query delay for each tenant during the current time period. For each tenant i, the terminal quantifies its tenant behavioral data to obtain a tenant behavioral feature vector, such as the query frequency feature vector denoted as... The incremental feature vector of data is denoted as Query delayed feature vector .

[0075] Step S206: Determine the initial optimization function based on the tenant behavior feature vector.

[0076] Optionally, the terminal denotes the query frequency feature vector as follows: The incremental feature vector of data is denoted as Query delayed feature vector Determine the initial optimization function.

[0077] Step S208: Optimize the initial optimization function based on the query frequency in the future time period to obtain the target optimization function.

[0078] Optionally, the terminal uses an LSTM model to predict the query frequency for future time periods. The initial optimization function, determined based on the tenant behavior feature vector, is optimized to obtain the objective optimization function.

[0079] In this embodiment, the target optimization function can be determined by using the tenant behavior feature vector and the query frequency feature vector.

[0080] In one exemplary embodiment, such as Figure 3As shown, tenant behavior data includes query frequency, data increment, and query latency; based on the tenant behavior feature vector, an initial optimization function is determined, including steps S302 to S306. Wherein:

[0081] Step S302: Based on the query frequency feature vector corresponding to the query frequency and the data increment feature vector corresponding to the data increment, determine the resource consumption function of the tenant's node in the search engine cluster.

[0082] Optionally, the terminal uses the query frequency feature vector corresponding to the query frequency. and the data increment feature vector corresponding to the data increment. The resource consumption function of tenant i in node j of the search engine cluster is determined as shown in formula (2).

[0083] Formula (2)

[0084] In the formula, This represents the resource consumption function of tenant i at node j; The coefficient representing the influence of query frequency feature vector on resource consumption; The coefficient representing the impact of incremental data feature vectors on resource consumption.

[0085] Step S304: Determine the query latency function of the tenant on the node based on the query latency feature vector corresponding to the query latency.

[0086] Optionally, query delayed feature vectors With node load factor Relatedly, the terminal determines the query delay function of the tenant on the node based on the query delay feature vector corresponding to the query delay and the node load coefficient, as shown in formula (3).

[0087] Formula (3)

[0088] In the formula, The query delay function for tenant i at node j; The query processing capacity constant of the node; The load factor representing node j ranges from [0,1]. The closer it gets to 1, the greater the delay.

[0089] Step S306: Determine the initial optimization function based on the resource consumption function and query latency function of the tenant's nodes in the search engine cluster.

[0090] Optionally, in order to comprehensively consider resource consumption and query latency, the terminal determines the initial optimization function based on the sum of the resource consumption function and query latency function of the tenant's nodes in the search engine cluster and minimizes it, as shown in formula (4).

[0091] Formula (4)

[0092] In the formula, This represents the weighted balance between controlling resource consumption and query latency; the specific value is determined by actual business needs. N represents the total number of tenants.

[0093] In this embodiment, the initial optimization function is determined by minimizing the objective function. The initial optimization function can achieve efficient resource allocation and control query latency.

[0094] In an exemplary embodiment, optimizing the initial optimization function based on the query frequency of future time periods to obtain the target optimization function includes: replacing the query frequency feature vector in the initial optimization function with the query frequency feature vector of future time periods corresponding to the query frequency of future time periods, thereby obtaining the target optimization function.

[0095] Optionally, the terminal replaces the query frequency feature vector in the initial optimization function with the query frequency feature vector of the future time period to obtain the target optimization function, that is, replaces the query frequency feature vector in formula (4) with the query frequency feature vector of the future time period to obtain the target optimization function, as shown in formula (5).

[0096] Formula (5)

[0097] In this embodiment, the optimal resource allocation strategy is determined by combining resource consumption, query latency, and the query frequency feature vector of the predicted future time period through the objective optimization function and minimizing the overall data.

[0098] In one exemplary embodiment, such as Figure 4 As shown, the comprehensive behavioral score for each tenant is obtained, including steps S402 to S410. Wherein:

[0099] Step S402: Obtain the current time period's tenant behavior data for each tenant in the search engine cluster.

[0100] Among them, tenant behavior data includes query frequency, data increment, and query latency.

[0101] Optionally, the terminal obtains tenant behavior data for each tenant in the search engine cluster for the current time period, including query frequency, data increment, and query latency.

[0102] Step S404: Quantify the behavioral data of each tenant to determine the behavioral feature vector of each tenant.

[0103] Among them, tenant behavior data includes query frequency feature vector, data increment feature vector, and query latency feature vector.

[0104] Optionally, the terminal quantifies the obtained query frequency, data increment, and query latency to determine the query frequency feature vector, the data increment feature vector, and the query latency feature vector.

[0105] Step S406: Replace the query frequency feature vector with the query frequency feature vector for future time periods.

[0106] The query frequency feature vector for future time periods is determined based on the query frequency for future time periods; the query frequency for future time periods is predicted by an LSTM model.

[0107] Optionally, the terminal replaces the query frequency feature vector with the query frequency feature vector for future time periods.

[0108] Step S408: Determine the initial behavior score for each tenant based on the query frequency feature vector, data increment feature vector, and query delay feature vector for future time periods.

[0109] Optionally, before replacing the query frequency feature vector with the query frequency feature vector for future time periods, the terminal uses the query frequency feature vector as a basis for... and the weight w1 of query frequency, and the incremental feature vector of data. and the weight w2 of the data increment and the query latency feature vector The initial behavior score of each tenant is determined by the weight w3 of the query delay, as shown in formula (6).

[0110] Formula (6)

[0111] After the query frequency feature vector is replaced with the query frequency feature vector for future time periods, the terminal uses the query frequency feature vector for future time periods as a basis. and the weight w1 of query frequency, and the incremental feature vector of data. and the weight w2 of the data increment and the query latency feature vector The initial behavior score of each tenant is determined by the weight w3 of the query delay, as shown in formula (7).

[0112] Formula (7)

[0113] Step S410: Adjust the initial behavior score of each tenant according to the priority of each tenant in the search engine cluster to obtain the comprehensive behavior score of each tenant.

[0114] Optionally, in a multi-tenant environment, to ensure that high-priority tenants can obtain more resources, the endpoint acquires the tenant's priority. The priority of each tenant... Weights used to adjust resource allocation. Final comprehensive behavioral score. As shown in formula (8).

[0115] Formula (8)

[0116] In the formula, This represents the priority of tenant i; the larger the value, the higher the priority. The overall behavioral score representing tenant i is used to dynamically adjust resource allocation.

[0117] In this embodiment, the comprehensive behavioral score of each tenant, determined by combining the predicted query frequency of each tenant in the future time period with the priority of each tenant, can dynamically adjust resource allocation.

[0118] In an exemplary embodiment, the adjusted resource allocation scheme includes the target node to which each tenant's index should be allocated, and the resource quota of each tenant; executing the adjusted resource allocation scheme includes: migrating each tenant's index to the corresponding target node in the search engine cluster according to the target node to which each tenant's index should be allocated; and configuring each tenant's CPU quota, memory quota, and storage space quota on the target node according to each tenant's resource quota.

[0119] Optionally, assume a scenario with 3 tenants (A, B, and C) and 2 nodes (node ​​1 and node 2). The terminal calculates the overall behavioral score for each tenant, for example, S'(A) = 2.0 × (w1 × 1200 + w2 × 50 + w3 × 50) = high score; S'(B) = medium score; S'(C) = low score. The terminal solves the objective function to obtain a resource allocation scheme, for example, tenant A is allocated to node 1; tenant B is allocated to node 2; tenant C is allocated to node 2. Node 1 is a low-load, high-performance node, and node 2 is a normal node. Since tenant B's overall behavioral score is medium, according to the rule (allocating low-scoring tenants to normal nodes), tenant B is allocated to node 1. The adjusted resource allocation scheme includes the target nodes that each tenant's index should be allocated to, such as tenant A allocated to node 1; tenant B allocated to node 1; and tenant C allocated to node 2. The adjusted resource allocation scheme also includes resource quotas for each tenant, such as the CPU share, memory limit, and storage space quota allocated to each tenant. Based on the resource quotas of each tenant, the CPU quota, memory quota, and storage space quota of each tenant are configured on the target node.

[0120] In this embodiment, by refining the resource allocation scheme into specific node allocation and quota configuration operations, precise resource control and performance isolation can be achieved, ensuring that high-priority tenants receive stable service quality assurance, while improving the overall utilization rate of cluster resources, thus achieving the technical effect of refined management and dynamic optimization of resource allocation in a multi-tenant environment.

[0121] In one exemplary embodiment, such as Figure 5 As shown, the terminal obtains the total number of queries, the amount of data written per unit time, the number of queries, and the response time of each query for each tenant in the search engine cluster during the current time period. It then calculates the behavioral data of each tenant in real time, such as the query frequency, data increment, and query latency for each tenant during the current time period. For each tenant i, the terminal quantifies its tenant behavioral data to obtain a tenant behavioral feature vector, such as the query frequency feature vector denoted as... The incremental feature vector of data is denoted as Query delayed feature vector .

[0122] The terminal employs a Long Short-Term Memory (LSTM) network model to predict future query frequencies based on current tenant behavior data, such as query frequency, by converting the query frequency into a query frequency feature vector. This optimizes resource allocation. The future query frequency is denoted as... The basic formula for the Long Short-Term Memory (LSTM) network model is shown in formula (1):

[0123] Formula (1)

[0124] The terminal uses the query frequency feature vector corresponding to the query frequency. and the data increment feature vector corresponding to the data increment. The resource consumption function of tenant i in node j of the search engine cluster is determined as shown in formula (2).

[0125] Formula (2)

[0126] The terminal determines the query latency function of the tenant on the node based on the query latency feature vector corresponding to the query latency and the node load coefficient, as shown in formula (3).

[0127] Formula (3)

[0128] The terminal determines the initial optimization function by minimizing the sum of the resource consumption function and query latency function of the nodes in the search engine cluster, as shown in formula (4).

[0129] Formula (4)

[0130] The terminal replaces the query frequency feature vector in the initial optimization function with the query frequency feature vector of the future time period to obtain the target optimization function, that is, replaces the query frequency feature vector in formula (4) with the query frequency feature vector of the future time period to obtain the target optimization function, as shown in formula (5).

[0131] Formula (5)

[0132] After the query frequency feature vector is replaced with the query frequency feature vector for future time periods, the terminal uses the query frequency feature vector for future time periods as a basis. and the weight w1 of query frequency, and the incremental feature vector of data. and the weight w2 of the data increment and the query latency feature vector The initial behavior score of each tenant is determined by the weight w3 of the query delay, as shown in formula (7).

[0133] Formula (7)

[0134] In a multi-tenant environment, to ensure that high-priority tenants receive more resources, the endpoint obtains the tenant's priority. The priority of each tenant is determined by... Weights used to adjust resource allocation. Final comprehensive behavioral score. As shown in formula (8).

[0135] Formula (8)

[0136] Assume a scenario with 3 tenants (A, B, and C) and 2 nodes (node ​​1 and node 2). The terminal calculates the overall behavioral score for each tenant, for example, S'(A) = 2.0 × (w1 × 1200 + w2 × 50 + w3 × 50) = high score; S'(B) = medium score; S'(C) = low score. The terminal uses a genetic algorithm to solve the objective function and obtain a resource allocation scheme, for example, tenant A is allocated to node 1; tenant B is allocated to node 2; tenant C is allocated to node 2. Node 1 is a low-load, high-performance node, and node 2 is a normal node. Since tenant B's overall behavioral score is medium, according to the rule (allocating low-scoring tenants to normal nodes), tenant B is allocated to node 1. The adjusted resource allocation scheme includes the target nodes that each tenant's index should be allocated to, such as tenant A allocated to node 1; tenant B allocated to node 1; tenant C allocated to node 2. The adjusted resource allocation scheme also includes resource quotas for each tenant, such as the CPU share, memory limit, and storage space quota allocated to each tenant. Based on the resource quotas of each tenant, the CPU quota, memory quota, and storage space quota of each tenant are configured on the target node.

[0137] In this embodiment, a comprehensive behavioral score is generated for each tenant by quantitatively analyzing the tenant's query frequency, data increment, and query latency. Resource allocation for each tenant is then dynamically adjusted based on this score. Unlike static resource allocation, this application can allocate resources in real time according to the actual behavioral needs of tenants, thus avoiding situations where high-load tenants occupy large amounts of resources for extended periods, leading to a decline in service quality for other tenants. Dynamic resource allocation ensures both flexibility in resource usage and stability of tenant services.

[0138] By using an LSTM (Long Short-Term Memory) model to predict future query frequencies, the system can proactively handle sudden query spikes and optimize resource allocation strategies. This ability to anticipate tenant behavior and dynamically adjust query load effectively reduces performance bottlenecks caused by sudden query loads and improves the cluster's predictability and responsiveness.

[0139] By defining an optimization objective function, resource consumption and query latency are minimized. An optimization algorithm globally schedules tenant resource usage, comprehensively considering tenant query load, node load coefficients, and data increments to ensure that overall system resource consumption is reduced while meeting tenant service needs. It enables global resource optimization, ensuring a balance between tenant query performance and cluster resource consumption. By minimizing resource consumption and query latency, performance and resource utilization efficiency are significantly improved.

[0140] By prioritizing resources, key tenants are given greater protection in resource allocation, which improves the system's service quality and tenant experience.

[0141] This invention continuously monitors tenant behavior changes during actual operation and dynamically adjusts index allocation and resource usage based on the latest query load and data increment information. It can make real-time dynamic adjustments based on actual tenant usage, maximizing resource utilization efficiency. Simultaneously, this dynamic adjustment mechanism ensures that it can respond to changes in tenant behavior at any time, reducing the possibility of unreasonable resource allocation.

[0142] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0143] Based on the same inventive concept, this application also provides a multi-tenant-based resource allocation apparatus for implementing the multi-tenant-based resource allocation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more embodiments of the multi-tenant-based resource allocation apparatus provided below can be found in the limitations of the multi-tenant-based resource allocation method described above, and will not be repeated here.

[0144] In one exemplary embodiment, such as Figure 6 As shown, a multi-tenant-based resource allocation device is provided, comprising: a first acquisition module 601, a second acquisition module 602, a solution module 603, and an allocation execution module 604, wherein:

[0145] The first acquisition module 601 is used to acquire the comprehensive behavior score of each tenant; wherein, the comprehensive behavior score is determined based on the priority of each tenant in the search engine cluster and the tenant behavior data of each tenant in the current time period.

[0146] The second acquisition module 602 is used to acquire the target optimization function, wherein the target optimization function is determined based on the tenant behavior data of the current time period and the query frequency of the future time period; the query frequency of the future time period is determined based on the long short-term memory network model to process the tenant behavior data of the current time period.

[0147] Solver module 603 is used to solve the objective optimization function to obtain the resource allocation scheme.

[0148] The allocation execution module 604 is used to adjust the resource allocation scheme based on the comprehensive behavior score of each tenant, obtain the adjusted resource allocation scheme, and execute the adjusted resource allocation scheme.

[0149] In an exemplary embodiment, the second acquisition module 602 is further configured to acquire tenant behavior data of each tenant in the search engine cluster during the current time period; quantify the tenant behavior data to obtain a tenant behavior feature vector; determine an initial optimization function based on the tenant behavior feature vector; and optimize the initial optimization function according to the query frequency in future time periods to obtain a target optimization function.

[0150] In an exemplary embodiment, the tenant behavior data includes query frequency, data increment, and query latency; the second acquisition module 602 is further configured to determine the resource consumption function of the tenant's node in the search engine cluster based on the query frequency feature vector corresponding to the query frequency and the data increment feature vector corresponding to the data increment; determine the query latency function of the tenant's node based on the query latency feature vector corresponding to the query latency; and determine an initial optimization function based on the resource consumption function and query latency function of the tenant's node in the search engine cluster.

[0151] In an exemplary embodiment, the second acquisition module 602 is further configured to replace the query frequency feature vector in the initial optimization function with the query frequency feature vector of the future time period corresponding to the query frequency of the future time period, thereby obtaining the target optimization function.

[0152] In an exemplary embodiment, the first acquisition module 601 is further configured to acquire tenant behavior data of each tenant in the search engine cluster for the current time period; wherein, the tenant behavior data includes query frequency, data increment, and query latency; quantify each tenant behavior data to determine each tenant behavior feature vector; wherein, the tenant behavior data includes query frequency feature vector, data increment feature vector, and query latency feature vector; replace the query frequency feature vector with a query frequency feature vector for a future time period; wherein, the query frequency feature vector for a future time period is determined based on the query frequency of the future time period; determine the initial behavior score of each tenant based on the query frequency feature vector, data increment feature vector, and query latency feature vector for the future time period; adjust the initial behavior score of each tenant according to the priority of each tenant in the search engine cluster to obtain the comprehensive behavior score of each tenant.

[0153] In an exemplary embodiment, the adjusted resource allocation scheme includes the target node to which each tenant's index should be allocated, and the resource quota of each tenant; the allocation execution module 604 is further configured to migrate each tenant's index to the corresponding target node in the search engine cluster according to the target node to which each tenant's index should be allocated; and configure each tenant's CPU quota, memory quota and storage space quota on the target node according to each tenant's resource quota.

[0154] The modules in the aforementioned multi-tenant-based resource allocation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of the computer device as software, so that the processor can invoke and execute the operations corresponding to each module.

[0155] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores tenant data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a multi-tenant-based resource allocation method.

[0156] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0157] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0158] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0159] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0160] It should be noted that the tenant behavior data involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0161] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0162] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0163] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A resource allocation method based on multi-tenancy, characterized in that, The method includes: Obtain the comprehensive behavior score of each tenant; wherein the comprehensive behavior score is determined based on the priority of each tenant in the search engine cluster and the tenant behavior data of each tenant in the current time period; Obtain the target optimization function, wherein the target optimization function is determined based on the tenant behavior data of the current time period and the query frequency of future time periods; the query frequency of future time periods is determined based on the processing of the tenant behavior data of the current time period using a long short-term memory network model; Solve the objective function to obtain the resource allocation scheme; The resource allocation scheme is adjusted based on the comprehensive behavioral scores of each tenant to obtain the adjusted resource allocation scheme, and the adjusted resource allocation scheme is then executed.

2. The method according to claim 1, characterized in that, The process of obtaining the target optimization function includes: Obtain the tenant behavior data of each tenant in the search engine cluster during the current time period; The tenant behavior data is quantified to obtain a tenant behavior feature vector; Based on the tenant behavior feature vector, determine the initial optimization function; The initial optimization function is optimized based on the query frequency of the future time period to obtain the target optimization function.

3. The method according to claim 2, characterized in that, The tenant behavior data includes query frequency, data increment, and query latency; the determination of the initial optimization function based on the tenant behavior feature vector includes: Based on the query frequency feature vector corresponding to the query frequency and the data increment feature vector corresponding to the data increment, the resource consumption function of the tenant's node in the search engine cluster is determined. Based on the query latency feature vector corresponding to the query latency, determine the tenant's query latency function on the node; The initial optimization function is determined based on the resource consumption function and query latency function of the node in the search engine cluster.

4. The method according to claim 3, characterized in that, The step of optimizing the initial optimization function based on the query frequency of the future time period to obtain the target optimization function includes: The target optimization function is obtained by replacing the query frequency feature vector in the initial optimization function with the query frequency feature vector of the future time period corresponding to the query frequency of the future time period.

5. The method according to claim 1, characterized in that, The process of obtaining the comprehensive behavioral score for each tenant includes: Obtain the current time period's tenant behavior data for each tenant in the search engine cluster; wherein, the tenant behavior data includes query frequency, data increment, and query latency; The tenant behavior data is quantified to determine the behavior feature vector of each tenant; wherein, the tenant behavior data includes query frequency feature vector, data increment feature vector and query latency feature vector; Replace the query frequency feature vector with a query frequency feature vector for a future time period; wherein the query frequency feature vector for the future time period is determined based on the query frequency of the future time period. Based on the query frequency feature vector of the future time period, the data increment feature vector, and the query delay feature vector, the initial behavior score of each tenant is determined; Based on the priority of each tenant in the search engine cluster, the initial behavior score of each tenant is adjusted to obtain the comprehensive behavior score of each tenant.

6. The method according to claim 1, characterized in that, The adjusted resource allocation scheme includes the target nodes to be allocated to each tenant's index, and the resource quota for each tenant; executing the adjusted resource allocation scheme includes: Based on the target node to which each tenant's index should be assigned, the indexes of each tenant are migrated to the corresponding target node in the search engine cluster; Based on the resource quotas of each tenant, configure the CPU quota, memory quota, and storage space quota of each tenant on the target node.

7. A resource allocation device based on multi-tenancy, characterized in that, The device includes: The first acquisition module is used to acquire the comprehensive behavior score of each tenant; wherein, the comprehensive behavior score is determined based on the priority of each tenant in the search engine cluster and the tenant behavior data of each tenant in the current time period; The second acquisition module is used to acquire the target optimization function, wherein the target optimization function is determined based on the tenant behavior data of the current time period and the query frequency of the future time period; the query frequency of the future time period is determined based on the long short-term memory network model to process the tenant behavior data of the current time period. The solution module is used to solve the objective optimization function to obtain the resource allocation scheme; The allocation execution module is used to adjust the resource allocation scheme according to the comprehensive behavior score of each tenant, obtain the adjusted resource allocation scheme, and execute the adjusted resource allocation scheme.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.