Tenant management method and apparatus, and storage medium
By dynamically adjusting resource allocation based on tenant business attribute information in the database system, the problems of resource waste and high costs are solved, and efficient resource utilization and flexible management are achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
- Filing Date
- 2025-06-04
- Publication Date
- 2026-05-07
AI Technical Summary
Existing database systems have low flexibility in resource allocation and management when creating tenants, resulting in resource waste and high tenant costs.
By receiving creation requests, the minimum and maximum resource quantities are obtained based on the tenant's business attribute information, and the resource allocation of the tenant on the primary and backup nodes is dynamically adjusted to meet different business needs and improve resource utilization efficiency and flexibility.
It enables dynamic resource adjustment between primary and backup nodes, reducing resource waste, lowering tenant costs, and improving the flexibility of resource allocation and management.
Smart Images

Figure CN2025098988_07052026_PF_FP_ABST
Abstract
Description
Methods, devices and storage media for managing tenants
[0001] This application claims priority to Chinese Patent Application No. 202411533515.8, filed on October 30, 2024, entitled “Method, Apparatus and Storage Medium for Managing Tenants”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of communications, and in particular to a method, apparatus and storage medium for managing tenants. Background Technology
[0003] A tenant is an organization or individual that uses services on a database system. Tenants meet their needs by consuming the database system's resources. Tenants can be enterprises, organizations, development teams, or individual users. A tenant can consume a portion of the database system's resources to process business operations.
[0004] In related technologies, the database system is a master-slave architecture system. The database system can receive creation requests from users and create tenants based on these requests. During the tenant creation process, related technologies need to allocate and manage resources for the tenant. However, the flexibility of resource allocation and management in these technologies is low; therefore, improving the flexibility of resource allocation and management is an urgent problem to be solved. Summary of the Invention
[0005] This application provides a method, apparatus, and storage medium for managing tenants to improve the flexibility of allocating and managing tenant resources. The technical solution is as follows:
[0006] Firstly, this application provides a method for managing tenants, applied to a database system including a primary node and at least one first standby node. In the method, a creation request is received, including the target resource quantity required by the tenant to be created and the tenant's business attribute information. A first value is obtained based on the business attribute information; the first value is the minimum amount of resources the tenant needs to occupy on the primary node, and the first value is less than or equal to the target resource quantity. The tenant is created based on the first value, and the resources occupied by the tenant include first resources on the primary node and second resources on at least one first standby node. The quantity of the first resources is greater than or equal to the first value and less than or equal to the target resource quantity, and the quantity of the second resources is determined based on the difference between the target resource quantity and the first resource quantity.
[0007] The process involves obtaining a first value based on the business attribute information of the tenant to be created. This first value represents the minimum amount of resources the tenant needs to occupy on the master node. If the number of idle resources on the master node is greater than or equal to this first value, then first resources can be allocated to the tenant from the master node's idle resources. If the allocated first resources are less than the target resource quantity, second resources from at least one first backup node are used to compensate for the tenant's resource needs. Therefore, there are fewer constraints when allocating resources during tenant creation, improving the flexibility of resource allocation and / or management for tenants.
[0008] In one possible implementation, a second value is obtained based on business attribute information. This second value represents the maximum amount of resources a tenant needs to occupy on the primary node. The second value is greater than or equal to a first value and less than or equal to a target resource quantity. A tenant is created based on both the first and second values, with the first resource quantity also less than or equal to the second value. The primary node can perform both write and read operations, while the first backup node can only perform read operations and not write operations. By using the second value to limit the first resource quantity, the resource consumption on the primary node by tenants can be reduced. This allows the resources on the primary node to be used primarily for write operations, while read operations are primarily performed on the first backup node, improving the resource utilization efficiency of the primary node.
[0009] In another possible implementation, the utilization rate of the first resource by the tenant is obtained. When the first utilization rate is less than a first threshold, a first amount of resources is reduced from the first resource, and the reduced amount of the first resource is greater than or equal to a first value; and at least a first amount of resources are added to the second resource. When the first utilization rate is less than the first threshold, it indicates that not many write operations are performed, and the actual amount of first resource used is small. Therefore, the first resource occupied by the tenant can be reduced, so that the resources of the master node can be allocated to tenants with a higher proportion of write operations, thereby improving the utilization efficiency of the master node's resources.
[0010] In another possible implementation, the system obtains a first utilization rate of the first resource and a second utilization rate of the second resource. When the first utilization rate is greater than a second threshold and the second utilization rate is less than the first utilization rate, a second amount of resources is added to the first resource, such that the increased amount of first resources is less than or equal to the target resource amount; and at most a second amount of resources are reduced from the second resource. When the first utilization rate is greater than the second threshold and the second utilization rate is less than the first utilization rate, it indicates that the master node has performed a large number of write operations. Therefore, the system increases the resources occupied by the tenant on the master node to ensure that the tenant's write operations can continue to run normally.
[0011] In another possible implementation, the database system further includes a second standby node that obtains the first load size of the primary node and the second load size of the tenant on the primary node. If both the first load size and the second load size exceed a first load threshold, a third amount of resources is allocated to the tenant on the second standby node. The third amount of resources is reduced from the first resources, resulting in a first resource quantity greater than or equal to the first value. The fact that both the first and second load sizes indicate a high load on the primary node and a high load on the tenant on the primary node suggests that the tenant's operation is being maintained. To ensure the tenant's continued operation, a standby node can be added for the tenant, i.e., a third amount of resources can be allocated to the tenant on the second standby node. Reducing the third amount of resources from the tenant's first resources reduces the load on the primary node.
[0012] In another possible implementation, the database system also includes a second standby node. For each first standby node, a third load size of the first standby node and a fourth load size of the tenant on the first standby node are obtained. If the third load size exceeds the first load threshold and the fourth load size exceeds the second load threshold, a fourth amount of resources is allocated to the tenant on the second standby node. The fourth amount of resources is reduced from the resources occupied by the tenant on the first standby node. When the third load size exceeds the first load threshold and the fourth load size exceeds the second load threshold, it indicates that the load on the first standby node and the tenant's load on the first standby node are both high. To ensure the tenant's normal operation, a standby node can be expanded for the tenant, i.e., a fourth amount of resources are allocated to the tenant on the second standby node. The fourth amount of resources is reduced from the resources occupied by the tenant on the first standby node, thus reducing the load on the first standby node.
[0013] In another possible implementation, when the business attribute information is used to indicate that the tenant only has write operations, the first and second values are equal to the target resource quantity. This ensures that the resources allocated to the tenant are the resources on the master node, so as not to affect the execution of the tenant's write operations.
[0014] In another possible implementation, when the business attribute information is used to indicate that a tenant only has read-only business, both the first and second values are equal to 0. This ensures that the resources allocated to the tenant are those on the backup node, thus saving resources on the primary node. The resources on the primary node are then allocated to tenants with a high proportion of write-only business, improving the utilization efficiency of the primary node's resources.
[0015] In another possible implementation, where the business attribute information indicates that the tenant's business includes both write and read operations, and the proportion of write operations is greater than that of read operations, the first value equals the product of the target resource quantity and the first proportion, the second value equals the target resource quantity, and the first proportion is less than 1. Since the first value equals the product of the target resource quantity and the first proportion, this ensures that when allocating the tenant's first resources, there are sufficient first resources to run the tenant's write operations, avoiding any impact on the operation of the tenant's write operations.
[0016] In another possible implementation, when the business attribute information indicates that a tenant's business includes both write and read operations, and the proportion of read operations is greater than the proportion of write operations, the first value is equal to 0, and the second value is equal to the product of the target resource quantity and the second proportion, where the second proportion is less than 1. Since the second value is equal to the product of the target resource quantity and the second proportion, when allocating resources to tenants, the resources of the allocation nodes are allocated as much as possible, and the resources on the master node are allocated to tenants with a high proportion of write operations, thereby improving the utilization efficiency of the resources on the master node.
[0017] In another possible implementation, where the business attribute information is used to indicate that the tenant's business includes write business and read business, and the relationship between the proportion of write business and the proportion of read business is arbitrary, the first value is equal to 0, and the second value is equal to the target resource quantity.
[0018] In another possible implementation, the quantity of the first resource is 0. The number of third resources actually used by the tenant on the master node within a first time period (later than the tenant's creation timestamp) is obtained. When the quantity of the third resource is greater than or equal to a third threshold, a fourth resource is allocated to the tenant on the master node, and the quantity of the fourth resource is greater than or equal to the third threshold. This ensures that the tenant's write operations can run normally.
[0019] In another possible implementation, the amount of the fifth resource actually used by a tenant on the master node during a second time period is obtained. The fourth resource includes the fifth resource, and the second time period is later than the first time period. When the amount of the fifth resource is less than a fourth threshold, the fourth resource is released. The fourth threshold is less than a third threshold. This allows resources on the master node to be allocated to tenants with a high proportion of write operations, improving the utilization efficiency of resources on the master node.
[0020] In another possible implementation, the fifth load size of the tenant is obtained. If the fifth load size is less than the third load threshold, the resources occupied by the tenant in the n first standby nodes are released, where n is a positive integer, and at least one first standby node includes n first standby nodes. Based on the amount of resources released, resources are added to the first resources occupied by the tenant on the primary node, and the increased amount of first resources is less than or equal to the first target resource amount. This allows for dynamic adjustment of the resources occupied by the tenant on the standby nodes, improving the flexibility of resource management for the tenant.
[0021] In another possible implementation, the tenant's current resource requirement is a second target resource quantity. The first target resource quantity may or may not be equal to the second target resource quantity. The minimum resource quantity the tenant needs to occupy on the primary node changes from a first value to a fifth value. If the fifth value is greater than the first resource quantity, the tenant's first resource quantity on the primary node is increased to the fifth value, and the tenant's second resource quantity on at least one primary backup node is adjusted to the second target resource quantity minus a third value. If the fifth value is less than or equal to the first resource quantity, the tenant's resource quantity on at least one primary backup node is adjusted to the second target resource quantity minus the first resource quantity.
[0022] In this way, when the minimum amount of resources a tenant needs to occupy on the master node is adjusted from the first value to the fifth value, the amount of resources occupied by the tenant on the master node is adjusted according to the fifth value, so that the amount of resources occupied by the tenant on the master node is greater than or equal to the fifth value, in order to meet the resource requirements for performing write operations and avoid affecting the operation of the tenant's write business.
[0023] In another possible implementation, the tenant's current resource requirement is a second target resource quantity. The first target resource quantity may or may not be equal to the second target resource quantity. The maximum amount of resources the tenant needs to occupy on the primary node changes from the second value to a sixth value. When the sixth value is less than the first resource quantity, the amount of first resources the tenant occupies on the primary node is reduced to the sixth value, and the amount of second resources the tenant occupies on at least one primary backup node is adjusted to the second target resource quantity minus the sixth value. When the sixth value is greater than or equal to the first resource quantity, the amount of second resources the tenant occupies on at least one backup node is adjusted to the second target resource quantity minus the first resource quantity.
[0024] When the maximum number of resources a tenant needs to occupy on the master node is adjusted from the second value to the sixth value, the number of primary resources occupied by the tenant on the master node is adjusted according to the sixth value, so that the number of primary resources occupied by the tenant on the master node is less than or equal to the sixth value. This ensures that the primary resources occupied on the master node can meet the needs of write operations, avoid affecting the execution of the tenant's write business, and allocate the resources in the master node to tenants with a high proportion of write business, thereby improving the resource utilization efficiency of the master node.
[0025] Secondly, this application provides an apparatus for managing tenants, used to perform the method in the first aspect or any possible implementation thereof. Specifically, the apparatus includes units for performing the method in the first aspect or any possible implementation thereof.
[0026] Thirdly, this application provides a computing device cluster, the computing device cluster including at least one computing device, each computing device including a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster performs the method in the first aspect or any possible implementation of the first aspect.
[0027] Fourthly, this application provides a computer program product comprising computer program instructions stored in a computer-readable storage medium, wherein the computer program instructions are loaded by a processor to implement the method in the first aspect or any possible implementation thereof.
[0028] Fifthly, this application provides a computer-readable storage medium for storing computer program instructions, which are loaded by a processor to execute the methods described in the first aspect or any possible implementation thereof. Attached Figure Description
[0029] Figure 1 is a schematic diagram of the structure of a database system provided in an embodiment of this application;
[0030] Figure 2 is a schematic diagram of another database system provided in an embodiment of this application;
[0031] Figure 3 is a flowchart of a method for managing tenants provided in an embodiment of this application;
[0032] Figure 4 is a schematic diagram of a tenant provided in an embodiment of this application;
[0033] Figure 5 is a flowchart of another method for managing tenants provided in an embodiment of this application;
[0034] Figure 6 is a schematic diagram of another tenant provided in an embodiment of this application;
[0035] Figure 7 is a schematic diagram of another tenant provided in an embodiment of this application;
[0036] Figure 8 is a flowchart of another method for managing tenants provided in an embodiment of this application;
[0037] Figure 9 is a schematic diagram of another tenant provided in an embodiment of this application;
[0038] Figure 10 is a schematic diagram of another tenant provided in an embodiment of this application;
[0039] Figure 11 is a schematic diagram of another tenant provided in an embodiment of this application;
[0040] Figure 12 is a flowchart of another method for managing tenants provided in an embodiment of this application;
[0041] Figure 13 is a flowchart of another method for managing tenants provided in an embodiment of this application;
[0042] Figure 14 is a schematic diagram of a device structure for managing tenants provided in an embodiment of this application;
[0043] Figure 15 is a schematic diagram of the structure of a computing device provided in an embodiment of this application;
[0044] Figure 16 is a schematic diagram of a cluster structure for managing tenants provided in an embodiment of this application;
[0045] Figure 17 is a schematic diagram of another cluster structure for managing tenants provided in an embodiment of this application. Detailed Implementation
[0046] Referring to Figure 1, this application embodiment provides a database system 100, which includes a management node 101, a master node 102 and at least one backup node 103. The management node 101 can communicate with the master node 102 and at least one backup node 103.
[0047] Management node 101 can create tenants on primary node 102 and at least one backup node 103.
[0048] For example, management node 101 can receive a creation request, which includes the target number of resources required by the tenant to be created. Management node 101 can determine at least one first resource unit in master node 102, each first resource unit including a portion of the idle resources in master node 102, each first resource unit having the same size, all of which are of a specified size, and the sum of the sizes of each first resource unit being greater than or equal to the target number of resources.
[0049] For each standby node 103, the management node 101 can determine at least one second resource unit in the standby node 103. Each second resource unit includes a portion of the idle resources in the standby node 103. Each second resource unit has the same size, which is a specified size. The sum of the sizes of each second resource unit is greater than or equal to the target resource quantity.
[0050] Management node 101 creates a first tenant on primary node 102, with the first tenant occupying at least one first resource unit. It then creates a second tenant on backup node 103, with the second tenant occupying at least one second resource unit. Specifically, management node 101 creates a second tenant on each backup node 103, and each second tenant on backup node 103 is a backup tenant of the first tenant on primary node 102. In other words, each first tenant has at least one backup tenant, which is equivalent to at least one second tenant.
[0051] Optionally, for each backup node 103, the number of at least one first resource unit on the primary node 102 is equal to the number of at least one second resource unit on the backup node 103, and the size of the first resource unit is equal to the size of the second resource unit, so that the amount of resources occupied by the first tenant on the primary node 102 can be equal to the amount of resources occupied by the second tenant on the backup node 103.
[0052] For example, both the first and second resource units include CPUs and memory. The size of the first and second resource units includes 4 CPUs and 32GB of memory. Management node 101 determines a first resource unit from the idle resources of the primary node 102. The first resource unit includes 4 CPUs and 32GB of memory. For each backup node 103, a second resource unit is determined from its idle resources. The second resource unit includes 4 CPUs and 32GB of memory. Then, a first tenant is created on the primary node 102, occupying the first resource unit. A second tenant is created on the backup node 103, occupying the second resource unit.
[0053] In this case, at least one second tenant occupies resources in at least one backup node 103, resulting in higher costs. For example, the first tenant is used to process business, while at least one second tenant is usually not used to process business, so the resources occupied by at least one second tenant are not effectively utilized, resulting in waste and increased costs.
[0054] When allocating resources to tenants, the allocation is done at the resource unit level, resulting in low flexibility in allocating and / or managing resources for tenants. If the available resources on the primary node 102 or a backup node 103 are insufficient to meet the requirements of a single resource unit, it will be impossible to create a tenant on the primary node 102 or the backup node 103, and the available resources on the primary node 102 or the backup node 103 will be wasted.
[0055] For example, suppose that the number of idle CPUs on master node 102 is less than 4 and the amount of idle memory is less than 32G. In this case, it is impossible to determine the first resource unit in the idle resources of master node 102, which makes it impossible to create the first tenant on master node 102, resulting in the waste of idle resources of master node 102.
[0056] For example, suppose that the number of idle CPUs on the backup node 103 is less than 4 and the amount of idle memory is less than 32G. In this case, it is impossible to determine the second resource unit from the idle resources of the backup node 103, which makes it impossible to create a second tenant on the backup node 103, thus wasting the idle resources of the backup node 103.
[0057] In some embodiments, the primary node 102 or the backup node 103 may be a compute node on which a database instance is deployed. The compute node may be a physical node, such as a server or terminal device. Alternatively, the compute node may be a virtual node, such as a virtual instance, such as a virtual machine or container.
[0058] In some embodiments, the management node 101, the master node 102, and at least one backup node 103 may all be physical nodes. For example, the management node 101, the master node 102, and at least one backup node 103 may be servers and / or terminal devices, etc.
[0059] In some embodiments, the management node 101, the master node 102, and at least one backup node 103 may all be virtual nodes. For example, the management node 101, the master node 102, and at least one backup node 103 may be virtual machines and / or containers, etc.
[0060] In some embodiments, some of the management node 101, primary node 102, and at least one backup node 103 may be physical nodes, while the remaining nodes may be virtual nodes. For example, management node 101 may be a server or terminal device, and primary node 102 and at least one backup node 103 may be virtual machines and / or containers. As another example, management node 101 may be a virtual machine or container, and primary node 102 and at least one backup node 103 may be a server or terminal device.
[0061] In some embodiments, management node 101 may be a controller. Optionally, management node may monitor the resource usage of each tenant, or the resource usage of each node (master node 102 or backup node 103).
[0062] In some embodiments, referring to FIG2, when the primary node 102 and at least one backup node 103 are both virtual nodes or some nodes are virtual nodes, the database system 100 further includes a resource pool 104, and the resources in the virtual nodes are allocated by the management node 101 from the resource pool 104.
[0063] For example, if the master node 102 is a virtual node, the resources on the master node 102 are allocated by the management node 101 from the resource pool 104. Optionally, the management node 101 can dynamically adjust the resources on the master node 102. For example, the management node 101 can increase or decrease the resources on the master node 102.
[0064] For example, if the backup node 103 is a virtual node, the resources on the backup node 103 are allocated by the management node 101 from the resource pool 104. Optionally, the management node 101 can dynamically adjust the resources on the backup node 103. For example, the management node 101 can increase or decrease the resources on the backup node 103.
[0065] Optionally, resource pool 104 includes one or more of the following resources: central processing unit (CPU), graphics processing unit (GPU), or memory, etc. Management node 101 and master node 102 may be the same node, or they may be two different nodes.
[0066] In the aforementioned database system 100, resource waste, high tenant costs, and low flexibility in allocating and / or managing tenant resources may occur in the master node 102 or the backup node 103. The following embodiments can be used to manage tenants in order to reduce resource waste, lower tenant costs, and improve the flexibility in allocating and / or managing tenant resources.
[0067] Referring to Figure 3, this application embodiment provides a method 300 for managing tenants, which is applied to the database system 100 shown in Figure 1 or Figure 2. The method 300 is used to create tenants, and the executing entity of the method 300 may be a management node in the database system 100. The method 300 includes the following process.
[0068] Step 301: Receive a creation request. The creation request includes the first target resource quantity required by the tenant to be created and the attribute information of the tenant to be created.
[0069] In some embodiments, a user can input a creation request to the management node, and the management node can receive the creation request.
[0070] For example, a user can enter a creation request to the management node as shown below:
[0071] CREATE TENANT tenant1[ATTRIBUTE DESCRIBE]CPU 4MEMORY_SIZE 8G;
[0072] ATTRIBUTE DESCRIBE contains the attribute information for the tenant1 to be created. The first target resource quantity includes 4 CPUs and 8GB of memory.
[0073] The attribute information of the tenant to be created may include the business attribute information and / or low latency requirement attribute information of the tenant to be created.
[0074] In some embodiments, the business attribute information is used to indicate that the tenant to be created only has write business, meaning that during the operation of the tenant to be created, write operations may be required, but read operations are not required.
[0075] Optionally, if the business attribute information is used to indicate that the tenant to be created only has write business, a small number of read operations may also be performed.
[0076] In some embodiments, the business attribute information is used to indicate that the tenant to be created has only read services, meaning that during the operation of the tenant to be created, read operations may be required, but write operations are not required.
[0077] Optionally, if the business attribute information is used to indicate that the tenant to be created only has read business, a small number of write operations may also be performed.
[0078] In some embodiments, the business attribute information is used to indicate that the business of the tenant to be created includes write business and read business, and the proportion of write business is greater than the proportion of read business, indicating that during the operation of the tenant to be created, most of the operations to be performed are write operations, and a small number of operations are read operations.
[0079] In some embodiments, the business attribute information is used to indicate that the business of the tenant to be created includes write business and read business, and the proportion of read business is greater than the proportion of write business, indicating that during the operation of the tenant to be created, most of the operations to be performed are read operations, and a small number of operations are write operations.
[0080] In some embodiments, the business attribute information is used to indicate that the business of the tenant to be created includes write business and read business, and the relationship between the proportion of write business and the proportion of read business is arbitrary, indicating that during the operation of the tenant to be created, write operations and / or read operations may need to be performed.
[0081] In some embodiments, the low latency requirement attribute information is used to indicate that the latency required by the tenant to be created is below a latency threshold. That is, the low latency requirement attribute information indicates that the tenant to be created has a low latency requirement. Optionally, this latency may be communication latency, etc.
[0082] Step 302: Obtain the first value based on the attribute information. The first value is the minimum amount of resources that the tenant to be created needs to occupy on the master node. The first value is greater than or equal to 0 and less than or equal to the first target amount of resources.
[0083] In some embodiments, a second value can also be obtained based on the attribute information. The second value is the maximum amount of resources that the tenant to be created needs to occupy on the master node. The second value is greater than or equal to the first value and less than or equal to the first target amount of resources.
[0084] This attribute information includes business attribute information.
[0085] In some embodiments, when the business attribute information indicates that the tenant to be created only has write operations, it means that write operations may be required, but read operations are not. Since write operations are performed by the primary node and the backup node cannot perform write operations, the tenant to be created is created on the primary node. The amount of resources occupied by the tenant to be created on the primary node must be equal to the first target resource quantity, while the tenant to be created does not occupy resources on the backup node; that is, the first value equals the first target resource quantity, and the second value also equals the first target resource quantity.
[0086] For example, see Table 1 below. Suppose the tenant to be created is tenant1 in Table 1, the first target resource quantity is 4 CPUs, and the business attribute information of the tenant to be created is used to indicate that the tenant to be created only has write business. Then the first value obtained based on the business attribute information of the tenant to be created is 4 CPUs, and the second value is also 4 CPUs.
[0087] In some embodiments, where the business attribute information indicates that the tenant to be created only has read operations, it means that read operations may be required, but write operations are not necessary, and read operations can be performed by the primary node and / or backup nodes. However, to conserve the limited resources in the primary node and allow tenants with write operations to use those resources, the tenant to be created is created on at least one backup node. The amount of resources occupied by the tenant to be created on at least one backup node is equal to the first target resource amount, while the tenant to be created does not occupy the resources of the primary node; that is, the first value is equal to 0, and the second value is also equal to 0.
[0088] For example, referring to Table 1 below, assuming the tenant to be created is tenant2 in Table 1, the first target resource quantity is 4 CPUs, and the business attribute information of the tenant2 to be created is used to indicate that the tenant2 to be created only has read business, then the first value obtained based on the business attribute information of the tenant2 to be created is 0 CPUs, and the second value is also 0 CPUs.
[0089] In some embodiments, when the business attribute information indicates that the business of the tenant to be created includes write and read services, and the proportion of write services is greater than the proportion of read services, it means that most of the operations to be performed are write operations, and a small portion are read operations. Write operations are performed by the primary node; the backup node cannot perform write operations but can perform read operations. Therefore, most of the total resources occupied by the tenant to be created can be resources on the primary node, allowing the primary node to perform the majority of write operations. Conversely, a small portion of the total resources occupied by the tenant to be created can be resources on the backup node, allowing the backup node to perform the small portion of read operations, thus improving the resource utilization efficiency of the primary node. Therefore, the first value equals the product of the first target resource quantity and the first proportion, the second value equals the first target resource quantity, and the first proportion is less than 1. Optionally, the first proportion equals the proportion of write services.
[0090] For example, referring to Table 1 below, assuming the tenant to be created is tenant3 in Table 1, the first target resource quantity is 4 CPUs, the first proportion is 50%, and the business attribute information of the tenant3 to be created indicates that the business of the tenant3 to be created includes write business and read business, and the proportion of write business is greater than the proportion of read business. The product between the first target resource quantity and the first proportion is equal to 4 * 50%, which is equal to 2. Based on the business attribute information of the tenant3 to be created, the first value obtained is 2 CPUs, and the second value is 4 CPUs.
[0091] In some embodiments, when the business attribute information indicates that the business of the tenant to be created includes both write and read operations, and the proportion of read operations is greater than the proportion of write operations, it means that most of the operations to be performed are read operations, and a small portion are write operations. Most of the total resources occupied by the tenant to be created can be resources on at least one backup node, and a small portion can be resources on the primary node. Having at least one backup node perform the majority of read operations and the primary node perform the small portion of write operations improves the resource utilization efficiency of the primary node. Therefore, the first value equals 0, and the second value equals the product of the first target resource quantity and the second proportion, where the second proportion is less than 1. Optionally, the second proportion can be equal to the proportion of write operations.
[0092] For example, referring to Table 1 below, assume the tenant to be created is tenant4 in Table 1, the first target resource quantity is 4 CPUs, and the second ratio is 50%. The business attribute information of the tenant to be created (tenant4) indicates that the business of the tenant to be created includes write and read services, and the proportion of read services is greater than the proportion of write services. The product of the first target resource quantity and the second ratio is equal to 4 * 50%, which equals 2. Based on the business attribute information of the tenant to be created (tenant4), the first value obtained is 0 CPUs, and the second value is 2 CPUs.
[0093] In some embodiments, where the business attribute information indicates that the business of the tenant to be created includes write and read services, and the relationship between the proportion of write services and the proportion of read services is arbitrary, it may be necessary to perform write operations and / or read operations, i.e., the proportion of write operations to be performed is greater than or equal to 0 and less than or equal to 100%. Therefore, the first value is equal to 0, and the second value is equal to the first target resource quantity.
[0094] For example, refer to Table 1 below. Assume that the tenant to be created is tenant5 in Table 1, the first target resource quantity is 4 CPUs, and the business attribute information of the tenant5 to be created is used to indicate that the business of the tenant5 to be created includes write business and read business. The relationship between the proportion of write business and the proportion of read business is arbitrary. The first value obtained based on the business attribute information of the tenant5 to be created is 0 CPUs, and the second value is 4 CPUs.
[0095] Table 1
[0096] This attribute information includes low-latency requirement information, indicating that the tenant to be created has a low-latency requirement. Since the latency provided by the primary node is lower than that provided by the backup nodes, most of the total resources used by the tenant to be created are resources on the primary node, and a small portion are resources on at least one backup node. Therefore, the first value equals the product of the first target resource quantity and the third ratio, and the second value equals the first target resource quantity. The third ratio is less than 1.
[0097] For example, referring to Table 1 above, assuming the tenant to be created is tenant3 in Table 1, the first target resource quantity is 4 CPUs, and the third ratio is 50%, the attribute information of the tenant3 to be created includes low latency requirement attribute information. The product between the first target resource quantity and the third ratio is equal to 4 * 50%, which is equal to 2. Based on this low latency requirement attribute information, the first value obtained is 2 CPUs, and the second value is 4 CPUs.
[0098] Step 303: Create a tenant based on the first value. The resources occupied by the tenant include the first resource on the primary node and the second resource on at least one first backup node. The quantity of the first resource is greater than or equal to the first value and less than or equal to the quantity of the first target resource. The quantity of the second resource is determined based on the difference between the quantity of the first target resource and the quantity of the first resource.
[0099] At least one primary standby node is a standby node in the database system.
[0100] In some embodiments, the data of the second resource is equal to the difference, or the quantity of the second resource is greater than the difference.
[0101] In some embodiments, a tenant is created based on a first value and a second value, wherein the quantity of a first resource is greater than or equal to the first value and less than or equal to the second value.
[0102] Optionally, when creating a tenant, the initial amount of resources allocated to that tenant on the master node can be equal to a first value, while the amount of resources allocated to that tenant as a second resource can be equal to the first target resource amount minus the first value. During actual operation of the tenant, resources can be dynamically added to the first resource allocation and dynamically reduced from the second resource allocation to meet the tenant's write requirements.
[0103] For example, suppose the tenant to be created is tenant1 in Table 1 above, that is, the first value is 4 CPUs and the second value is also 4 CPUs. See Figure 4. Tenant tenant1 is created on the master node based on the first and second values. See Table 2 below and Figure 4. Tenant tenant1 occupies the first resource of the master node, including 4 CPUs, and occupies the second resource of at least one first standby node, including 0 CPUs.
[0104] The resources required for a tenant to be created include not only CPU but also other resources, such as memory. Typically, the ratio of CPU to memory used by a tenant to be created is fixed. For example, if the fixed ratio is 1:2, and the tenant uses one CPU, it will require 2GB of memory; if it uses two CPUs, it will require 4GB of memory.
[0105] Assuming a fixed ratio of 1:4, for example, if the tenant to be created occupies one CPU, then the tenant to be created will also need to occupy 4GB of memory; or, for example, if the tenant to be created occupies two CPUs, then the tenant to be created will also need to occupy 8GB of memory.
[0106] In this embodiment of the application, it is assumed that the fixed ratio is 1:2. As shown in Figure 4, tenant1 occupies 4 CPUs of the master node. Therefore, the first resource occupied by tenant1 of the master node also includes 8G of memory.
[0107] For example, suppose the tenant to be created is tenant2 in Table 1 above, meaning the first value is 0 CPUs and the second value is also 0 CPUs. Referring to Figure 4, tenant2 is created on at least one first standby node (first standby node 1 and first standby node 2) based on the first and second values. Referring to Table 2 below, tenant2 occupies 0 CPUs of the first resource on the primary node and 4 CPUs of the second resource on at least one first standby node (first standby node 1 and first standby node 2). The second resource includes second resource 1 on first standby node 1 and second resource 2 on first standby node 2.
[0108] Assuming the ratio remains fixed at 1:2, tenant2 occupies at least one of the second resources of the first backup node (first backup node 1 and first backup node 2), which includes 8GB of memory. As shown in Figure 4, the second resource 1 occupied by tenant2 on the first backup node 1 includes 2 CPUs and 4GB of memory, and the second resource 2 occupied by tenant2 on the first backup node 2 includes 2 CPUs and 4GB of memory.
[0109] For example, suppose the tenant to be created is tenant3 in Table 1 above, with a first value of 2 CPUs and a second value of 4 CPUs. Referring to Figure 4, tenant3 is created on the primary node and the first standby node 1 based on the first and second values. Referring to Table 2 below, tenant3 occupies 3 CPUs of the primary node's first resource and 1 CPU of the first standby node 1's second resource.
[0110] Assuming the ratio remains 1:2, as shown in Figure 4, tenant3 occupies 6GB of memory in the first resource of the primary node, and 2GB of memory in the second resource of the first backup node 1.
[0111] For example, suppose the tenant to be created is tenant4 in Table 1 above, with a first value of 0 CPUs and a second value of 2 CPUs. Referring to Figure 4, tenant4 is created on the primary node and the first standby node 2 based on the first and second values. Referring to Table 2 below, tenant4 occupies 1 CPU of the primary node's first resource and 3 CPUs of the first standby node 2's second resource.
[0112] Assuming the ratio remains fixed at 1:2, as shown in Figure 4, tenant4 occupies 2GB of memory as the first resource of the primary node, and 6GB of memory as the second resource of the primary backup node 2.
[0113] For example, suppose the tenant to be created is tenant5 in Table 1 above, with a first value of 0 CPUs and a second value of 4 CPUs. Referring to Figure 4, tenant5 is created on the primary node and the first standby node 1 based on the first and second values. Referring to Table 2 below, tenant5 occupies 2 CPUs of the primary node's first resource and 2 CPUs of the first standby node 1's second resource.
[0114] Assuming the ratio remains fixed at 1:2, as shown in Figure 4, tenant5 occupies 4GB of memory as the first resource of the primary node, and tenant5 occupies 4GB of memory as the second resource of the primary backup node 1.
[0115] Table 2
[0116] In some embodiments, if the total resources of the master node are fixed and the first value is greater than 0, the number of resources already occupied by the master node is obtained, the first value and the number of resources are added together to obtain an accumulated value, and the ratio between the accumulated value and the total number of resources of the master node is obtained. If the ratio exceeds a ratio threshold, the creation of tenants on the master node is stopped. This prevents too many resources from being allocated on the master node, resulting in the master node not having enough resources for dynamic adjustment.
[0117] In some embodiments, a first utilization rate of the tenant using a first resource and a second utilization rate of the tenant using a second resource are obtained. When the first utilization rate is less than a first threshold, a first amount of resources can be reduced from the first resource, and at least a first amount of resources can be added to the second resource. When the first utilization rate is greater than a second threshold and the second utilization rate is less than the first utilization rate, a second amount of resources can be added to the first resource, and at most a second amount of resources can be reduced from the second resource. Detailed implementation processes are shown in the embodiment illustrated in Figure 5 below, and will not be described in detail here.
[0118] In some embodiments, when allocating resources, if the amount of the first resource allocated to the tenant is 0, the tenant may perform a write operation during the actual execution process. When performing a write operation, the tenant requests the management node to allocate resources on the master node for the tenant, and then the tenant uses the resources on the master node to perform the write operation.
[0119] Optionally, the master node includes shared resources, and the management node may allocate resources to the tenant from the shared resources.
[0120] The system can retrieve the number of third resources actually used by the tenant on the master node within a first time period, which is later than the timestamp of the tenant's creation. When the number of third resources is greater than or equal to a third threshold, a fourth resource is allocated to the tenant on the master node, and the number of fourth resources is greater than or equal to the third threshold. The tenant can then run on the master node and use the fourth resource to perform write operations.
[0121] For example, assuming the third threshold is 0.5 CPUs, after the tenant is created on at least one first standby node, the amount of third resources actually used by the tenant on the master node during the first time period is 0.8 CPUs. Since the amount of third resources is greater than the third threshold, a fourth resource is allocated to the tenant on the master node, which includes 0.5 CPUs.
[0122] In some embodiments, the amount of the fifth resource actually used by the tenant on the master node during a second time period can also be obtained. The fourth resource includes the fifth resource, and the second time period is later than the first time period. When the amount of the fifth resource is less than a fourth threshold, the fourth resource is released. The fourth threshold is less than a third threshold.
[0123] When the number of fifth resources is less than the fourth threshold, it means that the tenant uses less resources in the master node. There is no need to allocate resources to the tenant separately on the master node. The fourth resource can be released so that the resources in the master node can be allocated to tenants who only have write business or have a high proportion of write business, thereby improving the utilization efficiency of resources in the master node.
[0124] For example, assuming the fourth threshold is 0.25 CPUs, the amount of the fifth resource actually used by the tenant in the second time period is 0.1 CPUs. The amount of the fifth resource is less than the fourth threshold, therefore the 0.5 CPUs included in the fourth resource are released.
[0125] In some embodiments, the database system further includes a resource pool, where the primary node includes a small amount of idle resources and at least one first standby node includes a small amount of idle resources. When a tenant needs to be created, the resources of the primary node and at least one first standby node can be dynamically increased. That is, before creating a tenant on the primary node and at least one first standby node, a first resource is added to the primary node, and a second resource is added to at least one first standby node. Both the first and second resources are resources in the resource pool.
[0126] In some embodiments, when the tenant is deleted, a first resource is reduced from the primary node to release the first resource, and a second resource is reduced from at least one first standby node to release the second resource.
[0127] In some embodiments, when the resource utilization of the master node exceeds a fifth threshold, it indicates that the master node has insufficient idle resources. The master node's resources are then increased to ensure it has sufficient resources to run tenants. Based on the amount of increased resources, the resources of at least one first standby node are reduced to maintain the total resource quantity.
[0128] In some embodiments, when the resource utilization of the master node is lower than the sixth threshold, it indicates that the master node has a large amount of idle resources. The resources of the master node are reduced, and based on the amount of resources reduced, the resources of at least one first standby node are increased. The sixth threshold is less than the fifth threshold, thus ensuring that the total amount of resources remains unchanged.
[0129] In some embodiments, the master node may include a read-write consistency forwarding module. For the write service of the tenant, the master node can perform the write operation to implement the write service. Performing the write operation is essentially writing data. Then, the storage address of the data is sent to at least one first backup node through the read-write consistency forwarding module. Thus, for the read service of the tenant, the read service is implemented by performing a read operation. This read operation requires reading the data. When any first backup node reads the data, it reads the data based on the storage address of the data.
[0130] In this embodiment, the attribute information of the tenant to be created is obtained, and a first value is obtained based on this attribute information. The first value is the minimum amount of resources the tenant needs to occupy on the master node. Thus, as long as the number of idle resources on the master node is greater than or equal to the first value, the idle resources of the master node can be used to create the tenant. This utilizes the idle resources of the master node, improving the flexibility of resource allocation and / or management for tenants and reducing resource waste. Since allocating resources to the tenant to be created on the master node only requires ensuring that the allocated resource quantity is greater than or equal to the first value, it is not necessary to allocate resources at the resource unit level, thus improving the flexibility of resource allocation, and consequently, the flexibility of tenant creation. If the idle resources of the master node are insufficient for the tenant's needs, the resources of the backup node are used to compensate for the tenant's resources. This allows a single tenant to run on both the master node and the backup node without needing to create a backup tenant, thus avoiding resource waste and increased costs.
[0131] Referring to Figure 5, this application embodiment provides a method 500 for managing tenants, which is applied to the database system 100 shown in Figure 1 or Figure 2. The method 500 is used to dynamically adjust the quantity of a first resource and / or a second resource occupied by a tenant after the tenant is created. The executing entity of the method 500 may be a management node in the database system 500. The method 500 includes the following process.
[0132] Step 501: Obtain the first utilization rate of the first resource used by the tenant, and obtain the second utilization rate of the second resource used by the tenant. The first resource is the resource occupied by the tenant on the primary node, and the second resource is the resource occupied by the tenant on at least one primary backup node.
[0133] The primary node can calculate the first utilization rate of the first resource for the tenant and send this first utilization rate to the management node. For each primary backup node, the primary backup node can calculate the utilization rate of the resources used by the tenant and send the calculated utilization rate to the management node. The management node can receive the first utilization rate sent by the primary node and the utilization rate sent by each primary backup node, and derive the second utilization rate based on the utilization rate sent by each primary backup node.
[0134] Step 502: Determine whether the first utilization rate is less than the first threshold. If the first utilization rate is less than the first threshold, proceed to step 503. If the first utilization rate is greater than or equal to the first threshold, proceed to step 505.
[0135] If the first utilization rate is less than the first threshold, it means that a large amount of resources in the first resource of the master node are not used by the tenant. In order to improve the resource utilization rate of the master node, the following step 503 can be used to reduce the resources occupied by the tenant in the master node.
[0136] For example, referring to Figure 6, assuming the tenant is tenant3, tenant3 occupies the first resource of the primary node, which includes 3 CPUs and 6GB of memory, and the second resource of the first backup node 1, which includes 1 CPU and 2GB of memory. Assuming the first utilization rate of the first resource is 40%, and assuming the first threshold is 50%, if the first utilization rate of 40% is determined to be less than 50%, step 503 is executed.
[0137] Optionally, the first threshold can be a user-configured threshold or a default threshold, etc.
[0138] Step 503: Reduce the first amount of resources from the first resources occupied by the tenant on the master node, and the reduced amount of the first resources is greater than or equal to the first value.
[0139] In some embodiments, the third value can be obtained according to the following first formula;
[0140] The first formula is: new_master_res1 = master_cur_res * (U1 + offset1);
[0141] In the first formula, `new_master_res1` is the third value, `master_cur_res` is the amount of resources currently actually occupied by the tenant in the master node, which is the amount of the first resource, `U1` is the first utilization rate, and `offset1` is an offset less than 50%, for example, `offset1` can be equal to 10%, 15%, or 20%, etc. `U1 + offset1` is the expected utilization rate, and `offset1` can be a user-configured value or a default setting, etc. Optionally, the first formula indicates that when the amount of the first resource is reduced to the third value, the tenant's utilization rate of the reduced first resource may increase to the expected utilization rate.
[0142] The third value, new_master_res1, may be less than or greater than the first value. Therefore, the maximum value is selected from the third value, new_master_res1, and the first value. The first quantity is equal to the difference between the quantity of the first resource and this maximum value. The first resource occupied by the tenant on the master node is reduced by the first quantity of resources to reduce the tenant's occupation of the first resource on the master node to the maximum value. That is, the quantity of the first resource occupied by the tenant on the master node after the reduction is the maximum value.
[0143] Optionally, the resources occupied by the tenant on the master node can be reduced in one or more steps at the resource granularity until the amount of resources occupied by the tenant on the master node reaches the maximum value.
[0144] For example, assuming the resource granularity is 0.25 CPUs, then 0.25 CPUs will be reduced from the first resource of the master node occupied by the tenant each time.
[0145] Optionally, the resource granularity can be a user-configured granularity or a default granularity.
[0146] Step 504: Add at least a first amount of resources to the second resources in at least one first standby node occupied by the tenant, and end.
[0147] In some embodiments, a first number of resources may be added to the second resources occupied by the tenant in at least one first backup node. The increased number of second resources occupied by the tenant in at least one first backup node is equal to the first target resource number minus the maximum value, ensuring that the total number of resources occupied by the tenant is equal to the first target resource number.
[0148] In some embodiments, resources may be added to the second resources occupied by the tenant on at least one first backup node, the number of added resources being greater than the first number, and the number of second resources occupied by the tenant on at least one first backup node after the addition being greater than the first target resource number minus the maximum value.
[0149] Optionally, resources can be added to the second resources occupied by the tenant on at least one first backup node in one or more installments, according to resource granularity, until the number of second resources occupied by the tenant on at least one first backup node reaches the first target resource quantity minus the maximum value, or is greater than the first target resource quantity minus the maximum value.
[0150] For example, referring to Figure 6, assuming Offset1 = 20%, the first resource includes 3 CPUs. According to the first formula above, the third value new_master_res1 = 3 * (40% + 20%) = 1.8 CPUs. The first value for tenant3 is 2 CPUs. Choosing the maximum value of 2 CPUs from the third value new_master_res1 (1.8 CPUs) and the first value (2 CPUs), the first quantity equals the difference between the first resource quantity and this maximum value, which is 1 CPU.
[0151] Then, one CPU is removed from the primary node's primary resources occupied by tenant3, leaving two CPUs. A first amount of resources, i.e., one CPU, is added to the secondary resources occupied by tenant3 on the primary backup node 1. The increased amount of secondary resources occupied by tenant3 on the primary backup node 1 is equal to the first target resource amount minus the maximum value, which equals two CPUs. Assuming a fixed CPU-to-memory ratio of 1:2 (see Figure 6), the reduced primary node resources occupied by tenant3 include two CPUs and 4GB of memory, while the increased secondary node resources occupied by tenant3 on the primary backup node 1 include two CPUs and 4GB of memory.
[0152] Step 505: Determine whether the first utilization rate is greater than the second threshold and whether the second utilization rate is less than the first utilization rate. If the second threshold is greater than the first threshold and the first utilization rate is less than the first utilization rate, then proceed to step 506.
[0153] If the first utilization rate is greater than the second threshold, it indicates that a large amount of the first resource in the primary node is being used by this tenant. If the second utilization rate is less than the first utilization rate, it indicates that the proportion of write operations performed by this tenant on the primary node is much higher than the proportion of read operations performed on at least one primary standby node. To ensure that the tenant's write operations are not affected, the resources occupied by this tenant on the primary node can be increased through the following step 506.
[0154] Referring to Figure 7, assuming the tenant is tenant5, tenant5 occupies the first resource of the primary node, including 2 CPUs and 4GB of memory, and the second resource of the first backup node 1, also including 2 CPUs and 4GB of memory. Assuming the first resource utilization rate is 95% and the second resource utilization rate is 30%, and assuming the first threshold is 50% and the second threshold is 90%, then it is determined that the first utilization rate of 95% is greater than 90%, and the second utilization rate of 30% is less than the first utilization rate of 95%, proceeding to step 506.
[0155] Optionally, the second threshold can be a user-configured threshold or a default threshold, etc.
[0156] Step 506: Add a second amount of resources to the first resources occupied by the tenant on the master node, such that the increased amount of the first resources is less than or equal to the first target resource amount.
[0157] In some embodiments, the increased quantity of the first resource is also less than or equal to the second value.
[0158] In some embodiments, the fourth value can be obtained using the following second formula;
[0159] The second formula is: new_master_res2 = master_cur_res * (U1 / offset2);
[0160] In the second formula, `new_master_res2` is the fourth value, `master_cur_res` is the quantity of the first resource, `U1` is the first utilization rate, and `offset2` is the expected utilization rate. The expected utilization rate `offset2` is less than the first utilization rate; for example, `offset2` can be equal to 60%, 65%, 70%, 75%, or 80%, etc. The expected utilization rate `offset2` can be a user-configured value or a default setting, etc. Optionally, the second formula indicates that when the quantity of the first resource is increased to the fourth value, the tenant's utilization rate of the increased first resource may decrease to the expected utilization rate.
[0161] The fourth value, `new_master_res2`, may be less than or greater than the second value. Therefore, the minimum value between `new_master_res2` and the second value is selected. The second quantity is equal to the difference between this minimum value and the quantity of the first resource. The second quantity of resources is added to the first resource allocated to the master node by the tenant; that is, the quantity of the first resource after the addition is the minimum value.
[0162] Step 507: Reduce the amount of resources by up to a second quantity from the second resources in at least one first standby node occupied by the tenant, and end.
[0163] In some embodiments, a second amount of resources is reduced from the second resources occupied by the tenant on at least one first backup node. The reduced amount of second resources occupied by the tenant on at least one first backup node is equal to the first target resource amount minus the minimum value, ensuring that the total amount of resources occupied by the tenant is equal to the first target resource amount.
[0164] In some embodiments, resources are reduced from the second resources occupied by the tenant on at least one first backup node, the amount of resources reduced being less than the second amount, and the reduced amount of second resources occupied by the tenant on at least one first backup node is less than the first target resource amount minus the minimum value.
[0165] For example, referring to Figure 7, assuming Offset2 = 70%, the first resource includes 2 CPUs. According to the second formula above, the fourth value new_master_res2 = 2 * (95% / 70%) is approximately 2.7 CPUs. The second value for tenant5 is 4 CPUs. Choosing the minimum value of new_master_res2 (2.7 CPUs) and the second value (4 CPUs), which is 2.7 CPUs, the second quantity equals the difference between this minimum value and the quantity of the first resource, which is 0.7 CPUs.
[0166] Then, a second amount of resources is added to the primary node's primary resources occupied by tenant5, i.e., 0.7 CPUs are added, bringing the primary resources to 2.7 CPUs. A second amount of resources is also removed from the secondary resources occupied by tenant5 on the primary backup node 1, i.e., 0.7 CPUs are removed. The reduced amount of secondary resources occupied by tenant5 on the primary backup node 1 is equal to the primary target resource amount minus the minimum value, which is 1.3 CPUs. Assuming a fixed CPU-to-memory ratio of 1:2 (see Figure 7), the increased primary node resources occupied by tenant5 on the primary node include 2.7 CPUs and 5.4GB of memory, while the reduced secondary node resources occupied by tenant5 on the primary backup node 1 include 1.3 CPUs and 2.6GB of memory.
[0167] In this embodiment, a first utilization rate of a tenant's use of a first resource and a second utilization rate of its use of a second resource are obtained. When the first utilization rate is less than a first threshold, it indicates that not many write operations are performed, and the actual amount of first resource used is small. Therefore, the first resource occupied by the tenant can be reduced, allowing the resources of the main node to be allocated to tenants with a higher proportion of write operations, thereby improving the resource utilization efficiency of the main node. When the first utilization rate is greater than a second threshold and the second utilization rate is less than the first utilization rate, it indicates that the main node has performed a large number of write operations, increasing the resources occupied by the tenant on the main node, in order to ensure that the tenant's write operations can run normally.
[0168] Referring to Figure 8, this application embodiment provides a method 800 for managing tenants, which is applied to the database system 100 shown in Figure 1 or Figure 2. The method 800 is used to add a backup node for a tenant after its creation, when the load on the primary node is high and the tenant's load on the primary node is also high. The method 800 includes the following process.
[0169] Step 801: Obtain the first load size of the master node and the second load size of the tenant on the master node.
[0170] In some embodiments, the first load size includes at least one first load parameter, and the second load size includes at least one second load parameter.
[0171] Optionally, at least one first load parameter includes one or more of the following: the number of packets per second (PPS) sent by the master node, the first network bandwidth utilization of the master node, or the number of input / output operations per second (IOPS) of the master node, etc.
[0172] Optionally, at least one second load parameter includes one or more of the following: the tenant's second PPS on the master node, the tenant's second network bandwidth utilization on the master node, or the tenant's second IOPS on the master node, etc.
[0173] For example, referring to Figure 9, assuming the tenant is tenant3, the first PPS obtained from the master node is 92%, and the second PPS obtained from tenant3 on the master node is 75%.
[0174] Step 802: If the first load size exceeds the first load threshold and the second load size exceeds the second load threshold, allocate a third amount of resources to the tenant in the second standby node. The database system also includes a second standby node.
[0175] In some embodiments, if a portion of a first load parameter exceeds a first load threshold and a portion of a second load parameter exceeds a second load threshold, a third number of resources are allocated to the tenant in the second standby node, wherein the portion of the first load parameter and the portion of the second load parameter are parameters of the same type.
[0176] The first load threshold includes one or more of the following: a first PPS threshold, a first network bandwidth utilization threshold, or a first IOPS threshold, etc. The second load threshold includes one or more of the following: a second PPS threshold, a second network bandwidth utilization threshold, or a second IOPS threshold, etc.
[0177] Optionally, the first PPS threshold may be greater than the second PPS threshold, and / or the first network bandwidth utilization threshold may be greater than the second network bandwidth utilization threshold, and / or the first IOPS threshold may be greater than the second IOPS threshold.
[0178] Thus, in step 802, if the first PPS exceeds the first PPS threshold and the second PPS exceeds the second PPS threshold, and / or if the first network bandwidth utilization exceeds the first network bandwidth utilization threshold and the second network bandwidth utilization exceeds the second network bandwidth utilization threshold, and / or if the first IOPS exceeds the first IOPS threshold and the second IOPS exceeds the second IOPS threshold, a third amount of resources is allocated to the tenant in the second standby node.
[0179] The first PPS threshold, the first network bandwidth utilization threshold, the first IOPS threshold, the second PPS threshold, the second network bandwidth utilization threshold, or the second IOPS threshold can be a user-configured threshold or a default threshold.
[0180] Assuming the first PPS threshold is 90% and the second PPS threshold is 70%, and the obtained first PPS is 92% and the second PPS is 75%, that is, the first PPS exceeds the first PPS threshold and the second PPS exceeds the second PPS threshold, as shown in Figure 9, a third amount of resources is allocated to the tenant3 in the second backup node. The third amount of resources is 1 CPU, which includes 1 CPU and 2G of memory.
[0181] Step 803: Reduce the amount of resources by a third from the first resources occupied by the tenant, such that the reduced amount of the first resources is greater than or equal to the first value.
[0182] This ensures that the total amount of resources occupied by the tenant remains at the first target amount. After the reduction, the amount of resources occupied by the tenant on the master node is greater than or equal to the first value, so as to avoid affecting the execution of write operations and ensure that there are enough resources to execute the tenant's write business.
[0183] For example, referring to Figure 9, reducing the first resource occupied by tenant3 by 1 CPU and 2GB of memory, the reduced first resource occupied by tenant3 on the master node includes 2 CPUs and 4GB of memory.
[0184] In some embodiments, after a tenant is created, if the load on a first backup node is high, or if the tenant's load on that first backup node is high, a backup node can be added for that tenant. The detailed implementation process is as follows:
[0185] Step 811: For each first standby node, obtain the third load size of the first standby node and the fourth load size of the tenant on the first standby node.
[0186] In some embodiments, the third load size includes at least one third load parameter, and the fourth load size includes at least one fourth load parameter.
[0187] Optionally, at least one third load parameter includes one or more of the following: the third PPS of the first backup node, the third network bandwidth utilization of the first backup node, or the third IOPS of the first backup node, etc.
[0188] Optionally, at least one fourth load parameter includes one or more of the following: the tenant's fourth PPS on the first backup node, the tenant's fourth network bandwidth utilization on the first backup node, or the tenant's fourth IOPS on the first backup node, etc.
[0189] For example, referring to Figure 10, assuming the tenant is tenant4, the third PPS obtained from the first backup node 2 is 92%, and the fourth PPS obtained from tenant4 on the first backup node 2 is 75%.
[0190] Step 812: If the third load size exceeds the first load threshold and the fourth load size exceeds the second load threshold, allocate a fourth amount of resources to the tenant in the second standby node.
[0191] In some embodiments, if a portion of a third load parameter exceeds a first load threshold and a portion of a fourth load parameter exceeds a second load threshold, a fourth amount of resources is allocated to the tenant in the second standby node, wherein the portion of the third load parameter and the portion of the fourth load parameter are parameters of the same type.
[0192] Thus, in step 812, when the third PPS exceeds the first PPS threshold and the fourth PPS exceeds the second PPS threshold, and / or when the third network bandwidth utilization exceeds the first network bandwidth utilization threshold and the fourth network bandwidth utilization exceeds the second network bandwidth utilization threshold, and / or when the third IOPS exceeds the first IOPS threshold and the fourth IOPS exceeds the second IOPS threshold, a fourth amount of resources is allocated to the tenant in the second standby node.
[0193] Assuming the first PPS threshold is 90%, the second PPS threshold is 70%, and the obtained third PPS is 92% and the fourth PPS is 75%, that is, the third PPS exceeds the first PPS threshold and the fourth PPS exceeds the second PPS threshold, as shown in Figure 10, the fourth quantity of resources is allocated to the tenant4 in the second backup node. The fourth quantity is 1 CPU, and the fourth quantity of resources includes 1 CPU and 2G of memory.
[0194] Step 813: Reduce the fourth amount of resources from the resources occupied by the tenant in the first standby node.
[0195] This ensures that the total amount of resources used by the tenant remains at the first target amount.
[0196] For example, referring to Figure 10, the resources occupied by tenant4 on the first standby node 2 are reduced by 1 CPU and 2G of memory. After the reduction, the resources occupied by tenant4 on the first standby node 2 include 2 CPUs and 4G of memory.
[0197] When the tenant's load is low, the number of backup nodes occupied by the tenant can be reduced. The specific implementation process is as follows.
[0198] Step 821: Obtain the fifth load size for this tenant.
[0199] In step 821, at least one fifth load parameter is obtained for each of the multiple nodes, including a primary node and at least one first standby node. If the tenant also consumes resources on a second standby node, the multiple nodes also include a second standby node.
[0200] The same type of load parameters in at least one fifth load parameter of the tenant on each node are summed to obtain at least one load parameter sum value, and the fifth load size includes the at least one load parameter sum value.
[0201] For each node, at least one fifth load parameter for the tenant on that node includes one or more of the following: the tenant's fifth PPS on that node, the tenant's fifth network bandwidth utilization on that node, or the tenant's fifth IOPS on that node, etc.
[0202] The fifth load factor is calculated by summing the fifth PPS for the tenant on each node, the fifth network bandwidth utilization for the tenant on each node, and / or the fifth IOPS for the tenant on each node. Therefore, the fifth load factor includes the summed PPS, the summed network bandwidth utilization, and / or the summed IOPS.
[0203] For example, referring to Figure 11, assume the tenant is tenant3, and multiple nodes include the primary node, the first backup node 1, and the second backup node. Obtain the fifth PPS1 of tenant3 on the primary node, the fifth PPS2 on the first backup node 1, and the fifth PPS3 on the second backup node. Summate the fifth PPS1, fifth PPS2, and fifth PPS3 to obtain the cumulative PPS value.
[0204] Obtain the fifth network bandwidth utilization rate (1) of tenant3 on the primary node, the fifth network bandwidth utilization rate (2) on the first backup node 1, and the fifth network bandwidth utilization rate (3) on the second backup node. Summate the fifth network bandwidth utilization rates (1, 2, and 3) to obtain the cumulative network bandwidth utilization value.
[0205] Get the fifth IOPS1 on the primary node, the fifth IOPS2 on the first standby node 1, and the fifth IOPS3 on the second standby node for tenant3. Summate the fifth IOPS1, fifth IOPS2, and fifth IOPS3 to obtain the cumulative IOPS value.
[0206] Step 822: If the fifth load size is less than the third load threshold, release the resources occupied by the tenant in the n backup nodes, where n is an integer greater than 0.
[0207] In step 822, if the cumulative value of at least one load parameter is less than the threshold of the third parameter, the resources occupied by the tenant in the n backup nodes are released.
[0208] The third load threshold includes one or more of the following: third PPS threshold, third network bandwidth utilization threshold, or third IOPS threshold, etc.
[0209] Thus, in step 822, if the cumulative PPS value is less than the third PPS threshold, the cumulative network bandwidth utilization value is less than the third network bandwidth utilization threshold, and the cumulative IOPS value is less than the third IOPS threshold, the resources occupied by the tenant in the n backup nodes are released.
[0210] For example, referring to Figure 11, when the cumulative PPS value is less than the third PPS threshold, the cumulative network bandwidth utilization value is less than the third network bandwidth utilization threshold, and the cumulative IOPS value is less than the third IOPS threshold, the resources occupied by tenant3 in the second standby node are released. The released resources include 1 CPU and 2G of memory.
[0211] Step 823: Based on the amount of resources released, add resources to the first resource on the master node occupied by the tenant. The amount of the first resource after the addition is less than or equal to the amount of the first target resource.
[0212] Optionally, the quantity of the first resource after the increase is less than or equal to the second value.
[0213] For example, referring to Figure 11, resources are added to the first resource occupied by tenant3 on the master node. After the addition, the first resource occupied by tenant3 on the master node includes 3 CPUs and 6G of memory.
[0214] In this embodiment, a first load size of the master node and a second load size of the tenant on the master node are obtained. If both the first load size and the second load size exceed a first load threshold, it indicates that the master node and the tenant have a high load on the master node. To ensure the tenant's normal operation, a backup node can be added for the tenant; that is, a third amount of resources can be allocated to the tenant in the second backup node. Reducing the third amount of resources from the first amount of resources occupied by the tenant reduces the load on the master node.
[0215] Referring to Figure 12, this application embodiment provides a method 1200 for managing tenants. The method 1200 is applied to the database system 100 shown in Figure 1 or Figure 2. After a tenant is created, the method determines that the tenant currently requires a second target resource quantity, where a first target resource quantity may or may not be equal to the second target resource quantity. The minimum resource quantity that the tenant needs to occupy on the master node is changed from a first value to a fifth value, and the resources occupied by the tenant are adjusted based on this fifth value. The method 1200 includes the following process.
[0216] Step 1201: Compare the fifth value with the quantity of the first resource.
[0217] In some embodiments, the user can adjust the amount of resources required by the tenant, that is, the user can adjust the amount of resources required by the tenant from a first target resource quantity to a second target resource quantity, where the first target resource quantity may be less than or greater than the second target resource quantity. The management node can obtain the second target resource quantity. Alternatively, the user can choose not to adjust the amount of resources required by the tenant, where the first target resource quantity and the second target resource quantity are equal.
[0218] In some embodiments, the user can adjust the minimum amount of resources that the tenant can occupy on the master node, changing the minimum amount of resources from a first value to a fifth value. The management node can obtain the fifth value and then compare the fifth value with the first amount of resources.
[0219] Step 1202: When the fifth value is greater than the number of first resources, increase the number of first resources occupied by the tenant on the primary node to the fifth value, and adjust the number of second resources occupied by the tenant on at least one primary backup node to the second target resource number minus the fifth value.
[0220] In step 1202, `master_cur_res` represents the quantity of the first resource, `new_master_min` represents the fifth value, and `resource` represents the quantity of the second target resource. Since `new_master_min` is greater than `master_cur_res`, resources equal to `new_master_min - master_cur_res` are allocated from the idle resources of the master node. The allocated resources are then added to the first resource quantity occupied by the tenant on the master node, bringing the quantity of the first resource occupied by the tenant to the fifth value, `new_master_min`. Then, the resources occupied by the tenant on at least one first standby node are adjusted to the second target resource quantity minus the fifth value, so that the total resource quantity occupied by the tenant equals the second target resource quantity, `resource`.
[0221] Step 1203: When the fifth value is less than or equal to the number of the first resources, adjust the number of resources occupied by the tenant at least one backup node to the second target resource number minus the number of the first resources.
[0222] If the fifth value is less than or equal to the first resource quantity, the amount of first resource occupied by the tenant on the primary node does not need to be adjusted. If the second target resource quantity is not equal to the first target resource quantity, the amount of resources occupied by the tenant on at least one backup node needs to be adjusted to the second target resource quantity minus the first resource quantity, so that the total amount of resources occupied by the tenant equals the second target resource quantity.
[0223] Optionally, at least one backup node includes at least one first backup node and / or a second backup node as described above.
[0224] In this embodiment, the minimum amount of resources required by a tenant on the master node can be adjusted from a first value to a fifth value. Then, based on the fifth value, the amount of resources occupied by the tenant on the master node can be adjusted so that the amount of resources occupied by the tenant on the master node is greater than or equal to the fifth value, thereby meeting the resource requirements for performing write operations and avoiding affecting the operation of the tenant's write business.
[0225] Referring to Figure 13, this application embodiment provides a method 1300 for managing tenants, which is applied to the database system 100 shown in Figure 1 or Figure 2. The method 1300 is used to, after creating a tenant, determine that the tenant's current resource requirement is a second target resource quantity, where a first target resource quantity is equal to or not equal to the second target resource quantity. The maximum resource quantity that the tenant needs to occupy on the master node is changed from a second value to a sixth value, and the resources occupied by the tenant are adjusted based on this sixth value. The method 1300 includes the following process.
[0226] Step 1301: Compare the sixth value with the quantity of the first resource.
[0227] In some embodiments, the user can adjust the amount of resources required by the tenant, that is, the user can adjust the amount of resources required by the tenant from a first target resource quantity to a second target resource quantity, where the first target resource quantity may be less than or greater than the second target resource quantity. The management node can obtain the second target resource quantity. Alternatively, the user can choose not to adjust the amount of resources required by the tenant, where the first target resource quantity and the second target resource quantity are equal.
[0228] In some embodiments, the user can adjust the maximum amount of resources that the tenant can occupy on the master node, changing the maximum amount of resources from a second value to a sixth value. The management node can obtain the sixth value and then compare the sixth value with the first amount of resources.
[0229] Step 1302: When the sixth value is less than the number of first resources, reduce the number of first resources occupied by the tenant on the primary node to the sixth value, and adjust the number of second resources occupied by the tenant on at least one primary backup node to the second target resource number minus the sixth value.
[0230] In step 1302, `master_cur_res` represents the quantity of the first resource, `new_master_max` represents the sixth value, and `resource` represents the quantity of the second target resource. Since `new_master_max` is less than `master_cur_res`, the first resource occupied by the tenant on the master node is reduced by an amount equal to `master_cur_res - new_master_max`, so that the reduced quantity of the first resource occupied by the tenant on the master node equals the sixth value `new_master_max`. Then, the quantity of the second resource occupied by the tenant on at least one first standby node is adjusted to the second target resource quantity minus the sixth value, so that the total quantity of resources occupied by the tenant equals the second target resource quantity `resource`.
[0231] Step 1303: When the sixth value is greater than or equal to the number of first resources, adjust the number of second resources occupied by the tenant at least one backup node to the number of second target resources minus the number of first resources.
[0232] If the sixth value is greater than or equal to the first resource quantity, the amount of first resource occupied by the tenant on the primary node does not need to be adjusted. If the second target resource quantity is not equal to the first target resource quantity, the amount of second resource occupied by the tenant on at least one backup node needs to be adjusted to the second target resource quantity minus the first resource quantity, so that the total resource quantity occupied by the tenant equals the second target resource quantity.
[0233] Optionally, at least one backup node includes at least one first backup node and / or a second backup node as described above.
[0234] In this embodiment, the maximum number of resources that a tenant needs to occupy on the master node can be adjusted from a second value to a sixth value. Then, based on the sixth value, the number of first resources occupied by the tenant on the master node can be adjusted so that the number of first resources occupied by the tenant on the master node is less than or equal to the sixth value. This ensures that the first resources occupied on the master node can meet the needs of write operations, avoid affecting the execution of the tenant's write business, and allocate the resources in the master node to tenants with a high proportion of write business, thereby improving the utilization efficiency of the master node's resources.
[0235] Referring to Figure 14, this application embodiment provides a tenant management device 1400. The device 1400 is deployed in a database system, which can be the database system shown in Figure 1 or Figure 2, or the database system used in method 300 shown in Figure 3, method 500 shown in Figure 5, method 800 shown in Figure 8, method 1200 shown in Figure 12, or method 1300 shown in Figure 13. The database system includes a primary node and at least one first standby node. The device 1400 includes:
[0236] The receiving unit 1401 is used to receive a creation request, which includes the target resource quantity required by the tenant to be created and the tenant's business attribute information.
[0237] Processing unit 1402 is used to obtain a first value based on the business attribute information. The first value is the minimum amount of resources that the tenant needs to occupy on the master node. The first value is less than or equal to the target amount of resources.
[0238] The processing unit 1402 is also configured to create a tenant based on a first value, wherein the resources occupied by the tenant include a first resource on the master node and a second resource on at least one first backup node, the quantity of the first resource is greater than or equal to the first value and less than or equal to the target resource quantity, and the quantity of the second resource is determined based on the difference between the target resource quantity and the first resource quantity.
[0239] Optionally, the detailed implementation process of receiving the creation request by the receiving unit 1401 is described in step 301 of method 300 shown in Figure 3, and will not be described in detail here.
[0240] Optionally, the detailed implementation process of the processing unit 1402 obtaining the first value based on the business attribute information is shown in step 302 of method 300 in Figure 3, and will not be described in detail here.
[0241] Optionally, the detailed implementation process of the processing unit 1402 creating a tenant based on the first value can be found in step 303 of method 300 shown in Figure 3, and will not be described in detail here.
[0242] Optionally, the processing unit 1402 is also used for:
[0243] The second value is obtained based on business attribute information. The second value is the maximum amount of resources that the tenant needs to occupy on the master node. The second value is greater than or equal to the first value and less than or equal to the target amount of resources.
[0244] Tenants are created based on the first and second values, where the quantity of the first resource is less than or equal to the second value.
[0245] Optionally, the detailed implementation process of the processing unit 1402 obtaining the second value based on the business attribute information is shown in step 302 of method 300 in Figure 3, and will not be described in detail here.
[0246] Optionally, the detailed implementation process of the processing unit 1402 creating a tenant based on the first and second values can be found in step 303 of method 300 shown in Figure 3, and will not be described in detail here.
[0247] Optionally, the processing unit 1402 is also used for:
[0248] Obtain the first utilization rate of the first resource used by the tenant;
[0249] When the first utilization rate is less than a first threshold, a first amount of resources are reduced from the first resources, and the reduced amount of the first resources is greater than or equal to a first value; and,
[0250] Add at least the first amount of resources to the second resource.
[0251] Optionally, the detailed implementation process of the processing unit 1402 obtaining the first utilization rate of the first resource by the tenant is described in step 501 of the method 500 shown in Figure 5, and will not be described in detail here.
[0252] Optionally, the detailed implementation process of the processing unit 1402 reducing the first number of resources from the first resources can be found in step 503 of the method 500 shown in Figure 5, and will not be described in detail here.
[0253] Optionally, the detailed implementation process of the processing unit 1402 adding at least a first number of resources to the second resource is described in step 504 of the method 500 shown in Figure 5, and will not be described in detail here.
[0254] Optionally, the processing unit 1402 is also used for:
[0255] Obtain the first utilization rate of the first resource used by the tenant and the second utilization rate of the second resource used by the tenant;
[0256] When the first utilization rate is greater than the second threshold and the second utilization rate is less than the first utilization rate, a second amount of resources is added to the first resource, wherein the increased amount of the first resource is less than or equal to the target resource amount; and
[0257] Reduce the amount of resources from the second resource by a maximum of the second amount.
[0258] Optionally, the detailed implementation process of the processing unit 1402 obtaining the first utilization rate of the first resource and the second utilization rate of the second resource by the tenant is described in step 501 of the method 500 shown in Figure 5, and will not be described in detail here.
[0259] Optionally, the detailed implementation process of the processing unit 1402 adding a second number of resources to the first resource is described in step 506 of method 500 shown in Figure 5, and will not be described in detail here.
[0260] Optionally, the detailed implementation process of the processing unit 1402 reducing the resources from the second resources to a maximum of a second number is described in step 507 of the method 500 shown in Figure 5, and will not be described in detail here.
[0261] Optionally, the database system also includes a second standby node, processing unit 1402, which is further used for:
[0262] Get the first load size of the master node and the second load size of the tenant on the master node;
[0263] If the first load exceeds the first load threshold and the second load exceeds the second load threshold, a third amount of resources will be allocated to the tenant in the second standby node.
[0264] Reduce the third amount of resources from the first resource, and the amount of the first resource after the reduction is greater than or equal to the first value.
[0265] Optionally, the detailed implementation process of the processing unit 1402 obtaining the first load size of the master node and the second load size of the tenant on the master node is described in step 801 of method 800 shown in Figure 8, and will not be described in detail here.
[0266] Optionally, the detailed implementation process of the processing unit 1402 allocating a third number of resources to the tenant in the second standby node is described in step 802 of method 800 shown in Figure 8, and will not be described in detail here.
[0267] Optionally, the detailed implementation process of the processing unit 1402 reducing the third number of resources from the first resources can be found in step 803 of method 800 shown in Figure 8, and will not be described in detail here.
[0268] Optionally, the database system also includes a second standby node, processing unit 1402, which is further used for:
[0269] For each first backup node, obtain the third load size of the first backup node and the fourth load size of the tenant on the first backup node;
[0270] If the third load exceeds the first load threshold and the fourth load exceeds the second load threshold, allocate a fourth amount of resources to the tenant in the second standby node;
[0271] Reduce the fourth amount of resources from the resources occupied by the tenant in the first standby node.
[0272] Optionally, the detailed implementation process of the processing unit 1402 obtaining the third load size of the first backup node and the fourth load size of the tenant on the first backup node can be found in step 811 of method 800 shown in Figure 8, and will not be described in detail here.
[0273] Optionally, the detailed implementation process of the processing unit 1402 allocating a fourth number of resources to the tenant in the second standby node is described in step 812 of method 800 shown in Figure 8, and will not be described in detail here.
[0274] Optionally, the detailed implementation process of the processing unit 1402 reducing the fourth number of resources from the resources occupied by the tenant in the first standby node is described in step 813 of method 800 shown in Figure 8, and will not be described in detail here.
[0275] Optionally, if the business attribute information is used to indicate that the tenant only has write business, the first value and the second value are equal to the target resource quantity.
[0276] Optionally, if the business attribute information is used to indicate that the tenant only has read services, both the first and second values are equal to 0.
[0277] Optionally, when the business attribute information is used to indicate that the tenant's business includes write business and read business, and the proportion of write business is greater than the proportion of read business, the first value is equal to the product between the target resource quantity and the first proportion, the second value is equal to the target resource quantity, and the first proportion is less than 1.
[0278] Optionally, when the business attribute information is used to indicate that the tenant's business includes write business and read business, and the proportion of read business is greater than the proportion of write business, the first value is equal to 0, the second value is equal to the product between the target resource quantity and the second proportion, and the second proportion is less than 1.
[0279] Optionally, when the business attribute information is used to indicate that the tenant's business includes write business and read business, and the relationship between the proportion of write business and the proportion of read business is arbitrary, the first value is equal to 0, and the second value is equal to the target resource quantity.
[0280] Both the receiving unit 1401 and the processing unit 1402 can be implemented in software or in hardware. For example, the implementation of the processing unit 1402 will be described below. Similarly, the implementation of the receiving unit 1401 can be referenced to the implementation of the processing unit 1402.
[0281] As an example of a software functional unit, processing unit 1402 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the aforementioned computing instance may be one or more. For example, processing unit 1402 may include code running on multiple hosts / virtual machines / containers. The multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.
[0282] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0283] As an example of a hardware functional unit, the processing unit 1402 may include at least one computing device, such as a server. Alternatively, the processing unit 1402 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.
[0284] The processing unit 1402 includes multiple computing devices that can be distributed in the same region or in different regions. Similarly, the processing unit 1402 can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the processing unit 1402 can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0285] It should be noted that, in other embodiments, the processing unit 1402 can be used to execute any step in the method for managing tenants, and the receiving unit 1401 can be used to execute any step in the method for managing tenants. The steps implemented by the processing unit 1402 and the receiving unit 1401 can be specified as needed. By implementing different steps in the method for managing tenants through the processing unit 1402 and the receiving unit 1401, all functions of the device 1400 for managing tenants can be realized.
[0286] In this embodiment, the processing unit obtains a first value based on the business attribute information of the tenant to be created. The first value is the minimum amount of resources the tenant needs to occupy on the master node. Thus, as long as the number of idle resources on the master node is greater than or equal to the first value, resources can be allocated to the tenant to be created from the idle resources of the master node. If the allocated resources are less than the target resource quantity, resources from at least one first backup node are used to make up for the resources needed by the tenant. Therefore, there are fewer constraints when allocating resources during tenant creation, improving the flexibility of resource allocation and / or control over tenants.
[0287] Referring to Figure 15, this application embodiment provides a computing device 1500. For example, the computing device 1500 may be a node in the database system shown in Figure 1 or Figure 2, or it may be a node in the database system in method 300 shown in Figure 3, method 500 shown in Figure 5, method 800 shown in Figure 8, method 1200 shown in Figure 12, or method 1300 shown in Figure 13.
[0288] As shown in Figure 15, the computing device 1500 includes a bus 1502, a processor 1504, a memory 1506, and a communication interface 1508. The processor 1504, the memory 1506, and the communication interface 1508 communicate with each other via the bus 1502. The computing device 1500 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 1500.
[0289] Bus 1502 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one line is used in Figure 15, but this does not imply that there is only one bus or one type of bus. Bus 1502 can include pathways for transmitting information between various components of computing device 1500 (e.g., processor 1504, memory 1506, communication interface 1508).
[0290] Processor 1504 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0291] Memory 1506 may include volatile memory, such as random access memory (RAM). Memory 1506 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0292] Referring to Figure 15, the memory 1506 stores executable program code. The processor 1504 executes this executable program code to implement the functions of the receiving unit 1401 and the processing unit 1402 in the device 1400 shown in Figure 14, thereby implementing the method provided in any of the above embodiments. That is, the memory 1506 stores instructions for executing the method provided in any of the above embodiments. Alternatively,
[0293] The communication interface 1508 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 1500 and other devices or communication networks.
[0294] This application also provides a cluster for managing tenants. The cluster includes at least one computing device. This computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a desktop computer, a laptop computer, or a smartphone, or other terminal device.
[0295] As shown in Figure 16, the cluster of management tenants includes at least one computing device 1500. The memory 1506 of one or more computing devices 1500 in the cluster of management tenants may store the same instructions for performing the management tenant methods provided in any of the above embodiments.
[0296] In some possible implementations, the memory 1506 of one or more computing devices 1500 in the cluster of the management tenant may also store partial instructions for executing the methods of the management tenant described above. In other words, a combination of one or more computing devices 1500 can jointly execute instructions for performing the methods provided in any of the above embodiments.
[0297] The memory 1506 in different computing devices 1500 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the tenant management device 1400 as shown in FIG. 14. That is, the instructions stored in the memory 1506 of different computing devices 1500 can implement the functions of one or more units among the receiving unit 1401 and the processing unit 1402.
[0298] In some possible implementations, one or more computing devices in the cluster of the management tenant can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 17 illustrates one possible implementation. As shown in Figure 17, two computing devices, 1500A and 1500B, are connected via a network. Specifically, they are connected to the network through the communication interfaces in each computing device.
[0299] In this type of possible implementation, the memory 1506 in computing device 1500A stores instructions for performing the functions of processing unit 1402 in the embodiment shown in FIG. 14. Meanwhile, the memory 1506 in computing device 1500B stores instructions for performing the functions of receiving unit 1401 in the embodiment shown in FIG. 14.
[0300] The connection method between the computing device clusters shown in Figure 17 can be considered in light of the needs of the management tenant method provided in this application, therefore, the functions implemented by the receiving unit 1401 are considered to be executed by the computing device 1500B.
[0301] It should be understood that the functions of computing device 1500A shown in Figure 17 can also be performed by multiple computing devices 1500. Similarly, the functions of computing device 1500B can also be performed by multiple computing devices 1500.
[0302] This application also provides another management tenant cluster. The connection relationship between the computing devices in this management tenant cluster can be similar to the connection method of the management tenant cluster described in FIG17. The difference is that the memory 1506 in one or more computing devices 1500 in this management tenant cluster can store the same instructions for executing the management tenant method provided in any of the above embodiments.
[0303] In some possible implementations, the memory 1506 of one or more computing devices 1500 in the cluster of the management tenant may also store partial instructions for executing the methods provided in any of the above embodiments. In other words, a combination of one or more computing devices 1500 can jointly execute instructions for executing the methods provided in any of the above embodiments.
[0304] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the methods provided in any of the above embodiments.
[0305] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct a computing device to perform the method provided in any of the above embodiments.
[0306] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0307] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for managing tenants, characterized in that, The method is applied to a database system, the database system including a master node and at least one first standby node, the method comprising: Receive a creation request, which includes the target number of resources required by the tenant to be created and the business attribute information of the tenant; A first value is obtained based on the business attribute information. The first value is the minimum amount of resources that the tenant needs to occupy on the master node. The first value is less than or equal to the target amount of resources. A tenant is created based on the first value. The resources occupied by the tenant include the first resources on the primary node and the second resources on the at least one first backup node. The quantity of the first resources is greater than or equal to the first value and less than or equal to the target resource quantity. The quantity of the second resources is determined based on the difference between the target resource quantity and the first resource quantity.
2. The method as described in claim 1, characterized in that, The method further includes: A second value is obtained based on the business attribute information. The second value is the maximum amount of resources that the tenant needs to occupy on the master node. The second value is greater than or equal to the first value and less than or equal to the target amount of resources. Creating a tenant based on the first value includes: The tenant is created based on the first value and the second value, wherein the quantity of the first resource is less than or equal to the second value.
3. The method as described in claim 1 or 2, characterized in that, The method further includes: Obtain the first utilization rate of the first resource used by the tenant; When the first utilization rate is less than a first threshold, a first number of resources are reduced from the first resources, and the reduced number of the first resources is greater than or equal to the first value; and Add at least the first number of resources to the second resource.
4. The method as described in claim 1 or 2, characterized in that, The method further includes: Obtain the first utilization rate of the tenant using the first resource and the second utilization rate of the tenant using the second resource; When the first utilization rate is greater than the second threshold and the second utilization rate is less than the first utilization rate, a second amount of resources is added to the first resource, wherein the increased amount of the first resource is less than or equal to the target resource amount; and Reduce the resources from the second resource to a maximum of the second quantity.
5. The method according to any one of claims 1-4, characterized in that, The database system further includes a second backup node, and the method further includes: Obtain the first load size of the master node and the second load size of the tenant on the master node; If the first load exceeds the first load threshold and the second load exceeds the second load threshold, a third amount of resources shall be allocated to the tenant in the second backup node; The third amount of resources is reduced from the first resources, and the reduced amount of the first resources is greater than or equal to the first value.
6. The method according to any one of claims 1-4, characterized in that, The database system further includes a second backup node, and the method further includes: For each first backup node, obtain the third load size of the first backup node and the fourth load size of the tenant on the first backup node; If the third load exceeds the first load threshold and the fourth load exceeds the second load threshold, a fourth amount of resources will be allocated to the tenant in the second backup node; The fourth amount of resources is reduced from the resources occupied by the tenant in the first backup node.
7. The method according to any one of claims 2-6, characterized in that, When the business attribute information is used to indicate that the tenant only has write business, the first value and the second value are equal to the target resource quantity.
8. The method according to any one of claims 2-6, characterized in that, When the business attribute information is used to indicate that the tenant only has read services, both the first value and the second value are equal to 0.
9. The method according to any one of claims 2-6, characterized in that, When the business attribute information indicates that the tenant's business includes write business and read business, and the proportion of write business is greater than the proportion of read business, the first value is equal to the product between the target resource quantity and the first proportion, the second value is equal to the target resource quantity, and the first proportion is less than 1.
10. The method according to any one of claims 2-6, characterized in that, When the business attribute information indicates that the tenant's business includes write business and read business, and the proportion of read business is greater than the proportion of write business, the first value is equal to 0, the second value is equal to the product of the target resource quantity and the second proportion, and the second proportion is less than 1.
11. The method according to any one of claims 2-6, characterized in that, When the business attribute information indicates that the tenant's business includes write business and read business, and the relationship between the proportion of write business and the proportion of read business is arbitrary, the first value is equal to 0, and the second value is equal to the target resource quantity.
12. An apparatus for managing tenants, characterized in that, The device is deployed in a database system, the database system including a master node and at least one first standby node, and the device includes: A receiving unit is used to receive a creation request, the creation request including the target number of resources required by the tenant to be created and the business attribute information of the tenant; The processing unit is configured to obtain a first value based on the business attribute information, wherein the first value is the minimum amount of resources that the tenant needs to occupy on the master node, and the first value is less than or equal to the target amount of resources. The processing unit is further configured to create a tenant based on the first value, wherein the resources occupied by the tenant include first resources on the master node and second resources on the at least one first backup node, the quantity of the first resources is greater than or equal to the first value and less than or equal to the target resource quantity, and the quantity of the second resources is determined based on the difference between the target resource quantity and the first resource quantity.
13. The apparatus as claimed in claim 12, characterized in that, The processing unit is further configured to: A second value is obtained based on the business attribute information. The second value is the maximum amount of resources that the tenant needs to occupy on the master node. The second value is greater than or equal to the first value and less than or equal to the target amount of resources. The tenant is created based on the first value and the second value, wherein the quantity of the first resource is less than or equal to the second value.
14. The apparatus as claimed in claim 12 or 13, characterized in that, The processing unit is further configured to: Obtain the first utilization rate of the first resource used by the tenant; When the first utilization rate is less than a first threshold, a first number of resources are reduced from the first resources, and the reduced number of the first resources is greater than or equal to the first value; and Add at least the first number of resources to the second resource.
15. The apparatus as claimed in claim 12 or 13, characterized in that, The processing unit is further configured to: Obtain the first utilization rate of the tenant using the first resource and the second utilization rate of the tenant using the second resource; When the first utilization rate is greater than the second threshold and the second utilization rate is less than the first utilization rate, a second amount of resources is added to the first resource, wherein the increased amount of the first resource is less than or equal to the target resource amount; and Reduce the resources from the second resource to a maximum of the second quantity.
16. The apparatus according to any one of claims 12-15, characterized in that, The database system further includes a second backup node, and the processing unit is further configured to: Obtain the first load size of the master node and the second load size of the tenant on the master node; If the first load exceeds the first load threshold and the second load exceeds the second load threshold, a third amount of resources shall be allocated to the tenant in the second backup node; The third amount of resources is reduced from the first resources, and the reduced amount of the first resources is greater than or equal to the first value.
17. The apparatus according to any one of claims 12-15, characterized in that, The database system further includes a second backup node, and the processing unit is further configured to: For each first backup node, obtain the third load size of the first backup node and the fourth load size of the tenant on the first backup node; If the third load exceeds the first load threshold and the fourth load exceeds the second load threshold, a fourth amount of resources will be allocated to the tenant in the second backup node; The fourth amount of resources is reduced from the resources occupied by the tenant in the first backup node.
18. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1-11.
19. A computer-readable storage medium, characterized in that, Includes computer program instructions, which, when executed by a cluster of computing devices, perform the method as described in any one of claims 1-11.
20. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster performs the method as described in any one of claims 1-11.
Citation Information
Patent Citations
Tenant-oriented server cluster resource quota adjustment method, device and equipment
CN115981852A
Resource division method and device
CN117216028A
Method for allocating resources in a multi-tenant cloud computing platform
EP4227804A1
Tenant fairness in a multi-tenant environment
US20220326995A1
Predictable and adaptive quality of service for storage
US20230168934A1