Resource configuration method and database change management system

By constructing a resource reuse matrix, plugin packages of the same type of database are allocated to the same container, which solves the problem of resource waste caused by the dispersion of execution functions of the same type of database and realizes efficient reuse of memory resources.

CN118331942BActive Publication Date: 2026-05-12WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WEBANK (CHINA)
Filing Date
2024-04-01
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In existing technologies, databases of the same type have many similar execution functions, which leads to repetitive execution functions being randomly distributed across various machines, making it impossible to share memory resources and resulting in resource waste.

Method used

By constructing a resource reuse matrix based on the resource information and similarity rate of the plugin packages, plugin packages that can reuse resources are allocated to the same container, so that different plugin packages within the same container can reuse memory resources.

Benefits of technology

It saves memory resources, improves resource utilization efficiency, and reduces resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118331942B_ABST
    Figure CN118331942B_ABST
Patent Text Reader

Abstract

The application provides a resource configuration method and a database change management system, and belongs to the technical field of databases. According to resource related information of each plug-in package and a resource upper limit of a single container, the required container quantity can be determined; code files contained in each plug-in package are analyzed to calculate a similarity rate between each two plug-in packages; a resource reuse matrix corresponding to each plug-in package can be determined according to the similarity rate between each two plug-in packages and the resource related information of each plug-in package; and each plug-in package can be allocated to a corresponding container according to the resource reuse matrix and an allocation rule. By allocating plug-in packages capable of reusing resources to the same container, different plug-in packages in the same container can reuse memory resources, so that the memory resources are saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database technology, and in particular to a resource configuration method and a database change management system. Background Technology

[0002] For databases of the same type, there are many similarities in their execution functions. If the conventional resource allocation method is followed, these repetitive execution functions will be randomly distributed across various machines, resulting in redundant resource allocation, inability to share memory resources, and waste of resources. Summary of the Invention

[0003] The main objective of this application is to propose a resource configuration method and a database change management system. The aim is to allocate reusable plugin packages to the same container based on the resource reuse matrix corresponding to each plugin package, allowing different plugin packages within the same container to reuse memory resources, thereby saving memory resources.

[0004] To achieve the above objectives, a first aspect of this application proposes a resource allocation method, the method comprising:

[0005] Determine the required number of containers based on the resource information of each plugin package and the resource capacity limit of a single container;

[0006] The code files contained in each of the plugin packages are analyzed to calculate the pairwise similarity rate between each of the plugin packages;

[0007] Based on the similarity rates between each pair of the plugin packages and the resource-related information of each plugin package, a resource reuse matrix corresponding to each plugin package is determined;

[0008] Each plugin package is assigned to a corresponding container according to the resource reuse matrix and the allocation rules, wherein the allocation rules include assigning plugin packages that can be reused to the same container.

[0009] In one embodiment of this application, determining the required number of containers based on the resource-related information of each plugin package and the resource capacity limit of a single container includes:

[0010] The execution function of the database instance is separated into a plugin package and uploaded. The plugin package contains configuration information and code files. The configuration information contains resource-related information of the plugin package.

[0011] Based on the configuration information corresponding to each plugin package, calculate the total resource usage, total number of database instances, and total daily task volume of all plugin packages;

[0012] The required number of containers is determined based on the total resource usage of all the aforementioned plugin packages, the total number of the aforementioned database instances, the total number of the aforementioned daily tasks, the maximum resource usage capacity of a single container, the maximum number of database instances that a single container can accommodate, and the maximum number of daily tasks that a single container can accommodate.

[0013] In one embodiment of this application, the step of analyzing the code files contained in each plugin package and calculating the pairwise similarity rate between each plugin package includes:

[0014] Analyze the code files contained in any two of the aforementioned plugin packages to obtain the number of identical configuration items and the number of identical entity classes;

[0015] The similarity rate of any two plugin packages is calculated based on the number of identical configuration items, the number of identical entity classes, the total number of configuration items and the total number of entity classes of any two plugin packages.

[0016] In one embodiment of this application, determining the resource reuse matrix corresponding to each plugin package based on the pairwise similarity rate between each plugin package and the resource-related information of each plugin package includes:

[0017] Based on the resource-related information of any two plugin packages, the total resource usage of any two plugin packages is calculated.

[0018] Multiply the sum of the resource usage of any two plugin packages by the similarity rate of any two plugin packages to obtain the number of resource reuses between any two plugin packages;

[0019] Calculate the resource reuse count between each pair of the aforementioned plugin packages and construct a resource reuse matrix.

[0020] In one embodiment of this application, the step of allocating each plugin package to a corresponding container according to the resource reuse matrix and allocation rules includes:

[0021] Find the container with the largest remaining resources from all containers, where the remaining resources are the sum of the remaining resource usage, the remaining number of database instances, and the remaining daily task load.

[0022] Obtain the plugin package with the largest total resources from the unallocated plugin packages, and determine whether the container with the largest remaining total resources can accommodate the plugin package with the largest total resources. The total resources are the sum of the plugin package's resource usage, the number of database instances, and the daily task volume.

[0023] If the container with the largest remaining resources cannot contain the plugin package with the largest remaining resources, exclude the container with the largest remaining resources from all containers and return to the step of obtaining the container with the largest remaining resources from all containers.

[0024] If the container with the largest remaining resources can accommodate the plugin package with the largest remaining resources, then the plugin package with the largest remaining resources is allocated to the container with the largest remaining resources, and the container with the largest remaining resources is used as the target container.

[0025] Update the remaining resource usage, remaining number of database instances, remaining daily task quantity, and total remaining resources of the target container, and update any unallocated plugin packages;

[0026] Based on the resource reuse matrix, obtain the plugin package with the largest resource reuse count with the plugin package in the target container from the updated unallocated plugin packages;

[0027] Determine whether the target container can accommodate the plugin package with the largest resource reuse count;

[0028] When the target container cannot accommodate the plugin package with the largest resource reuse count, the plugin package with the largest resource reuse count is excluded from the unallocated plugin packages, and the step of obtaining the plugin package with the largest resource reuse count from the updated unallocated plugin packages according to the resource reuse matrix is ​​returned.

[0029] When the target container can accommodate the plugin package with the largest number of resource reuses, the plugin package with the largest number of resource reuses is allocated to the target container, and the steps of updating the remaining resource usage, remaining number of database instances, remaining number of daily tasks, and total remaining resources of the target container are returned, and the unallocated plugin packages are updated.

[0030] In one embodiment of this application, when the container with the largest remaining resource total cannot accommodate the plugin package with the largest total resource total, the method further includes:

[0031] If each container cannot hold the plugin package with the largest total resources, then a new container is added to hold the plugin package with the largest total resources.

[0032] In one embodiment of this application, determining whether the container with the largest remaining resource sum can accommodate the plugin package with the largest total resource sum includes:

[0033] The system detects whether the remaining resource usage of the container with the largest remaining resource total is greater than or equal to the resource usage of the plugin package with the largest remaining resource total, whether the remaining number of database instances of the container with the largest remaining resource total is greater than or equal to the number of database instances of the plugin package with the largest remaining resource total, and whether the remaining daily task volume of the container with the largest remaining resource total is greater than or equal to the daily task volume of the plugin package with the largest remaining resource total.

[0034] If the remaining resource usage of the container with the largest remaining resource total is greater than or equal to the resource usage of the plugin package with the largest remaining resource total, and the remaining number of database instances of the container with the largest remaining resource total is greater than or equal to the number of database instances of the plugin package with the largest remaining resource total, and the remaining daily task volume of the container with the largest remaining resource total is greater than or equal to the daily task volume of the plugin package with the largest remaining resource total, then it is determined that the container with the largest remaining resource total can accommodate the plugin package with the largest remaining resource total.

[0035] If the remaining resource usage of the container with the largest remaining resource total is less than the resource usage of the plugin package with the largest remaining resource total, or the remaining number of database instances of the container with the largest remaining resource total is less than the number of database instances of the plugin package with the largest remaining resource total, or the remaining daily task volume of the container with the largest remaining resource total is less than the daily task volume of the plugin package with the largest remaining resource total, then it is determined that the container with the largest remaining resource total cannot accommodate the plugin package with the largest remaining resource total.

[0036] In one embodiment of this application, after the allocation is completed, the method further includes:

[0037] When a new plugin package is detected, the similarity rate between the new plugin package and each of the already assigned plugin packages is calculated, and the resource reuse matrix is ​​updated based on the similarity rate and the resource-related information of each plugin package.

[0038] Based on the updated resource reuse matrix, obtain the first plugin package with the largest resource reuse count with the newly added plugin package from the allocated plugin packages;

[0039] Determine whether the container containing the first plugin package can accommodate the newly added plugin package;

[0040] When the container containing the first plugin package cannot accommodate the newly added plugin package, the first plugin package is excluded from the allocated plugin packages, and the process of retrieving the first plugin package with the largest resource reuse count from the allocated plugin packages based on the updated resource reuse matrix is ​​returned.

[0041] When the container containing the first plugin package is large enough to hold the new plugin package, the new plugin package is allocated to the container containing the first plugin package, and the remaining resource usage, remaining number of database instances, remaining daily task quantity, and total remaining resources of the container containing the first plugin package are updated.

[0042] In one embodiment of this application, after the allocation is completed, the method further includes:

[0043] When a new, deleted, or modified plugin package is detected, the daily task volume of the plugin package is updated according to the historical actual daily task volume of the plugin package during the preset update cycle, except for the plugin package that has been added or modified.

[0044] Update the total resource usage, total number of database instances, and total daily task volume for all plugin packages;

[0045] Based on the total resource usage of all updated plugin packages, the total number of database instances, the total number of daily tasks, the maximum resource usage capacity of a single container, the maximum number of database instances a single container can accommodate, and the maximum number of daily tasks a single container can accommodate, the required number of containers is re-determined.

[0046] Determine whether the newly determined required number of containers is greater than or equal to the current number of containers;

[0047] If the redefined required number of containers is less than the current number of containers, then return to the step of determining the required number of containers based on the resource-related information of each plugin package and the resource capacity limit of a single container;

[0048] If the redefined required number of containers is greater than or equal to the current number of containers, the plugin package will not be reallocated.

[0049] To achieve the above objectives, a second aspect of the embodiments of this application proposes a database change management system, which performs resource configuration based on the configuration method proposed in any embodiment of this application.

[0050] In the technical solution provided in this application embodiment, the required number of containers can be determined based on the resource-related information of each plugin package and the resource capacity limit of a single container. Then, the code files contained in each plugin package are analyzed to calculate the similarity rate between each pair of plugin packages. Thus, based on the similarity rate between each pair of plugin packages and the resource-related information of each plugin package, the resource reuse matrix corresponding to each plugin package can be determined. Furthermore, each plugin package can be allocated to its corresponding container according to the resource reuse matrix and allocation rules. By allocating plugin packages that can reuse resources to the same container, different plugin packages within the same container can reuse memory resources, thereby saving memory resources. Attached Figure Description

[0051] Figure 1 This is a flowchart of the resource configuration method provided in the embodiments of this application;

[0052] Figure 2 This is a flowchart of the steps for determining the required number of containers based on the resource-related information of each plugin package and the resource capacity limit of a single container, as provided in an embodiment of this application.

[0053] Figure 3 This is a flowchart of the steps provided in this application embodiment to analyze the code files contained in each plugin package to calculate the similarity rate between each pair of plugin packages;

[0054] Figure 4 This is a flowchart of the steps to determine the resource reuse matrix corresponding to each plugin package based on the similarity rate between each pair of plugin packages and the resource-related information of each plugin package, as provided in the embodiments of this application.

[0055] Figure 5 This is a flowchart of the steps for allocating each plugin package to the corresponding container according to the resource reuse matrix and allocation rules, provided in an embodiment of this application.

[0056] Figure 6 This is a flowchart illustrating the steps of determining whether the container with the largest remaining resources can accommodate the plugin package with the largest total resources, as provided in this application embodiment.

[0057] Figure 7 This is a resource configuration flowchart provided in an embodiment of this application;

[0058] Figure 8 This is a flowchart of the steps performed after allocation is completed, provided in an embodiment of this application.

[0059] Figure 9 This is a flowchart of another step performed after the allocation is completed, provided in an embodiment of this application;

[0060] Figure 10 This is a flowchart of the database change management system;

[0061] Figure 11 This is the entity-relationship diagram of the database change management system;

[0062] Figure 12 This is a flowchart of the database instance and plugin package addition phase;

[0063] Figure 13 This is a flowchart of the data modification / query task execution phase;

[0064] Figure 14 This is a diagram showing the sequential steps of a data modification / query task.

[0065] Figure 15 This is a flowchart of the database instance and plugin package deletion phase. Detailed Implementation

[0066] 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.

[0067] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0068] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0069] In common IT (Information Technology) systems, there are database management systems (DMS) such as MySQL, used for operations such as permission allocation, data querying, and data modification for specific databases. With the development of databases and the selection of technologies based on business characteristics, more and more database types are used, such as MongoDB, Hive, and Redis. Currently, the management methods for multiple databases involve using the same management system for various databases, with changes made to different database types on different pages within the system. Some systems use a fixed-format database management, where each type of database is handled by different parts of the system, and these parts have fixed physical locations. Other systems use dynamic database management, employing container technology to make the physical locations of these parts variable and dynamically scheduled based on user-configured resource usage limits.

[0070] The relevant technology uses a single execution function for a certain type of database, while different types of databases use different execution functions. Because of the inherent differences between databases, the execution functions will also vary significantly. However, even within the same type of database, there are multiple database instances. Using a uniform execution function for all instances of this type of database cannot meet the isolation needs of different users. Furthermore, because the execution function is uniform, there are fewer restrictions on certain security parameters, leading to poor security and increased risk.

[0071] If we delve into the execution functionality of a database instance, there will be multiple database instances of the same type, resulting in multiple execution functions. Each instance can have different security parameters, offering advantages such as higher security and isolation. However, for databases of the same type, their execution functions often share many similarities. Following conventional resource allocation methods would lead to these repetitive execution functions being randomly distributed across various machines, resulting in redundant resource allocation, inability to share memory resources, and ultimately, resource waste.

[0072] Based on this, this application proposes a resource configuration method, which aims to allocate resource-reusable plugin packages to the same container according to the resource reuse matrix corresponding to each plugin package, so that different plugin packages in the same container can reuse memory resources, thereby saving memory resources.

[0073] Reference Figure 1 , Figure 1 This is a flowchart of a resource configuration method provided in the embodiments of this application, including but not limited to steps S110 to S140.

[0074] Step S110: Determine the required number of containers based on the resource-related information of each plugin package and the resource capacity limit of a single container.

[0075] In this embodiment, each plugin package contains corresponding configuration information and code files. The configuration information includes database instance-related information such as database type, IP address, port number, database name, user, and operation type. The configuration information also includes restriction-related information such as timeout, row limit, and concurrency. The configuration information also includes resource-related information for the plugin package, such as resource usage, number of database instances, and daily task load. The configuration information is used to associate a unique database instance, restrict resource usage, and rationally allocate container resources. The code files contain information such as identifying which database the operation is for, verifying whether the operation content meets the requirements, executing the operation, and returning the operation result. The code files are used to complete database change / query operations. For example, a business administrator uploads a plugin package with the following configuration information: a total of 10 database instances, one of which is a MongoDB database, with an IP address of 168.192.1.2, a port of 27000, a database name of Customer, a user of Ruser, an operation type of select, a timeout of 90 seconds, a row limit of 100 rows, and a concurrency of 2. The resource information for each plugin package includes: resource usage of 20, database instance count of 10, and daily task count of 20. Therefore, based on the resource information of each plugin package, the total resource usage, total database instance count, and total daily task count for all plugin packages can be calculated. Then, based on the resource capacity limits of a single container, such as the maximum resource usage limit, the maximum number of database instances, and the maximum daily task capacity, the required number of containers can be determined.

[0076] Reference Figure 2 , Figure 2 This is a flowchart of the steps for determining the required number of containers based on the resource-related information of each plugin package and the resource capacity limit of a single container, provided in the embodiments of this application, including but not limited to steps S210 to S230.

[0077] Step S210: Separate the execution function of the database instance into a plugin package and upload it. The plugin package contains configuration information and code files. The configuration information contains resource-related information of the plugin package.

[0078] Step S220: Based on the configuration information corresponding to each plugin package, calculate the total resource usage, total number of database instances, and total daily task volume of all plugin packages.

[0079] Step S230: Determine the required number of containers based on the total resource usage of all plugin packages, the total number of database instances, the total number of daily tasks, the maximum resource usage capacity of a single container, the maximum number of database instances a single container can accommodate, and the maximum number of daily tasks a single container can accommodate.

[0080] In this embodiment, a database instance includes its type, IP address, port number, database name, user, and authentication information. For example, a system administrator adds a database instance with the database type "mongodb," IP address 168.192.1.2, port number 27000, database name "Customer," user name "Ruser," and authentication information "4RFVCvfr." In subsequent examples, this database instance will be referred to as database instance A. The execution functionality of database instance A is separated into a plugin package and uploaded to the system. The plugin package is associated with database instance A and also contains configuration information and code files. The configuration information of the plugin package records information about the database instance, such as its type, IP address, port number, database name, and user. This information is associated with a unique database instance. The configuration information also includes the operation type on the database instance, such as query or update. The configuration information also includes resource-related information for the plugin package, such as resource usage, number of database instances, and daily task load. Resource usage refers to the resource consumption of the plugin package on the container, including memory and CPU usage. The container's memory and CPU usage have upper limits. The number of database instances reflects the network connectivity of the plugin package. Container network connectivity is limited; too many instances can lead to network congestion. The daily task volume reflects the usage intensity of the plugin package. Based on the resource usage, database instance count, and daily task volume of each plugin package, the total resource usage, database instance count, and daily task volume of all plugin packages can be calculated. Therefore, the required number of containers can be determined based on the total resource usage, database instance count, and daily task volume of all plugin packages, the maximum resource usage capacity of a single container, the maximum database instance capacity of a single container, and the maximum daily task capacity of a single container. Specifically, the required number of containers = MAX(total resource usage * 110% / maximum resource usage capacity of a single container, total database instance count * 120% / maximum database instance capacity of a single container, total daily task volume * 120% / maximum daily task capacity of a single container), rounding up if the result is a decimal.

[0081] For example, there are 7 plugin packages: A, B, C, D, E, F, and G. Their corresponding resource usage, number of database instances, and daily task volume are shown in Table 1. Based on Table 1, the total resource usage of all plugin packages is 200, the total number of database instances is 88, and the total daily task volume is 113. Setting the maximum resource usage capacity of a single container to 80, the maximum number of database instances to 40, and the maximum daily task volume to 60, the required number of containers N = MAX(200 * 110% / 80, 88 * 120% / 40, 113 * 120% / 60) = 3.

[0082] Table 1. Plugin Packages and Corresponding Resource Information Table

[0083] Plugin package number resource usage Number of database instances Daily task volume A 10 10 10 B 30 15 20 C 30 5 5 D 50 15 25 E 20 10 20 F 30 13 15 G 30 20 18

[0084] Step S120: Analyze the code files contained in each plugin package to calculate the pairwise similarity rate between each plugin package.

[0085] In this embodiment of the application, each plugin package contains a corresponding code file. By analyzing the code file corresponding to each plugin package, the same configuration items and the same entity classes between the two plugin packages can be determined. Thus, the similarity rate between the two plugin packages can be calculated based on the number of the same configuration items and the number of the same entity classes between the two plugin packages.

[0086] Reference Figure 3 , Figure 3 This application provides a flowchart of steps for analyzing the code files contained in each plugin package to calculate the similarity rate between each pair of plugin packages, including but not limited to steps S310 to S320.

[0087] Step S310: Analyze the code files contained in any two plugin packages to obtain the number of identical configuration items and the number of identical entity classes;

[0088] Step S320: Calculate the similarity rate of any two plugin packages based on the number of identical configuration items, the number of identical entity classes, the total number of configuration items and the total number of entity classes of any two plugin packages.

[0089] In this embodiment, by analyzing the code files contained in two plugin packages, the number of identical configuration items and the number of identical entity classes between the two plugin packages can be determined. Therefore, the similarity rate between any two plugin packages can be calculated based on the number of identical configuration items, the number of identical entity classes, the total number of configuration items in any two plugin packages, and the total number of entity classes. Specifically, the similarity rate between the two plugin packages is obtained by dividing the number of identical configuration items by the total number of configuration items in both plugin packages, adding the number of identical entity classes by the total number of entity classes in both plugin packages, and then dividing the sum by 2. In this way, the pairwise similarity rate between each plugin package can be calculated. Configuration items with the same name and value are considered identical configuration items; entity classes with the same class name, the same constants within the class, the same variables within the class, and the same functions within the class are considered identical entity classes. By identifying identical configuration items and entity classes, when loading plugin packages, newly added plugin packages can share the common parts of already loaded plugin packages, achieving memory reuse and saving CPU consumption.

[0090] For example, there are plugin package A and plugin package B. Plugin package A has 20 configuration items, and plugin package B has 30 configuration items. Plugin package A has 70 entity classes, and plugin package B has 130 entity classes. Among these, plugin package A and plugin package B have 2 configuration items with the same name and value, meaning the number of identical configuration items is 2. Plugin package A and plugin package B have 4 entity classes with the same class name, the same class constants, the same class variables, and the same class functions, meaning the number of identical entity classes is 4. Therefore, plugin package A and plugin package B...

[0091] Step S130: Determine the resource reuse matrix corresponding to each plugin package based on the similarity rate between each pair of plugin packages and the resource-related information of each plugin package.

[0092] In this embodiment of the application, after calculating the similarity rate between each pair of plugin packages, a resource reuse matrix corresponding to each plugin package can be constructed based on the similarity rate between each pair of plugin packages and the resource-related information of each plugin package.

[0093] Reference Figure 4 , Figure 4 This application provides a flowchart of steps for determining the resource reuse matrix corresponding to each plugin package based on the similarity rate between each pair of plugin packages and the resource-related information of each plugin package, including but not limited to steps S410 to S430.

[0094] Step S410: Calculate the total resource usage of any two plugin packages based on their resource-related information.

[0095] Step S420: Multiply the sum of resource usage of any two plugin packages by the similarity rate of any two plugin packages to obtain the resource reuse count between any two plugin packages.

[0096] Step S430: Calculate the number of resource reuses between each pair of plugin packages and construct the resource reuse matrix.

[0097] In this embodiment, each plugin package contains configuration information, including resource-related information such as resource usage, number of database instances, and daily task volume. Therefore, based on the resource-related information of any two plugin packages, the total resource usage of the two plugin packages can be calculated. Multiplying the total resource usage of any two plugin packages by their similarity rate yields the resource reuse count between them. In this way, the pairwise resource reuse count between each plugin package can be calculated. Thus, a resource reuse matrix for each plugin package can be further constructed.

[0098] For example, the similarity rate between plugin package A and plugin package B is 0.03, as shown in Table 1. The resource usage of plugin package A is 10, and the resource usage of plugin package B is 30. Therefore, the total resource usage of plugin package A and plugin package B can be calculated to be 10 + 30 = 40, and the resource reuse number can be calculated to be 0.03 * 40 = 1.2. This value is then filled into the positions of row A, column B and row B, column A in the matrix. Following the same method, the resource reuse number of AG can be calculated and filled into the resource reuse matrix. The resource reuse matrix of AG is shown in Table 2.

[0099] Table 2 Example of Resource Reuse Matrix

[0100]

[0101]

[0102] Step S140: Allocate each plugin package to the corresponding container according to the resource reuse matrix and allocation rules, wherein the allocation rules include allocating plugin packages that can be reused to the same container.

[0103] In this embodiment, after constructing the resource reuse matrix among the various plugin packages, the plugin packages that can reuse resources can be further allocated to the same container according to the resource reuse matrix. The resource reuse values ​​in the resource reuse matrix represent the amount of resources that can be reused between two plugin packages. By allocating plugin packages that can reuse resources to the same container, different plugin packages within the same container can reuse memory resources, thereby saving memory resources.

[0104] Reference Figure 5 , Figure 5 This is a flowchart of the steps for allocating each plugin package to the corresponding container according to the resource reuse matrix and allocation rules provided in the embodiments of this application, including but not limited to steps S510 to S590.

[0105] Step S510: Obtain the container with the largest remaining resource total from all containers. The remaining resource total is the sum of the remaining resource usage, the remaining number of database instances, and the remaining daily task volume.

[0106] In this embodiment, each container includes a capacity for resource usage, the number of database instances, and the daily task load. The total remaining resources for each container are calculated by summing the remaining resource usage, the remaining number of database instances, and the remaining daily task load. Specifically, the remaining resource usage of a single container is the maximum resource usage capacity of that container minus the sum of the resource usage of all plugin packages within that container; the remaining number of database instances in a single container is the maximum number of database instances in that container minus the sum of the number of database instances of all plugin packages within that container; and the remaining daily task load of a single container is the maximum daily task load capacity of that container minus the sum of the daily task load of all plugin packages within that container. Sorting the containers according to their total remaining resources from largest to smallest yields a sorting table. For example, there are currently 3 containers, and their total remaining resources are shown in Table 3 below:

[0107] Table 3. Examples of information related to containers and their resources.

[0108] Container number resource usage Number of database instances Daily task volume Total remaining resources Sort ① 80 40 60 180 1 ② 80 40 60 180 1 ③ 80 40 60 180 1

[0109] Step S520: Obtain the plugin package with the largest total resources from the unallocated plugin packages, and determine whether the container with the largest remaining total resources can accommodate the plugin package with the largest total resources. The total resources are the sum of the plugin package's resource usage, the number of database instances, and the daily task volume.

[0110] In this embodiment, the configuration information of each plugin package includes resource-related information, such as resource usage, number of database instances, and daily task volume. Therefore, the total resources of each plugin package can be calculated based on its configuration information. The total resources of a plugin package are the sum of resource usage, number of database instances, and daily task volume. Sorting the plugin packages according to their total resources from largest to smallest yields a sorted table of plugin packages. For example, the sorted plugin packages shown in Table 1 are shown in Table 4 below:

[0111] Table 4. Plugin Package Sorting Table

[0112] Plugin package number Total resource requirements Sort D 90 1 G 68 2 B 65 3 F 58 4 E 50 5 C 40 6 A 30 7

[0113] The system retrieves the plugin package with the largest total resources from the unallocated plugin packages and determines whether the container with the largest remaining resources can accommodate it. Specifically, it checks if the remaining resources of the container with the largest remaining resources are greater than or equal to the total resources of the plugin package with the largest remaining resources. If they are, it further checks if the remaining resource usage of the container with the largest remaining resources is greater than or equal to the resource usage of the plugin package with the largest remaining resources, the remaining number of database instances in the container with the largest remaining resources is greater than or equal to the number of database instances in the plugin package with the largest remaining resources, and the remaining daily task load in the container with the largest remaining resources is greater than or equal to the daily task load of the plugin package with the largest remaining resources. If all these conditions are met, it can be determined that the container with the largest remaining resources can accommodate the plugin package with the largest remaining resources; otherwise, it is considered that the container with the largest remaining resources cannot accommodate the plugin package with the largest remaining resources.

[0114] Specifically, refer to Figure 6 , Figure 6 This is a flowchart illustrating the steps of whether the container with the largest remaining resources can accommodate the plugin package with the largest total resources, as provided in this application embodiment, including but not limited to steps S610 to S650.

[0115] Step S610: Check whether the remaining resource usage of the container with the largest total remaining resources is greater than or equal to the resource usage of the plugin package with the largest total remaining resources.

[0116] Step S610: If the remaining resource usage of the container with the largest total remaining resources is greater than or equal to the resource usage of the plugin package with the largest total remaining resources, then check whether the remaining number of database instances of the container with the largest total remaining resources is greater than or equal to the number of database instances of the plugin package with the largest total remaining resources.

[0117] Step S630: If the number of remaining database instances of the container with the largest remaining total resources is greater than or equal to the number of database instances of the plugin package with the largest total resources, then check whether the remaining daily task volume of the container with the largest remaining total resources is greater than or equal to the daily task volume of the plugin package with the largest total resources.

[0118] Step S640: If the remaining daily task volume of the container with the largest total remaining resources is greater than or equal to the daily task volume of the plugin package with the largest total resources, then it is determined that the container with the largest remaining resources can accommodate the plugin package with the largest total resources.

[0119] Step S650: If the remaining resource usage of the container with the largest remaining resource total is less than the resource usage of the plugin package with the largest remaining resource total, or the remaining number of database instances of the container with the largest remaining resource total is less than the number of database instances of the plugin package with the largest remaining resource total, or the remaining daily task volume of the container with the largest remaining resource total is less than the daily task volume of the plugin package with the largest remaining resource total, then it is determined that the container with the largest remaining resource total cannot accommodate the plugin package with the largest remaining resource total.

[0120] In this embodiment of the application, by detecting whether the remaining resource usage of the container with the largest remaining resource total is greater than or equal to the resource usage of the plugin package with the largest remaining resource total, whether the remaining number of database instances of the container with the largest remaining resource total is greater than or equal to the number of database instances of the plugin package with the largest remaining resource total, and whether the remaining daily task volume of the container with the largest remaining resource total is greater than or equal to the daily task volume of the plugin package with the largest remaining resource total, it can be accurately determined whether the container with the largest remaining resource total can accommodate the plugin package with the largest remaining resource total.

[0121] Step S530: When the container with the largest remaining resources cannot contain the plugin package with the largest remaining resources, exclude the container with the largest remaining resources from all containers and return to the step of obtaining the container with the largest remaining resources from all containers.

[0122] In this embodiment, if the container with the largest remaining resource sum cannot accommodate the plugin package with the largest remaining resource sum, then it is determined whether the container with the second largest remaining resource sum can accommodate the plugin package with the largest remaining resource sum. If neither of these containers can accommodate the plugin package, then it is determined whether the container with the third largest remaining resource sum can accommodate the plugin package. This process continues, checking each container in descending order of its remaining resource sum to determine if it can accommodate the plugin package with the largest remaining resource sum, until a container is found to be able to accommodate the plugin package with the largest remaining resource sum. If so, the plugin package with the largest remaining resource sum is then allocated to that container. For example, if the container with the largest remaining resource sum is found to be able to accommodate the plugin package with the largest remaining resource sum, then the plugin package with the largest remaining resource sum is allocated to that container. If the container with the largest remaining resource sum cannot accommodate the plugin package with the largest remaining resource sum, then it is further checked whether the container with the second largest remaining resource sum can accommodate the plugin package with the largest remaining resource sum. If so, the plugin package with the largest remaining resource sum is allocated to both of these containers. If not, continue to check if the container with the third largest remaining resources can accommodate the plugin package with the largest total resources. In this order, allocate resources to the plugin package with the largest total resources.

[0123] It should be noted that the container cannot accommodate the plugin package with the largest total resources in the following situations: the total remaining resources of the container are less than the total resources of the plugin package; or, the total remaining resources of the container are greater than or equal to the total resources of the plugin package, but the remaining resource usage of the container is less than the resource usage of the plugin package; or the remaining number of database instances of the container is less than the number of database instances of the plugin package; or the remaining daily task volume of the container is less than the daily task volume of the plugin package.

[0124] It should be noted that, in one embodiment of this application, if each container cannot accommodate the plugin package with the largest total resources, a new container is added to accommodate the plugin package with the largest total resources.

[0125] Step S540: If the container with the largest remaining resources can accommodate the plugin package with the largest remaining resources, then the plugin package with the largest remaining resources is allocated to the container with the largest remaining resources, and the container with the largest remaining resources is used as the target container.

[0126] In this embodiment, if the container with the largest remaining resources can accommodate the plugin package with the largest total resources, then the plugin package with the largest remaining resources is allocated to that container, and the container with the largest remaining resources is designated as the target container. Thus, by using the target container as the object, plugin packages that can reuse resources with the plugin packages in the target container are allocated to the target container, thereby achieving the aggregation of plugin packages capable of resource reuse.

[0127] For example, as shown in Table 4, the plugin package with the largest total resources is plugin package D. As shown in Table 3, the container with the largest remaining resources is ①. Calculate the remaining values ​​of resource usage, number of database instances, and daily task volume when plugin package D is placed in container ①. That is, 80-50=30, 40-15=25, 60-25=35. If all are greater than or equal to 0, then container ① is considered to be able to accommodate plugin package D, and plugin package D is allocated to container ①.

[0128] In this embodiment, after allocating the plugin package with the largest total resources to the container with the largest remaining total resources, it is further determined whether all unallocated plugin packages have been allocated. If all unallocated plugin packages have been allocated, the allocation ends. If not all unallocated plugin packages have been allocated, step S550 continues.

[0129] Step S550: Update the remaining resource usage, remaining number of database instances, remaining daily task quantity, and total remaining resources of the target container, and update any unassigned plugin packages.

[0130] In this embodiment, after allocating the plugin package with the largest total resources to the container with the largest remaining total resources, the remaining resource usage, remaining number of database instances, remaining daily task load, and remaining total resources of the target container are updated. Simultaneously, the plugin package with the largest total resources is marked as allocated, meaning it is removed from the unallocated plugin packages to update the unallocated plugin packages. Specifically, for the container with the largest remaining total resources, i.e., the target container, the remaining resource usage of the target container is subtracted from the resource usage of the plugin packages already placed in it; the remaining number of database instances of the target container is subtracted from the number of database instances of the plugin packages already placed in it; and the remaining daily task load of the target container is subtracted from the daily task load of the plugin packages already placed in it. It should be noted that if more than two plugin packages are placed in the target container, the resource reuse count of these plugin packages in the resource reuse matrix needs to be added when updating the remaining resource usage of the target container.

[0131] For example, since plugin package D is allocated to container ①, it is necessary to update and reorder the remaining resource usage, remaining number of database instances, remaining daily task load, and total remaining resources of container ①. The updated resource information of the container is shown in Table 5 below:

[0132] Table 5. Resource-related information table after container update

[0133] Container number resource usage Number of database instances Daily task volume Total remaining resources Sort ① 30 25 35 90 2 ② 80 40 60 180 1 ③ 80 40 60 180 1

[0134] Step S560: Based on the resource reuse matrix, obtain the plugin package with the largest resource reuse count with the plugin package in the target container from the updated unallocated plugin packages.

[0135] In this embodiment, after updating the unallocated plugin packages, the plugin package with the largest resource reuse count with the plugin packages in the target container can be further obtained from the updated unallocated plugin packages according to the resource reuse matrix. For example, after allocating plugin package D to container ①, the unallocated plugin packages are updated, i.e., the unallocated plugin packages include plugin packages A, B, C, E, F, and G. According to the resource reuse matrix shown in Table 2, the plugin package with the largest resource reuse count with plugin package D (the largest resource reuse count shown in Table 2 is 4) can be determined as plugin package F.

[0136] It should be noted that when the resource reuse matrix reveals that there are multiple plugin packages with the largest number of resource reuses with the plugin packages in the target container, that is, multiple unallocated plugin packages have the same and largest number of resource reuses with the plugin packages in the target container, the plugin package with the larger total resource reuses will be selected first.

[0137] Step S570: Determine whether the target container can accommodate the plugin package with the largest number of resource reuses.

[0138] In this embodiment of the application, after obtaining the plugin package with the largest resource reuse count from the updated unallocated plugin packages according to the resource reuse matrix, it is further determined whether the target container can accommodate the plugin package with the largest resource reuse count. That is, it is determined whether the remaining resource usage of the target container is greater than or equal to the resource usage of the plugin package with the largest resource reuse count, whether the remaining number of database instances in the target container is greater than or equal to the number of database instances in the plugin package with the largest resource reuse count, and whether the remaining daily task volume in the target container is greater than or equal to the daily task volume of the plugin package with the largest resource reuse count. If all of these are greater than or equal to the target container, it is determined that the target container can accommodate the plugin package with the largest resource reuse count, and thus the plugin package with the largest resource reuse count can be allocated to the target container.

[0139] Step S580: When the target container cannot accommodate the plugin package with the largest resource reuse count, exclude the plugin package with the largest resource reuse count from the unallocated plugin packages, and return to the step of obtaining the plugin package with the largest resource reuse count from the updated unallocated plugin packages according to the resource reuse matrix.

[0140] In this embodiment, if the target container cannot accommodate the plugin package with the largest resource reuse count, the second largest plugin package with the second largest resource reuse count among the plugin packages in the target container is found from the resource reuse matrix, and it is determined whether the target container can accommodate the second largest plugin package. If the target container cannot accommodate the second largest plugin package, the third largest plugin package with the third largest resource reuse count is found from the resource reuse matrix, and it is determined whether the target container can accommodate the third largest plugin package. In this way, plugin packages that can reuse resources with plugin packages in the target container are allocated to the target container. That is, if the target container cannot accommodate the plugin package with the largest resource reuse count, the plugin package with the largest resource reuse count is excluded from the unallocated plugin packages, and the process returns to step S560.

[0141] Step S590: When the target container can accommodate the plugin package with the largest number of resource reuses, allocate the plugin package with the largest number of resource reuses to the target container, and return the updated remaining resource usage, remaining number of database instances, remaining daily task quantity, and total remaining resources of the target container, and update the unallocated plugin packages.

[0142] In this embodiment, if the target container can accommodate the plugin package with the largest resource reuse count, then the plugin package with the largest resource reuse count is allocated to the target container, and then the process returns to step S550. For example, after allocating plugin package D to container ①, the unallocated plugin packages are updated, i.e., the unallocated plugin packages include plugin packages A, B, C, E, F, and G. Based on the resource reuse matrix shown in Table 2, the plugin package with the largest resource reuse count (the largest resource reuse count shown in Table 2 is 4) with plugin package D is identified as plugin package F. Since container ① can accommodate plugin package F, plugin package F is allocated to container ①, and the remaining resource usage, remaining database instance count, remaining daily task count, and total remaining resources of container ① are updated, as shown in Table 6 below. At this time, since plugin packages D and F are allocated in container ①, when updating the resource usage of container ①, the resource reuse count of 4 between plugin packages D and F also needs to be added.

[0143] Table 6. Updated container resource information table

[0144] Container number resource usage Number of database instances Daily task volume Total remaining resources Sort ① 30-30+4=4 25-13=12 35-15=20 4+12+20=36 2 ② 80 40 60 180 1 ③ 80 40 60 180 1

[0145] In this embodiment, after allocating the plugin package with the largest resource reuse count to the target container, it is further determined whether all unallocated plugin packages have been allocated. If all unallocated plugin packages have been allocated, the allocation ends. If not all unallocated plugin packages have been allocated, step S550 continues.

[0146] In one embodiment of this application, if the target container can no longer hold the unassigned plugin package, it means that the target container has been assigned. Then, the target container is removed from all containers, all containers and unassigned plugin packages are updated, and the process returns to step S510.

[0147] For example, after assigning plugin packages D and F to container ①, the unassigned plugin packages are updated, i.e., the unassigned plugin packages include plugin packages A, B, C, E, and G. According to the resource reuse matrix shown in Table 2, the plugin package with the largest resource reuse count with plugin packages D and F in container ① (the maximum resource reuse count shown in Table 2 is 3.5) is identified as plugin package E. At this time, since container ① cannot accommodate plugin package E, plugin package E is excluded from the unassigned plugin packages, i.e., the unassigned plugin packages include plugin packages A, B, C, and G. According to the resource reuse matrix shown in Table 2, the plugin packages with the largest resource reuse count with plugin packages D and F in container ① (the maximum resource reuse count after excluding plugin package E shown in Table 2 is 0.8) among the unassigned plugin packages are identified as plugin packages B and G. Since the total resources of plugin package G are greater than the total resources of plugin package B, plugin package G is selected, i.e., it is determined whether container ① can accommodate plugin package G. Since container ① cannot hold plugin package G, plugin package G is excluded from the unallocated plugin packages. That is, the unallocated plugin packages include plugin packages A, B, and C. According to the resource reuse matrix shown in Table 2, the plugin package with the largest resource reuse count with plugin packages D and F in container ① (the maximum resource reuse count after excluding plugin package G in Table 2 is 0.8) among the unallocated plugin packages is plugin package B. We then determine whether container ① can hold plugin package B. Since container ① cannot hold plugin package B, plugin package B is excluded from the unallocated plugin packages. That is, the unallocated plugin packages include plugin packages A and C. According to the resource reuse matrix shown in Table 2, the plugin package with the largest resource reuse count with plugin packages D and F in container ① (the maximum resource reuse count after excluding plugin package B in Table 2 is 0.6) among the unallocated plugin packages is plugin package C. We then determine whether container ① can hold plugin package C. Since container ① cannot hold plugin package C, plugin package C is excluded from the unallocated plugin packages. That is, the unallocated plugin packages include plugin package A. According to the resource reuse matrix shown in Table 2, plugin package A is identified as the unallocated plugin package with the largest resource reuse count (0.4 after removing plugin package C) with plugin packages D and F in container ①. It is then determined whether container ① can hold plugin package A. Since container ① cannot hold plugin package A, the target container can no longer hold unallocated plugin packages, and the target container allocation is complete. At this point, the target container needs to be excluded from all containers, all containers and unallocated plugin packages are updated, and the process returns to step S510 until all plugin packages are allocated. For example, since container ① can no longer hold unallocated plugin packages after holding plugin packages D and F, container ① is excluded from all containers, i.e., all containers, including containers ② and ③, are updated. The unallocated plugin packages, including plugin packages A, B, C, E, and G, are also updated.At this point, return to step S510, which involves retrieving the container with the largest remaining resource from all containers, then retrieving the plugin package with the largest remaining resource from the unallocated plugin packages, and determining whether the container with the largest remaining resource can accommodate the plugin package with the largest remaining resource. As shown in Table 6, the container with the largest remaining resource from all containers is container ②, and as shown in Table 4, the plugin package with the largest remaining resource from the unallocated plugin packages is plugin package G. Determine whether container ② can accommodate plugin package G. Since container ② can accommodate plugin package G, allocate plugin package G to container ②, and update the remaining resource usage, remaining database instance count, remaining daily task count, and remaining resource total of container ②. The updated resource-related information and sorting of the container are shown in Table 7 below.

[0148] Table 7. Updated Resource Information and Sorting Table for Containers

[0149] Container number resource usage Number of database instances Daily task volume Total remaining resources Sort ① 4 12 20 36 3 ② 50 20 42 112 2 ③ 80 40 60 180 1

[0150] The unassigned plugin packages include A, B, C, and E. Based on the resource reuse matrix shown in Table 2, plugin package C is identified as having the largest resource reuse count with plugin package G in container ② (the maximum resource reuse count shown in Table 2 is 0.6). It is then determined whether container ② can accommodate plugin package C. Since container ② can accommodate plugin package C, it is assigned to container ②. The remaining resource usage, remaining database instance count, remaining daily task count, and total remaining resources in container ② are updated. Since container ② contains two plugin packages (G and C), the update of the remaining resource usage requires subtracting the resource usage of plugin package C and then adding the combined resource reuse count of G and C (0.6). The updated resource information and its sorting are shown in Table 8 below.

[0151] Table 8. Updated resource information and sorting table for containers

[0152]

[0153] At this point, container ② contains plugin packages G and C. Unallocated plugin packages include A, B, and E. Based on the resource reuse matrix shown in Table 2, the plugin packages with the largest resource reuse count (maximum resource reuse count in Table 2 is 1.2) with plugin packages A and B among the unallocated plugin packages are identified. Since the total resources of plugin package B are greater than the total resources of plugin package A, plugin package B is selected. Next, it is determined whether container ② can accommodate plugin package B. Since container ② cannot accommodate plugin package B, it is excluded from the unallocated plugin packages. Therefore, the unallocated plugin packages include plugin packages A and E. Based on the resource reuse matrix shown in Table 2, the plugin package with the largest resource reuse count (maximum resource reuse count in Table 2) with plugin packages G and C in container ② is identified as plugin package A. Finally, it is determined whether container ② can accommodate plugin package A. Since container ② can accommodate plugin package A, it is allocated to container ②. At this point, container ② is allocated plugin packages G, C, and A. Unallocated plugin packages B and E are updated, along with the remaining resource usage, remaining database instance count, remaining daily task count, and total remaining resources for container ②. Since container ② can no longer hold unallocated plugin packages B and E, its allocation is complete. Container ② needs to be removed from all containers, and all containers and unallocated plugin packages are updated before returning to step S510. Specifically, according to Table 6, container ③ is selected as the container with the largest remaining resource count from all containers. According to Table 4, plugin package B is selected as the plugin package with the largest remaining resource count from the unallocated plugin packages. It is determined whether container ③ can hold plugin package B. Since container ③ can hold plugin package B, plugin package B is allocated to container ③, and the remaining resource usage, remaining database instance count, remaining daily task count, and total remaining resources for container ③ are updated. Unallocated plugin packages E are updated, and it is determined whether container ③ can hold plugin package E. Since container ③ can hold plugin package E, plugin package E is allocated to container ③. At this point, all plugin packages have been allocated. The remaining resource information of the container and the allocation relationship of the plugin packages are shown in Table 9 below:

[0154] Table 9: Remaining Resource Information of Containers and Allocation Relationship of Plugin Packages

[0155] Container number resource usage Number of database instances Daily task volume Total remaining resources Plugin package ① 4 12 20 36 DF ② 11.8 5 27 43.8 GCA ③ 30 15 20 65 BE

[0156] It should be noted that during the allocation process, if there is a situation where a plugin package cannot be allocated to any container, that is, if each container cannot hold a certain plugin package, then a new container needs to be added. The new container must be able to hold the plugin package.

[0157] Reference Figure 7 , Figure 7This is a resource configuration flowchart provided in an embodiment of this application. For example... Figure 7 As shown, the plugin package allocation process includes:

[0158] (1) Determine the required number of containers based on the resource information of each plugin package and the resource capacity limit of a single container.

[0159] This step involves calculating the total resource usage of all plugin packages, the total number of database instances, and the total number of daily tasks. Then, based on these factors, the required number of containers is determined, along with the resource usage limit, database instance limit, and daily task limit for each container.

[0160] (2) Calculate the resource reuse matrix of each plugin package.

[0161] This step involves analyzing the code files of each plugin package to calculate the similarity rate between each pair of plugin packages. Then, based on the similarity rate between two plugin packages and the sum of their resource usage, the resource reuse count between the two plugin packages is calculated. In this way, the resource reuse count between each pair of plugin packages can be calculated, thus allowing the construction of a resource reuse matrix for each plugin package.

[0162] (3) Calculate the total remaining resources for each container.

[0163] In this step, the containers can be sorted according to the size of the remaining resources by calculating the total remaining resources for each container.

[0164] (4) Obtain the plugin package with the largest total resources from the unallocated plugin packages and allocate it to the container.

[0165] In this step, it is first determined whether the plugin package with the largest total resource can be put into the container with the largest remaining resource. If successful, it is put into the container and step (5) is executed. If it fails, it is determined whether the plugin package with the largest total resource can be put into the container with the second largest remaining resource. This process is repeated until it is determined whether the plugin package with the largest total resource can be put into the container with the smallest remaining resource. If successful, it is put into the container and step (5) is executed. If it fails, it means that no container can hold the plugin package with the largest total resource, and a new container needs to be added. After adding the new container, all plugin packages are marked as unallocated, and then the process returns to step (3).

[0166] (5) Update the total remaining resources for each container.

[0167] This step updates the total remaining resources for each container, including updating the remaining resource usage, remaining number of database instances, remaining daily task load, and total remaining resources for each container.

[0168] (6) Mark the plugin package as assigned.

[0169] In this step, after the plugin package is successfully allocated, it needs to be marked as allocated.

[0170] (7) Determine whether all unallocated plugin packages have been allocated. If so, end the allocation process.

[0171] (8) If not all unallocated plugin packages have been allocated, continue allocating them.

[0172] In this step, the unallocated plugin package with the largest resource reuse count relative to the plugin package in this container is queried according to the resource reuse matrix and put into this container. If the addition is successful, the process returns to step (5). If the addition fails, the unallocated plugin package with the second largest resource reuse count relative to the plugin package in this container is queried according to the resource reuse matrix and put into this container. If the addition is successful, the process returns to step (5). This process is repeated until the unallocated plugin package with the smallest resource reuse count relative to the plugin package in this container is queried according to the resource reuse matrix and put into this container. If the addition is successful, the process returns to step (5). If the addition fails, it means that this container can no longer hold unallocated plugin packages. Once this container is fully allocated, the process returns to step (3).

[0173] In one embodiment of this application, reference is made to Figure 8 , Figure 8 This is a flowchart of the steps to be performed after the allocation is completed, provided in the embodiments of this application, including but not limited to steps S810 to S850.

[0174] Step S810: When a new plugin package is detected, calculate the similarity rate between the new plugin package and each of the allocated plugin packages, and update the resource reuse matrix based on the similarity rate and the resource-related information of each plugin package.

[0175] In this embodiment, after allocating each plugin package to its corresponding container in the initial stage, if a new plugin package is detected, the code file of the new plugin package is analyzed along with the code files of each of the already allocated plugin packages to calculate the similarity rate between the new plugin package and each of the already allocated plugin packages. Then, based on the similarity rate between the new plugin package and each of the already allocated plugin packages, and the resource usage of each plugin package, the resource reuse count between the new plugin package and each of the already allocated plugin packages is calculated. Thus, the resource reuse matrix determined before the addition can be updated based on the resource reuse count between the new plugin package and each of the already allocated plugin packages. Specifically, the resource reuse matrix is ​​updated from an n x n matrix (where n is the original number of plugin packages) to an n+1 x n+1 matrix. The last row and last column are then multiplied by the similarity rate of the two plugin packages (one of the new plugin package and one of the already allocated plugin packages) and the sum of the resource usage of these two plugin packages to determine the resource reuse count, which is then filled into the resource reuse matrix.

[0176] For example, a new plugin package H is added. The similarity rates between the new plugin package H and the original plugin package AG are calculated to be 0.03, 0.02, 0.02, 0.05, 0.02, 0.03, and 0.01, respectively. Further calculations show that the resource reuse counts between the new plugin package H and the original plugin package AG are 0.63, 0.82, 0.82, 3.05, 0.62, 1.23, and 0.41, respectively. The corresponding resource reuse matrix is ​​updated by adding H rows and H columns, i.e., adding H rows and H columns to the resource reuse matrix shown in Table 2. The updated resource reuse matrix is ​​shown in Table 10 below.

[0177] Table 10 Updated Resource Reuse Matrix

[0178] Resource reuse matrix A B C D E F G H A 0 1.2 1.2 0 0.3 0.4 0.4 0.63 B 1.2 0 1.2 0.8 0 0 0 0.82 C 1.2 1.2 0 0 0 0.6 0.6 0.82 D 0 0.8 0 0 3.5 4 0.8 3.05 E 0.3 0 0 3.5 0 2 0 0.62 F 0.4 0 0.6 4 2 0 0 1.23 G 0.4 0 0.6 0.8 0 0 0 0.41 H 0.63 0.82 0.82 3.05 0.62 1.23 0.41 0

[0179] Step S820: Based on the updated resource reuse matrix, obtain the first plugin package with the largest resource reuse count with the newly added plugin package from the allocated plugin packages.

[0180] After updating the resource reuse matrix, the first plugin package with the largest resource reuse count with the newly added plugin package can be obtained from the allocated plugin packages based on the updated resource reuse matrix. For example, for the newly added plugin package H, from the updated resource reuse matrix shown in Table 10, the plugin package with the largest resource reuse count with the newly added plugin package H (the largest resource reuse count shown in Table 10 is 3.05) can be determined as plugin package D.

[0181] Step S830: Determine whether the container containing the first plugin package can accommodate the newly added plugin package.

[0182] In this embodiment of the application, after determining the first plugin package with the largest number of resource reuses with the newly added plugin package based on the updated resource reuse matrix, it is necessary to further determine whether the container where the first plugin package is located can accommodate the newly added plugin package.

[0183] For example, based on the updated resource reuse matrix shown in Table 10, the plugin package with the largest resource reuse count with the newly added plugin package H is identified as plugin package D. At this point, it is necessary to further determine whether the container ① containing plugin package D can accommodate the newly added plugin package H. The resource-related information for the newly added plugin package H is shown in Table 11. Since the remaining resource usage of the container ① containing plugin package D is less than the resource usage of the newly added plugin package H, it can be determined that the container ① containing plugin package D cannot accommodate the newly added plugin package H.

[0184] Table 11 Resource-related information for the newly added plugin package H

[0185] Plugin package number resource usage Number of database instances Daily task volume H 11 5 20

[0186] Step S840: When the container containing the first plugin package cannot accommodate the new plugin package, the first plugin package is excluded from the allocated plugin packages, and the first plugin package with the largest resource reuse count with the new plugin package is retrieved from the allocated plugin packages according to the updated resource reuse matrix.

[0187] In this embodiment, after determining that the container containing the first plugin package with the largest resource reuse count with the new plugin package cannot accommodate the new plugin package, the next largest first plugin package with the second largest resource reuse count with the new plugin package is identified based on the updated resource reuse matrix. It is then determined whether the container containing this second largest first plugin package can accommodate the new plugin package. If the container still cannot accommodate the new plugin package, the updated resource reuse matrix is ​​used to query and determine the container sequentially. If the container containing the first plugin package with the smallest resource reuse count with the new plugin package still cannot accommodate the new plugin package, a new container is created to accommodate the new plugin package. In other words, if all containers cannot accommodate the new plugin package, a new container is created, and the new plugin package is assigned to this new container.

[0188] It should be noted that during the plugin package addition phase, when multiple plugin packages with the largest resource reuse count are found to exist based on the updated resource reuse matrix, that is, when multiple allocated plugin packages have the same and largest resource reuse count as the new plugin package, the plugin package with the smaller total resource count is selected first, that is, the new plugin package is first placed into the container containing the plugin package with the smaller total resource count.

[0189] For example, after determining that container ① containing plugin package D cannot accommodate the new plugin package H, the plugin package F is identified as having the second largest resource reuse count with the new plugin package H (1.23 in Table 10) according to the resource reuse matrix shown in Table 10. Since container ① containing plugin package F cannot accommodate the new plugin package H, plugin packages B and C are identified as having the third largest resource reuse count with the new plugin package H (0.82 in Table 10) according to the resource reuse matrix shown in Table 10. Since the total resources of plugin package C are less than the total resources of plugin package B, it is determined whether container ② containing plugin package C can accommodate the new plugin package H. Since container ② containing plugin package C can accommodate the new plugin package H, the new plugin package H is placed into container ② containing plugin package C.

[0190] Step S850: When the container where the first plugin package is located can accommodate the new plugin package, the new plugin package is allocated to the container where the first plugin package is located, and the remaining resource usage, remaining number of database instances, remaining daily task quantity, and total remaining resources of the container where the first plugin package is located are updated.

[0191] In this embodiment, if the container containing the first plugin package with the largest resource reuse with the new plugin package can accommodate the new plugin package, then the new plugin package is allocated to that container. Then, the remaining resource usage, remaining database instance count, remaining daily task count, and total remaining resources of the container containing the first plugin package with the largest resource reuse with the new plugin package are updated, and the new plugin package is marked as allocated.

[0192] For example, since container ②, where plugin package C resides, can accommodate the newly added plugin package H, after placing the new plugin package H into container ②, the remaining resource usage, remaining number of database instances, remaining daily task load, and total remaining resources of container ② need to be checked. The updated resource-related information for the container is shown in Table 12 below:

[0193] Table 12 Updated Container Resource Information Table

[0194]

[0195]

[0196] In one embodiment of this application, when a plugin package deletion is detected, the resource reuse matrix is ​​updated, specifically by deleting the row and column corresponding to the deleted plugin package. Simultaneously, the remaining resource usage, remaining database instance count, remaining daily task count, and total remaining resources of the container containing the deleted plugin package are updated, i.e., the value corresponding to the deleted plugin package needs to be added back.

[0197] In one embodiment of this application, when a modification to a plugin package is detected, the modification needs to be categorized, analyzed, and processed. If only configuration information has been modified, it is necessary to determine whether the corresponding container meets the requirements. Specifically, the value of the plugin package before modification is added back to the corresponding container, and then the value of the modified plugin package is subtracted. It is then determined whether the remaining resource usage, remaining database instance count, and remaining daily task count of this container are still greater than or equal to zero. If they are, the requirements are considered met, and the remaining resource usage, remaining database instance count, and remaining daily task count of the corresponding container are updated. If any one of these three values ​​is less than zero, the requirements are considered not met. In this case, the modified plugin package is removed from the container, and the remaining resource usage, remaining database instance count, and remaining daily task count of the corresponding container are updated, i.e., the value of the originally modified plugin package is added back. The modified plugin package is marked as unallocated, and then the "add plugin package" step is executed. If the code file has been modified, the modified plugin package will be removed from the container, and the remaining resource usage, remaining database instance count, and remaining daily task count of the corresponding container will be updated, i.e., the values ​​of the original modified plugin package will be added back. The modified plugin package will be marked as unallocated, and then the "Add Plugin Package" step will be executed.

[0198] In one embodiment of this application, reference is made to Figure 9 , Figure 9 This is a flowchart of another step performed after the allocation is completed, provided in the embodiments of this application, including but not limited to steps S910 to S960.

[0199] Step S910: When it is detected that there is a new, deleted or modified plugin package, the daily task volume of the plugin package is updated according to the historical actual daily task volume of the plugin package during the preset update cycle.

[0200] Step S920: Update the total resource usage, total number of database instances, and total daily task volume of all plugin packages;

[0201] Step S930: Based on the total resource usage of all updated plugin packages, the total number of database instances, the total number of daily tasks, the resource usage limit of a single container, the database instance limit of a single container, and the daily task limit of a single container, redetermine the required number of containers.

[0202] Step S940: Determine whether the newly determined required number of containers is greater than or equal to the current number of containers;

[0203] Step S950: When the re-determined number of required containers is less than the current number of containers, return to the step of determining the number of required containers based on the resource-related information of each plugin package and the resource capacity limit of a single container.

[0204] Step S960: If the re-determined required number of containers is greater than or equal to the current number of containers, then the plugin package will not be reallocated.

[0205] In this embodiment, when a new, deleted, or modified plugin package is detected, the remaining resource usage, remaining number of database instances, remaining daily task load, and total remaining resources of the corresponding container will change accordingly. Therefore, during a preset update cycle, the current number of containers is assessed for reasonableness based on the updated resource status. Specifically, for plugin packages other than those that have been added or modified, the daily task load of the plugin package is updated based on its historical actual daily task load. For example, the daily task load of a historical plugin package is calculated as the task load of the past week / number of working days * 120%. Newly added or modified plugin packages retain their original values. After updating the resource-related information for each plugin package, the total resource usage, total number of database instances, and total daily task load of all plugin packages are updated accordingly. This allows for a re-determination of the required number of containers based on the updated total resource usage, total number of database instances, total daily task load of all plugin packages, the maximum resource usage capacity of a single container, the maximum number of database instances in a single container, and the maximum daily task load of a single container. Next, determine if the newly determined required number of containers is greater than or equal to the current number of containers. If it is less, then reconfigure the resources. If it is greater than or equal to the current number of containers, then reconfigure the resources.

[0206] For example, there exists a plugin package AG and a newly added plugin package H. The daily task volume of plugin package AG is updated, such as updating the daily task volume of plugin package AG to the task volume of the past week / number of working days * 120%. The task volume of plugin package AG in the past week is shown in Table 13 below:

[0207] Table 13 Example of task volume for the AG plugin package in the past week

[0208] Plugin package Tasks in the past week A 46 B 62 C 21 D 100 E 50 F 44 G 75

[0209] Therefore, the daily task quantity corresponding to the plugin package AH ​​is updated as shown in Table 14 below, with decimals rounded to the nearest integer. Note that since the newly added plugin package H is a newly added plugin package, its daily task quantity retains its original value.

[0210] Table 14: Example of Daily Task Quantity After Plugin Package Update

[0211] Plugin package number resource usage Number of database instances Daily task volume A 10 10 11 B 30 15 15 C 30 5 5 D 50 15 24 E 20 10 12 F 30 13 11 G 30 20 18 H 30 5 20

[0212] Based on the resource information shown in Table 14, the total resource usage of all plugin packages is updated to 211, the total number of database instances is 93, and the total number of daily tasks is 116. Therefore, the required number of containers N can be recalculated as N = MAX(211 * 110% / 80, 93 * 120% / 40, 116 * 120% / 60) = 3. Since the recalculated required number of containers is equal to the current number of containers, no resource reconfiguration is required.

[0213] This application proposes an automatically allocable plug-in database change management system, which performs resource configuration based on the resource configuration method provided in any embodiment of this application. The system implements execution functions refined to the database instance level, separating these functions into plug-in packages that are hot-loaded into the system. Based on the resource configuration method proposed in this application, plug-in packages capable of resource reuse are allocated to the same container, enabling the aggregation of similar plug-in packages. This allows similar parts to be reused in memory and reduces the CPU overhead of object replacement in memory.

[0214] This system allows users to upload plugin packages, perform similarity analysis on these packages, and use the content of these packages for data modification and querying. It also features an automatic scaling algorithm for deploying and allocating containers for plugin packages, achieving the advantages of meeting the requirements of multiple data sources and multiple operations while saving resources. The flowchart of this database change management system is as follows: Figure 10 As shown in the diagram, system initialization involves initializing system parameters, table structures, and programs. For database instances, the system performs add / enable / modify / deactivate / delete operations sequentially. For plugin packages, the system performs upload / check / analyze similarity rates / enable / allocate / use plugin packages for database modification / deactivation / delete operations sequentially. Enabling plugin packages also triggers a scaling-up / downsizing scheme. For data modification / query tasks, the system performs write / submit / receive / allocate / receive results / display operations sequentially. The dashed lines in the flowchart represent relationships; modifying a database instance is associated with modifying a database instance using a plugin package, and is also associated with the write / submit / receive / allocate / receive results / display operations in data modification / query tasks.

[0215] Reference Figure 11 The entity relationship diagram of this system is as follows: Figure 11 As shown, this system includes the following entities (in Figure 11 (Represented by a rectangle in the middle):

[0216] System Administrator: Has the privileges to manage administrators, database instances, and scaling options.

[0217] Business Administrator: Manages plugin packages.

[0218] Business Operators: Use the plugin package to modify data.

[0219] Data modification / query tasks: Tasks submitted by business operators to manipulate database instances.

[0220] Database instance: The object of operation for data modification / query tasks.

[0221] Plugin package: The actual execution code and configuration information used for data modification / query tasks. When the plugin package is run in a container, it is executed as a plugin package subprocess.

[0222] Container: The actual runtime environment of the plugin package. The container contains a parent process responsible for receiving data modification / query tasks from the system, and child processes of the plugin package responsible for actually executing these tasks.

[0223] Scaling up and down scheme: The specific algorithm and parameters for assigning which plugin package to which container.

[0224] The entities in this system have the following relationships (in... Figure 11 (Represented by a diamond frame in the middle):

[0225] Permissions Assignment: The system administrator assigns permissions to business administrators and business operators.

[0226] Adjustments: System administrators can adjust scaling schemes. They can modify parameters or execution time in the scaling algorithm, such as the resource usage limit for a single container, the maximum number of database instances, the daily task limit, and the time required to assess whether the number of containers is reasonable.

[0227] Deployment / Destruction: The scaling solution allows for the deployment and destruction of containers.

[0228] Upload / Enable / Disable / Modify Parameters / Delete: Business administrators can upload / enable / disable / modify parameters / delete plugin packages.

[0229] Add / Enable / Disable / Delete: System administrators can add / enable / disable / delete database instances.

[0230] Load / Unload: The container can load / unload plugin packages.

[0231] Association: The plugin package is associated with a database instance.

[0232] Submit: Business operators submit data modification / query tasks.

[0233] Select: Data modification / query tasks require selecting a database instance.

[0234] Execution: The plugin package executes data modification / query tasks.

[0235] Database instances, plugin packages, data modification / query tasks, scaling solutions, and containers are all entities within this system.

[0236] Reference Figure 12 This is a flowchart illustrating the process of adding database instances and plugin packages. Under the system administrator's operation, a database instance is added. Specifically, the system administrator fills in information such as the database instance type, IP address, port, database name, user, and authentication information, and then adds the database instance. For example, the system administrator adds a database instance of type mongodb, IP address 168.192.1.2, port 27000, database name Customer, user Ruser, and authentication information 4RFVCvfr. In subsequent examples, this database instance will be referred to as database instance A. Under the operation of the business administrator, the database instance is activated. For example, the business administrator activates database instance A. Under the operation of the business administrator, the plugin package is uploaded. Specifically, the plugin package contains configuration information and code files. The configuration information includes database instance-related information such as database type, IP address, port, database name, user, and operation type; it also includes restriction-related information such as timeout, row limit, and concurrency; and it includes resource-related information for the plugin package, such as resource usage, number of database instances, and daily task volume. This system checks plugin packages, specifically verifying the consistency of their configuration information. This includes checking if the configuration matches the database instance and if a timeout setting is in place. The system analyzes the similarity of plugin packages, specifically comparing the code files of existing packages pairwise to identify identical configuration items and entity classes. Configuration items with identical names and values ​​are considered identical, and entity classes with identical class names, constants, variables, or functions are considered identical. By identifying these identical configuration items and entity classes, new plugins can reuse common parts of already loaded plugins, achieving memory reuse and saving CPU consumption. The system enables plugin packages under the management of business administrators. Specifically, the plugin package configuration information records database instance information, such as the database instance type, IP address, port, database name, and user. This information is associated with a unique database instance. The plugin package configuration information also includes the operation type for the database instance, such as query or update.

[0237] The state before all plugin packages are assigned to containers is called the initialization phase. During the initialization phase, it calculates which plugin package should be assigned to which container and then performs the assignment. After all plugin packages have been assigned to containers, the system is in a static state. Next, operations can be performed on the plugin packages, i.e., the incremental phase, where plugin packages can be enabled / disabled and their parameters modified. After entering the incremental phase, a preset update cycle is set; for example, every Sunday at midnight, the number of containers is evaluated to determine if it is reasonable. If not, the system will re-enter the initialization phase to reallocate all plugin packages and containers.

[0238] This system can adjust its scaling scheme based on the system administrator's parameter settings. Specifically, the system administrator can adjust parameters or execution time in the scaling algorithm, such as adjusting the resource usage limit for a single container, the database instance limit, the daily task limit, or adjusting the time for evaluating whether the current number of containers is reasonable. The system will then readjust the scaling scheme based on these adjustments. The following example uses data from a previous example to illustrate how to adjust the scaling scheme:

[0239] (1) The current maximum number of database instances that a single container can hold is 40. The system administrator has adjusted this to 35 and set an evaluation of the reasonableness of the number of containers to be performed at midnight the following day. Therefore, at midnight the following day, the maximum resource usage per container will be 80, the maximum number of database instances will be 35, and the maximum daily task load will be 60. If the following day is not Sunday, the daily task load of the plugin package will not be updated.

[0240] (2) Based on the adjustment, recalculate the required number of containers N = MAX(211*110% / 100, 93*120% / 35, 116*120% / 60) = 4. This does not match the current number of containers of 3. Execute the initialization phase steps and recalculate the allocation of AH plugin packages.

[0241] (3) There are currently 4 containers, namely ①-④, and 8 plugin packages, namely AH. The resource information and sorting of the containers are shown in Table 15 below, the resource information and sorting of plugin package AH ​​are shown in Table 16 below, and the resource reuse matrix of plugin package AH ​​is shown in Table 17 below.

[0242] Table 15 Resource Information Table for Containers

[0243] Container number resource usage Number of database instances Daily task volume Total remaining resources Sort ① 80 35 60 175 1 ② 80 35 60 175 1 ③ 80 35 60 175 1 ④ 80 35 60 175 1

[0244] Table 16 Resource Information Table for Plugin Packages

[0245] Plugin package number resource usage Number of database instances Daily task volume Total resource requirements Sort A 10 10 11 31 8 B 30 15 15 60 3 C 30 5 5 40 6 D 50 15 24 89 1 E 20 10 12 42 5 F 30 13 11 54 4 G 30 20 18 68 2 H 11 5 20 36 7

[0246] Table 17 Resource Reuse Matrix of Plugin Package AH

[0247] Resource reuse matrix A B C D E F G H A 0 1.2 1.2 0 0.3 0.4 0.4 0.63 B 1.2 0 1.2 0.8 0 0 0 0.82 C 1.2 1.2 0 0 0 0.6 0.6 0.82 D 0 0.8 0 0 3.5 4 0.8 3.05 E 0.3 0 0 3.5 0 2 0 0.62 F 0.4 0 0.6 4 2 0 0 1.23 G 0.4 0 0.6 0.8 0 0 0 0.41 H 0.63 0.82 0.82 3.05 0.62 1.23 0.41 0

[0248] (4) Allocate the plugin package with the largest total unallocated resources to the container. The plugin package with the largest total unallocated resources is D, and the container with the largest remaining resources is ①. Calculate the remaining values ​​of resource usage, database instance count, and daily task count when plugin package D is placed into container ①, i.e., 80-50=30, 35-15=20, 60-24=36. If all are greater than or equal to 0, then plugin package D can be placed into container ①.

[0249] (5) Calculate the total remaining resources for each container. Since plugin package D was placed in container ①, the corresponding value of container ① needs to be updated, and all containers are sorted from largest to smallest for the total remaining resources. The updated sorting table of containers is shown in Table 18 below:

[0250] Table 18 Updated Container Sorting Table

[0251] Container number resource usage Number of database instances Daily task volume Total remaining resources Sort ① 30 20 36 86 2 ② 80 35 60 175 1 ③ 80 35 60 175 1 ④ 80 35 60 175 1

[0252] (6) Following the resource allocation method proposed in this application, plugin package F is then allocated to container ①, plugin package G to container ②, plugin package C to container ②, plugin package A to container ②, plugin package B to container ③, plugin package H to container ③, and plugin package E to container ④. All plugin packages have been allocated, and the remaining resources of the containers and the allocation relationship of the plugin packages are shown in Table 19 below. Plugin packages will then be allocated to the containers according to this relationship.

[0253] Table 19: Distribution Relationship of Plugin Packages and Containers

[0254]

[0255] In this embodiment of the application, the data modification / query task execution phase is as follows: Figure 13 As shown. Business operators write data modification / query tasks in this system. Business operators submit data modification / query tasks in this system: The task is submitted by one business operator, reviewed and approved by another business operator, and then executed. The system receives the data modification / query task: It receives and checks information such as database instance information, operation type, and number of rows to be executed. The system assigns the task to a container: The task information will match a unique database instance and plugin package. This system obtains the container information of the plugin package and assigns the task to the corresponding container. Containers execute tasks in sequence: Tasks using the same plugin package within a container are executed serially in sequence. Tasks using different plugin packages are executed in parallel, using a queue method to ensure that tasks with the same plugin package within a container are executed in sequence. The container returns the result of the task execution to the system. The system displays the task execution result.

[0256] The following is an example illustrating the relationship between data modification forms, plugin packages, and containers:

[0257] Using the plugin package AH ​​from the previous example, its allocation container is shown in Table 20 below:

[0258] Table 20: Container and Plugin Package Allocation Correspondence Table

[0259] container Plugin package ① DF ② GCA ③ BH ④ E

[0260] The configuration information for plugin packages D and F is shown in Table 21 below:

[0261] Table 21 Example of configuration information for plugin packages D and F

[0262]

[0263] There are currently 3 data modification / query tasks, as shown in Table 22:

[0264] Table 22 Example of Data Modification / Query Tasks

[0265]

[0266] The execution order in this system is 1, 2, 3. The system then matches tasks 1 and 2 with plugin package F, corresponding to container ①; and task 3 with plugin package D, also corresponding to container ①. The system then sends tasks 1, 2, and 3 to container ① in that order. Container ① receives the tasks, and its parent process distributes them to the child processes of plugin packages F and D. F executes tasks 1 and 2 in that order, and D executes task 3. The execution results are then returned to the parent process within the container, which in turn returns them to the system for display to the user. (The corresponding sequence steps are described below.)

[0267] like Figure 14 As shown.

[0268] Reference Figure 15 , Figure 15 This is a flowchart illustrating the database instance and plugin package deletion phases. Under the guidance of the business administrator, the system disables the plugin package. Specifically, after disabling the plugin package, it can no longer be used to perform data modification / query tasks on the database instance. The system removes the plugin package from the container, which is equivalent to deleting the plugin package during the plugin package allocation phase. Deleting the plugin package under the guidance of the business administrator means the system removes the association with the database instance. The system disables the database instance under the guidance of the business administrator. The system deletes the database instance under the guidance of the system administrator.

[0269] Based on the system's functions, this system supports multiple database types through plug-in packages. Other common parts, such as permission management, operation logs, and database instance management, can be unified and reused, reducing the time cost of having to manage multiple database change systems and simplifying the steps of maintaining multiple database management systems.

[0270] For plug-in database change management systems, implementing automatic scaling provides better protection for plug-in packages and the system's operation, preventing resource contention. The main system runs in a separate container, while plug-in packages run in separate containers. Changes to plug-in packages do not affect the main system's operation, preventing an increase in the number of plug-in packages and thus avoiding resource strain. Furthermore, plug-in packages can be distributed across different containers, minimizing the possibility of mutual interference between plug-in packages while achieving efficient utilization of machine resources.

[0271] For database change management systems with multiple database types, a change management module that is refined to the database instance level is implemented. This module is separated into independent plugin packages, and similarity rate analysis is performed on the plugin packages. Plugin packages with high similarity rates are assigned to the same container as a condition, which is taken into consideration in the plugin allocation algorithm to save resources.

[0272] For database change management systems with automatic scaling, implementing a hot-load and hot-unload plugin package allows for more granular scaling solutions. While automatic scaling was originally at the container level, the hot-load and hot-unload plugin package enables scaling down to the plugin package level. Furthermore, by automatically updating the actual workload of the plugin package weekly, even more precise scaling adjustments can be made based on varying workload levels.

[0273] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0274] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0275] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0276] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0277] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0278] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0279] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0280] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0281] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0282] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0283] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A method for allocating resources, characterized in that, The method includes: Determine the required number of containers based on the resource information of each plugin package and the resource capacity limit of a single container; The code files contained in each of the plugin packages are analyzed to calculate the pairwise similarity rate between each of the plugin packages; Based on the similarity rates between each pair of the plugin packages and the resource-related information of each plugin package, a resource reuse matrix corresponding to each plugin package is determined; Each plugin package is assigned to a corresponding container according to the resource reuse matrix and the allocation rules, wherein the allocation rules include assigning plugin packages that can be reused to the same container; The step of allocating each plugin package to a corresponding container according to the resource reuse matrix and allocation rules includes: Find the container with the largest remaining resources from all containers, where the remaining resources are the sum of the remaining resource usage, the remaining number of database instances, and the remaining daily task load. Obtain the plugin package with the largest total resources from the unallocated plugin packages, and determine whether the container with the largest remaining total resources can accommodate the plugin package with the largest total resources. The total resources are the sum of the plugin package's resource usage, the number of database instances, and the daily task volume. If the container with the largest remaining resources cannot contain the plugin package with the largest remaining resources, exclude the container with the largest remaining resources from all containers and return to the step of obtaining the container with the largest remaining resources from all containers. If the container with the largest remaining resources can accommodate the plugin package with the largest remaining resources, then the plugin package with the largest remaining resources is allocated to the container with the largest remaining resources, and the container with the largest remaining resources is used as the target container. Update the remaining resource usage, remaining number of database instances, remaining daily task quantity, and total remaining resources of the target container, and update any unallocated plugin packages; Based on the resource reuse matrix, obtain the plugin package with the largest resource reuse count with the plugin package in the target container from the updated unallocated plugin packages; Determine whether the target container can accommodate the plugin package with the largest resource reuse count; When the target container cannot accommodate the plugin package with the largest resource reuse count, the plugin package with the largest resource reuse count is excluded from the unallocated plugin packages, and the step of obtaining the plugin package with the largest resource reuse count from the updated unallocated plugin packages according to the resource reuse matrix is ​​returned. When the target container can accommodate the plugin package with the largest number of resource reuses, the plugin package with the largest number of resource reuses is allocated to the target container, and the steps of updating the remaining resource usage, remaining number of database instances, remaining number of daily tasks, and total remaining resources of the target container are returned, and the unallocated plugin packages are updated.

2. The method according to claim 1, characterized in that, The process of determining the required number of containers based on the resource-related information of each plugin package and the resource capacity limit of a single container includes: The execution function of the database instance is separated into a plugin package and uploaded. The plugin package contains configuration information and code files. The configuration information contains resource-related information of the plugin package. Based on the configuration information corresponding to each plugin package, calculate the total resource usage, total number of database instances, and total daily task volume of all plugin packages; The required number of containers is determined based on the total resource usage of all the aforementioned plugin packages, the total number of the aforementioned database instances, the total number of the aforementioned daily tasks, the maximum resource usage capacity of a single container, the maximum number of database instances that a single container can accommodate, and the maximum number of daily tasks that a single container can accommodate.

3. The method according to claim 1, characterized in that, The step of analyzing the code files contained in each plugin package and calculating the pairwise similarity rate between each plugin package includes: Analyze the code files contained in any two of the aforementioned plugin packages to obtain the number of identical configuration items and the number of identical entity classes; The similarity rate of any two plugin packages is calculated based on the number of identical configuration items, the number of identical entity classes, the total number of configuration items and the total number of entity classes of any two plugin packages.

4. The method according to claim 3, characterized in that, The step of determining the resource reuse matrix corresponding to each plugin package based on the similarity rate between each pair of plugin packages and the resource-related information of each plugin package includes: Based on the resource-related information of any two plugin packages, the total resource usage of any two plugin packages is calculated. Multiply the sum of the resource usage of any two plugin packages by the similarity rate of any two plugin packages to obtain the number of resource reuses between any two plugin packages; Calculate the resource reuse count between each pair of the aforementioned plugin packages and construct a resource reuse matrix.

5. The method according to claim 1, characterized in that, When the container with the largest remaining resource value cannot hold the plugin package with the largest total resource value, the method further includes: If each container cannot hold the plugin package with the largest total resources, then a new container is added to hold the plugin package with the largest total resources.

6. The method according to claim 1, characterized in that, The step of determining whether the container with the largest remaining resource sum can accommodate the plugin package with the largest total resource sum includes: The system detects whether the remaining resource usage of the container with the largest remaining resource total is greater than or equal to the resource usage of the plugin package with the largest remaining resource total, whether the remaining number of database instances of the container with the largest remaining resource total is greater than or equal to the number of database instances of the plugin package with the largest remaining resource total, and whether the remaining daily task volume of the container with the largest remaining resource total is greater than or equal to the daily task volume of the plugin package with the largest remaining resource total. If the remaining resource usage of the container with the largest remaining resource total is greater than or equal to the resource usage of the plugin package with the largest remaining resource total, and the remaining number of database instances of the container with the largest remaining resource total is greater than or equal to the number of database instances of the plugin package with the largest remaining resource total, and the remaining daily task volume of the container with the largest remaining resource total is greater than or equal to the daily task volume of the plugin package with the largest remaining resource total, then it is determined that the container with the largest remaining resource total can accommodate the plugin package with the largest remaining resource total. If the remaining resource usage of the container with the largest remaining resource total is less than the resource usage of the plugin package with the largest remaining resource total, or the remaining number of database instances of the container with the largest remaining resource total is less than the number of database instances of the plugin package with the largest remaining resource total, or the remaining daily task volume of the container with the largest remaining resource total is less than the daily task volume of the plugin package with the largest remaining resource total, then it is determined that the container with the largest remaining resource total cannot accommodate the plugin package with the largest remaining resource total.

7. The method according to claim 1, characterized in that, After the allocation is complete, the method further includes: When a new plugin package is detected, the similarity rate between the new plugin package and each of the already assigned plugin packages is calculated, and the resource reuse matrix is ​​updated based on the similarity rate and the resource-related information of each plugin package. Based on the updated resource reuse matrix, obtain the first plugin package with the largest resource reuse count with the newly added plugin package from the allocated plugin packages; Determine whether the container containing the first plugin package can accommodate the newly added plugin package; When the container containing the first plugin package cannot accommodate the newly added plugin package, the first plugin package is excluded from the allocated plugin packages, and the process of retrieving the first plugin package with the largest resource reuse count from the allocated plugin packages based on the updated resource reuse matrix is ​​returned. When the container containing the first plugin package is large enough to hold the new plugin package, the new plugin package is allocated to the container containing the first plugin package, and the remaining resource usage, remaining number of database instances, remaining daily task quantity, and total remaining resources of the container containing the first plugin package are updated.

8. The method according to claim 1, characterized in that, After the allocation is complete, the method further includes: When a new, deleted, or modified plugin package is detected, the daily task volume of the plugin package is updated according to the historical actual daily task volume of the plugin package during the preset update cycle, except for the plugin package that has been added or modified. Update the total resource usage, total number of database instances, and total daily task volume for all plugin packages; Based on the total resource usage of all updated plugin packages, the total number of database instances, the total number of daily tasks, the maximum resource usage capacity of a single container, the maximum number of database instances a single container can accommodate, and the maximum number of daily tasks a single container can accommodate, the required number of containers is re-determined. Determine whether the newly determined required number of containers is greater than or equal to the current number of containers; If the redefined required number of containers is less than the current number of containers, then return to the step of determining the required number of containers based on the resource-related information of each plugin package and the resource capacity limit of a single container; If the redefined required number of containers is greater than or equal to the current number of containers, the plugin package will not be reallocated.

9. A database change management system, characterized in that, Resource allocation is performed based on the method described in any one of claims 1-8.