Resource isolation method and apparatus, and computing device cluster
By dynamically adjusting the number of threads and resource allocation for tenants, the problem of resource idleness and waste in traditional database systems is solved, achieving more efficient resource utilization and processing capabilities.
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
Traditional database systems are prone to resource idleness and waste in multi-tenant environments, resulting in low resource utilization. Existing technologies use the Cgroups low-risk mechanism to adjust resource allocation when resources are scarce, but this cannot be effectively triggered in some cases, leading to resource scarcity or idleness.
By dynamically adjusting the number of threads for tenants, resources are fully utilized based on their usage and type, avoiding resource shortages or idleness. The resource management module and thread management module monitor and adjust the allocation of computing resources for tenants in real time.
It improves the utilization of computing resources, ensures that each tenant can make full use of resources, avoids resource waste, and enhances the processing power and reliability of the database system.
Smart Images

Figure CN2025098935_07052026_PF_FP_ABST
Abstract
Description
A resource isolation method, apparatus, and computing device cluster
[0001] This application claims priority to Chinese Patent Application No. 202411523769.1, filed on October 29, 2024, entitled “A Resource Isolation Method, Apparatus and Computing Device Cluster”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This invention relates to the field of cloud computing technology, and in particular to a resource isolation method, apparatus, and computing device cluster. Background Technology
[0003] A database system is a system composed of a database and its management software. It handles various data operation requests sent by users and returns the results. In commercial scenarios, database systems are typically offered to users on a rental basis. That is, users become tenants of the database system through a rental agreement and have access to operate the database system during the rental period. Traditional database systems usually serve only a single tenant, which can easily lead to idle resources and waste. Therefore, current database systems tend to allow multi-tenant sharing, meaning multiple tenants can access the same database system simultaneously, thereby improving resource utilization and reducing costs for database system providers. Summary of the Invention
[0004] This application provides a resource isolation method in its embodiments, which can dynamically adjust the computing resource usage of each tenant, allowing each tenant to make full use of computing resources. In addition, this application also provides a resource isolation device and a computing device cluster corresponding to this resource isolation method.
[0005] Therefore, the following technical solutions are adopted in the embodiments of this application:
[0006] In a first aspect, this application provides a resource isolation method applied to a resource isolation system, the resource isolation system including at least one processor, the method comprising: obtaining the computing resource usage of each tenant among multiple tenants; obtaining the total computing resource usage of the multiple tenants based on the computing resource usage of each tenant; and, if the total computing resource usage of the multiple tenants is less than a first lower limit resource threshold, increasing the number of threads of the multiple tenants or keeping the number of threads of the multiple tenants unchanged; the threads of the multiple tenants are used to call the computing resources of the at least one processor.
[0007] In this implementation, the method can continuously obtain the computing resource usage of different tenants. Based on the computing resource usage of the tenants, the number of threads called by different tenants can be dynamically adjusted to adjust the computing resource usage of different tenants, thereby enabling multiple tenants to fully utilize the computing resources in the system and improve the utilization rate of the processor's computing resources.
[0008] Compared to other technologies that detect idle values, this method does not require triggering a minimum resource protection mechanism. Instead, it dynamically adjusts the computing resource usage of each tenant based on their individual usage, allowing each tenant to make full use of computing resources.
[0009] In one implementation, the step of increasing the number of threads in the multiple tenants or keeping the number of threads in the multiple tenants unchanged when the total computing resource usage of the multiple tenants is less than a first lower limit resource threshold specifically includes: when the total computing resource usage of the multiple tenants is less than the first lower limit resource threshold, detecting whether the computing resource usage of each tenant in the multiple tenants is less than the configured computing resource amount of the corresponding tenant; when the computing resource usage of the first tenant is less than the configured computing resource amount of the first tenant, increasing the number of threads in the first tenant; the multiple tenants include the first tenant; when the computing resource usage of the first tenant is greater than or equal to the configured computing resource amount of the first tenant, keeping the number of threads in the first tenant unchanged.
[0010] In this implementation, if the total usage of computing resources by multiple tenants is less than the first lower limit resource threshold, it indicates that the computing resources used by multiple tenants are relatively small. Therefore, the number of threads configured for multiple tenants can be increased to allow multiple tenants to use more computing resources, thereby improving the work efficiency of multiple tenants.
[0011] In one implementation, before increasing the number of threads of the multiple tenants or keeping the number of threads of the multiple tenants unchanged when the total usage of computing resources of the multiple tenants is less than a first lower limit resource threshold, the method further includes: detecting whether there is an exclusive tenant among the multiple tenants, the exclusive tenant being a tenant that uses dedicated computing resources in the at least one processor; if there is no exclusive tenant among the multiple tenants, determining an idle thread that calls the idle computing resources of the at least one processor; and allocating the idle thread to the multiple tenants.
[0012] In one implementation, before increasing the number of threads in the multiple tenants or keeping the number of threads in the multiple tenants unchanged when the total usage of computing resources in the multiple tenants is less than a first lower limit resource threshold, the method further includes: detecting whether there is an exclusive tenant among the multiple tenants, wherein an exclusive tenant refers to a tenant that uses dedicated computing resources in the at least one processor; if there is no exclusive tenant among the multiple tenants, obtaining the idle amount of computing resources of the at least one processor based on the total usage of computing resources in the multiple tenants and the total amount of computing resources of the at least one processor; obtaining an idle thread that calls the idle amount of computing resources of the at least one processor based on the amount of computing resources called by a single thread and the idle amount of computing resources of the at least one processor; and allocating the idle thread to the multiple tenants.
[0013] In this embodiment, when there are no exclusive tenants among the multiple tenants, the method calculates the number of idle threads and then allocates the idle threads to the multiple tenants according to the set rules, so that the computing resources in the idle state can serve all the shared tenants, thereby reducing the stress on shared tenants' use of computing resources and improving the utilization rate of computing resources.
[0014] In one embodiment, the method further includes: if the total usage of computing resources of the plurality of tenants is greater than or equal to the first lower limit resource threshold, detecting whether the total usage of computing resources of the plurality of tenants is greater than the first upper limit resource threshold; if the total usage of computing resources of the plurality of tenants is less than or equal to the first upper limit resource threshold, keeping the number of threads of the plurality of tenants unchanged; if the total usage of computing resources of the plurality of tenants is greater than the first upper limit resource threshold, reducing the number of threads of the plurality of tenants or keeping the number of threads of the plurality of tenants unchanged.
[0015] In this implementation, if the configured computing resources of a dedicated tenant are less than or equal to the tenant's usage, it indicates that this tenant is fully utilizing the computing resources, and there is no need to increase the number of threads configured for this tenant. If the configured computing resources of a dedicated tenant are greater than the tenant's usage, it indicates that this tenant is not fully utilizing the computing resources, and the number of threads configured for this tenant can be increased, allowing this tenant to use more computing resources and improve the tenant's work efficiency.
[0016] In one implementation, the step of reducing the number of threads in the multiple tenants or keeping the number of threads in the multiple tenants unchanged when the total usage of computing resources in the multiple tenants exceeds the first upper limit resource threshold specifically includes: when the total usage of computing resources in the multiple tenants exceeds the first upper limit resource threshold, detecting whether the usage of computing resources of each tenant in the multiple tenants exceeds the configured amount of computing resources of the corresponding tenant; when the usage of computing resources of a second tenant exceeds the configured amount of computing resources of the second tenant, reducing the number of threads in the second tenant; the multiple tenants include the second tenant; when the usage of computing resources of the second tenant is less than or equal to the configured amount of computing resources of the second tenant, keeping the number of threads in the second tenant unchanged.
[0017] In this implementation, if the amount of computing resources configured for a dedicated tenant is greater than or equal to the amount of computing resources used by that tenant, it means that the total computing resources are already insufficient even if the configured amount of computing resources for this part of the dedicated tenant is not fully utilized. Therefore, it is not necessary to reduce the number of threads for this part of the tenant, so as to avoid further increasing the number of tenants that the database system cannot serve, thereby reducing the reliability of the product.
[0018] This method addresses situations where the allocated computing resources for a dedicated tenant are less than its actual usage, indicating that these tenants are overutilizing their allocated resources and causing overall resource shortages. Reducing the number of threads for these dedicated tenants helps prevent resource strain and minimizes the number of tenants the database system cannot serve, thereby improving product reliability.
[0019] In one embodiment, the method further includes: determining that the threads of the third tenant have completed the adjustment; the plurality of tenants includes the third tenant, and the third tenant includes multiple users; detecting whether the total usage of computing resources of the plurality of users is less than a second lower limit resource threshold; if the total usage of computing resources of the plurality of users is less than the second lower limit resource threshold, increasing the number of threads of the plurality of users or keeping the number of threads of the plurality of users unchanged.
[0020] In this implementation, the method can continuously obtain the computing resource usage of different users, and then dynamically adjust the number of threads called by different users based on the computing resource usage of the tenant and the computing resource usage of multiple users within the tenant, so as to adjust the computing resource usage of different users, thereby enabling multiple users within multiple tenants to fully utilize the computing resources in the system, thereby improving the utilization rate of the processor's computing resources.
[0021] In one implementation, the step of increasing the number of threads for the multiple users or keeping the number of threads for the multiple users unchanged when the total computing resource usage of the multiple users is less than the second lower limit resource threshold specifically includes: when the total computing resource usage of the multiple users is less than the second lower limit resource threshold, detecting whether the computing resource usage of each user among the multiple users is less than the corresponding user's configured computing resource amount; when the computing resource usage of the first user is less than the first user's configured computing resource amount, increasing the number of threads for the first user; the multiple users include the first user; when the computing resource usage of the first user is greater than or equal to the first user's configured computing resource amount, keeping the number of threads for the first user unchanged.
[0022] In this implementation, if a user's allocated computing resources are less than or equal to their actual usage, it indicates that the user is fully utilizing the computing resources, and the number of threads for these users does not need to be increased. Conversely, if a user's allocated computing resources exceed their actual usage, it indicates that the user is not fully utilizing the tenant's computing resources, and the number of threads for these users can be increased to allow them to use more computing resources and improve their work efficiency.
[0023] In one embodiment, the method further includes: if the total computing resource usage of the plurality of users is greater than or equal to the second lower limit resource threshold, detecting whether the total computing resource usage of the plurality of users is greater than the second upper limit resource threshold; if the total computing resource usage of the plurality of users is less than or equal to the second upper limit resource threshold, keeping the number of threads of the plurality of users unchanged; if the total computing resource usage of the plurality of users is greater than the second upper limit resource threshold, reducing the number of threads of the plurality of users or keeping the number of threads of the plurality of users unchanged.
[0024] In this implementation, if the computing resources of multiple users within the adjusted tenant are between the second lower resource threshold and the second upper resource threshold, it indicates that the users within the adjusted tenant are fully utilizing the computing resources, and there is no need to increase or decrease the number of threads for the users within the tenant. If the computing resources of multiple users within the adjusted tenant are greater than the second upper resource threshold, it indicates that the users within the adjusted tenant are using a relatively large amount of computing resources, and the number of threads for the users within the tenant can be reduced. This allows the users within the tenant to reduce their use of computing resources, avoiding computing resource strain that could prevent the database system from serving the users within the tenant.
[0025] In one implementation, the step of reducing the number of threads of the multiple users or keeping the number of threads of the multiple users unchanged when the total computing resource usage of the multiple users exceeds the second upper limit resource threshold specifically includes: when the total computing resource usage of the multiple users exceeds the second upper limit resource threshold, detecting whether the computing resource usage of each user among the multiple users exceeds the corresponding user's configured computing resource limit; when the computing resource usage of a second user exceeds the second user's configured computing resource limit, reducing the number of threads of the second user; the multiple users include the second user; when the computing resource usage of the second user is less than or equal to the second user's configured computing resource limit, keeping the number of threads of the second user unchanged.
[0026] In this implementation, if a user's allocated computing resources are greater than or equal to their actual usage, it indicates that the overall computing resources are insufficient even when these users are not fully utilizing their allocated resources. Therefore, it's not necessary to reduce the number of threads for these users, thus avoiding further increasing the number of users the database system cannot serve and reducing product reliability. Conversely, if a user's allocated computing resources are less than their actual usage, it indicates that these users are overusing their allocated resources, causing overall computing resource insufficiency. In this case, the number of threads for these users can be reduced. This method of reducing the number of threads for these users avoids computing resource strain, reducing the number of users the database system cannot serve, thereby improving product reliability.
[0027] Secondly, this application provides a resource isolation device, comprising: a resource management module for obtaining the computing resource usage of each tenant among multiple tenants; a thread management module for obtaining the total computing resource usage of the multiple tenants based on the computing resource usage of each tenant; and, if the total computing resource usage of the multiple tenants is less than a first lower limit resource threshold, increasing the number of threads of the multiple tenants or keeping the number of threads of the multiple tenants unchanged; the threads of the multiple tenants are used to call the computing resources of the at least one processor.
[0028] In one implementation, the thread management module is specifically configured to: detect whether the computing resource usage of each tenant among the multiple tenants is less than the configured computing resource amount of the corresponding tenant when the total computing resource usage of the multiple tenants is less than the first lower limit resource threshold; increase the number of threads of the first tenant when the computing resource usage of the first tenant is less than the configured computing resource amount of the first tenant; the multiple tenants include the first tenant; and keep the number of threads of the first tenant unchanged when the computing resource usage of the first tenant is greater than or equal to the configured computing resource amount of the first tenant.
[0029] In one implementation, before the thread management module increases the number of threads of the multiple tenants or keeps the number of threads of the multiple tenants unchanged when the total usage of computing resources of the multiple tenants is less than a first lower limit resource threshold, it is further configured to detect whether there is an exclusive tenant among the multiple tenants, wherein the exclusive tenant refers to a tenant that uses dedicated computing resources in the at least one processor; if there is no exclusive tenant among the multiple tenants, it determines an idle thread that calls the idle computing resources of the at least one processor; and allocates the idle thread to the multiple tenants.
[0030] In one implementation, before the thread management module increases the number of threads of the multiple tenants or keeps the number of threads of the multiple tenants unchanged when the total usage of computing resources of the multiple tenants is less than a first lower limit resource threshold, it is further configured to detect whether there is an exclusive tenant among the multiple tenants, wherein the exclusive tenant refers to a tenant that uses dedicated computing resources in the at least one processor; if there is no exclusive tenant among the multiple tenants, it determines an idle thread that calls the idle computing resources of the at least one processor; and allocates the idle thread to the multiple tenants.
[0031] In one embodiment, the thread management module is further configured to: detect whether the total computing resource usage of the multiple tenants is greater than a first upper limit resource threshold when the total computing resource usage of the multiple tenants is greater than or equal to the first lower limit resource threshold; keep the number of threads of the multiple tenants unchanged when the total computing resource usage of the multiple tenants is less than or equal to the first upper limit resource threshold; and reduce the number of threads of the multiple tenants or keep the number of threads of the multiple tenants unchanged when the total computing resource usage of the multiple tenants is greater than the first upper limit resource threshold.
[0032] In one implementation, the thread management module is specifically configured to: detect whether the computing resource usage of each of the multiple tenants is greater than the configured computing resource amount of the corresponding tenant when the total computing resource usage of the multiple tenants is greater than the first upper limit resource threshold; reduce the number of threads of the second tenant when the computing resource usage of the second tenant is greater than the configured computing resource amount of the second tenant; the multiple tenants include the second tenant; and keep the number of threads of the second tenant unchanged when the computing resource usage of the second tenant is less than or equal to the configured computing resource amount of the second tenant.
[0033] In one implementation, the thread management module is further configured to determine that the threads of the third tenant have completed the adjustment; the multiple tenants include the third tenant, and the third tenant includes multiple users; detect whether the total usage of computing resources of the multiple users is less than a second lower limit resource threshold; if the total usage of computing resources of the multiple users is less than the second lower limit resource threshold, increase the number of threads of the multiple users or keep the number of threads of the multiple users unchanged.
[0034] In one implementation, the thread management module is specifically configured to: detect whether the computing resource usage of each of the multiple users is less than the configured computing resource amount of the corresponding user when the total computing resource usage of the multiple users is less than the second lower limit resource threshold; increase the number of threads of the first user when the computing resource usage of the first user is less than the configured computing resource amount of the first user; the multiple users include the first user; and keep the number of threads of the first user unchanged when the computing resource usage of the first user is greater than or equal to the configured computing resource amount of the first user.
[0035] In one embodiment, the thread management module is further configured to: detect whether the total computing resource usage of the multiple users is greater than a second upper limit resource threshold when the total computing resource usage of the multiple users is greater than or equal to the second lower limit resource threshold; keep the number of threads of the multiple users unchanged when the total computing resource usage of the multiple users is less than or equal to the second upper limit resource threshold; and reduce the number of threads of the multiple users or keep the number of threads of the multiple users unchanged when the total computing resource usage of the multiple users is greater than the second upper limit resource threshold.
[0036] In one implementation, the thread management module is specifically configured to: detect whether the computing resource usage of each of the multiple users exceeds the configured computing resource amount when the total computing resource usage of the multiple users exceeds the second upper limit resource threshold; reduce the number of threads of the second user when the computing resource usage of the second user exceeds the configured computing resource amount of the second user; the multiple users include the second user; and keep the number of threads of the second user unchanged when the computing resource usage of the second user is less than or equal to the configured computing resource amount of the second user.
[0037] Thirdly, embodiments of this application provide a computing device, including: at least one memory; and at least one processor, the processor being configured to execute instructions stored in the memory to cause the computing device to perform the various possible implementations of the first aspect.
[0038] Fourthly, embodiments of this application provide a computer-readable storage medium including computer program instructions, which, when executed by a computing device, perform the various possible implementations of the first aspect.
[0039] Fifthly, this application provides a computer program product containing instructions, characterized in that the computer program product stores instructions that, when executed by a computing device, cause the computing device to implement various possible implementations of the first aspect.
[0040] In a sixth aspect, embodiments of this application provide a 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 configured to execute instructions stored in the memory of the at least one computing device, such that the computing device cluster performs the various possible implementations of the first aspect.
[0041] In a seventh aspect, embodiments of this application provide a computer-readable storage medium including computer program instructions that, when executed by a cluster of computing devices, perform the various possible implementations of the first aspect.
[0042] Eighthly, this application provides a computer program product containing instructions, characterized in that the computer program product stores instructions that, when executed by a cluster of computing devices, cause the cluster of computing devices to implement various possible implementations of the first aspect. Attached Figure Description
[0043] The accompanying drawings used in the description of the embodiments or prior art are briefly introduced below.
[0044] Figure 1 is a schematic diagram of the computing resource allocation process provided in related technologies;
[0045] Figure 2 is a schematic diagram of a resource isolation system provided in an embodiment of this application;
[0046] Figure 3(a) is a schematic diagram of the process of Cgroups allocating computing resources to two tenants in the embodiment of this application;
[0047] Figure 3(b) is a schematic diagram of the process of a user calling a thread group through Cgroups in an embodiment of this application;
[0048] Figure 4 is a flowchart illustrating how the thread management module adjusts the number of threads for a tenant, as provided in this embodiment of the application.
[0049] Figure 5 is a flowchart of the thread management module provided in the embodiment of this application for adjusting the number of user threads;
[0050] Figure 6 is a schematic diagram of a user using the resource isolation system provided in the embodiments of this application;
[0051] Figure 7 is a schematic diagram of the structure of a computing device provided in an embodiment of this application;
[0052] Figure 8 is a schematic diagram of the architecture of a computing device cluster provided in an embodiment of this application;
[0053] Figure 9 is a schematic diagram of another computing device cluster architecture provided in the embodiments of this application. Detailed Implementation
[0054] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0055] In this article, the term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.
[0056] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. For example, "first response message" and "second response message," etc., are used to distinguish different response messages, not to describe a specific order of response messages.
[0057] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0058] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple processing units means two or more processing units, multiple elements means two or more elements, etc.
[0059] Before introducing the technical solution protected by this application, several technical terms involved in the technical solution protected by this application will be explained in advance, namely:
[0060] A thread is an execution path within a process that can process tasks in parallel. Within the same process, multiple threads share the process's resources, but each thread has its own independent execution path, stack, and local variables. A process is the basic unit of resource allocation; each process has its own independent memory space, while a thread is the execution unit within a process.
[0061] A thread group is a mechanism for organizing and managing threads, allowing multiple threads to be grouped together and managed and controlled in a unified manner.
[0062] A thread pool is a thread management mechanism used to execute tasks by pre-creating a group of threads. It reuses threads and schedules tasks, thereby improving program concurrency performance and resource utilization. A thread pool is a container. It can contain multiple threads that are pre-created and waiting to execute tasks. Tasks are submitted to the thread pool, and threads in the pool retrieve tasks from the task queue and execute them. Thread pools reduce the overhead of frequent thread creation and destruction by reusing threads.
[0063] Control groups (Cgroups) are a powerful mechanism provided by the Linux kernel for limiting, controlling, and isolating the resource usage of thread groups. Cgroups can organize a group of processes into a control group and manage the resource usage of that group. Cgroups play a crucial role in system performance management, resource isolation, and containerization. When the operating system executes tasks, it can allocate threads from the thread pool to Cgroups, allowing Cgroups to isolate, limit, and monitor resources such as CPU, memory, and input / output (I / O).
[0064] Next, the technical solution provided in this application will be introduced.
[0065] Generally, when a database system serves multiple tenants, resource contention between tenants is inevitable, leading to performance degradation. Therefore, database systems can isolate local resources such as CPU, memory, network input / output (I / O), and disk I / O to avoid resource contention between tenants. Existing database systems such as Oceanbase (OB), Polar Database (PolarDB), and Greenplum can use Cgroups for resource isolation to ensure high performance and stability.
[0066] Taking CPU isolation as an example, Cgroups allows setting two parameters: the maximum CPU resource limit for a tenant (max_cpu) and the minimum CPU resource limit for a tenant (min_cpu). Cgroups leverages the operating system kernel's scheduling mechanism to control the allocation of CPU time slices. Based on each tenant's CPU time quota, Cgroups can allocate CPU time slices to each tenant, achieving resource isolation between multiple tenants and ensuring that different tenants or process groups do not compete for CPU resources.
[0067] When CPU resources are insufficient, Cgroups triggers a throttle mechanism, which can reallocate computing resources to multiple tenants. In other words, Cgroups uses the throttle mechanism to allocate CPU resources according to the minimum resource limit, so that each tenant can still get a certain amount of CPU time when CPU resources are scarce.
[0068] The low-idle CPU utilization mechanism is triggered when the CPU idle value equals 0. That is, Cgroups triggers the low-idle CPU utilization mechanism when it detects that the CPU idle value is 0. However, database system instances are typically deployed as containers, such as multi-container systems (MCS) and Docker. To improve the utilization of physical machines, database systems expand the CPU usage. For example, as shown in Figure 1, the physical machine has 64U 128G CPU resources (i.e., 64 cores and 128G memory). Assume that Company A purchased an 8U 16G instance of this physical machine, Company B purchased an 8U 16G instance of this physical machine, and Company C purchased a 16U 32G instance of this physical machine.
[0069] Under normal circumstances, the physical server will allocate computing resources from cores 0 to 7 to tenants of company A, cores 8 to 15 to tenants of company B, and cores 16 to 31 to tenants of company C. If a tenant of company A fully utilizes the computing resources of 8 cores, the idle value of cores 0 to 7 will be 0. In this case, Cgroups can trigger the low-idleness guarantee mechanism.
[0070] To improve the utilization of physical machine CPU resources, a database system can allocate CPU resources to multiple entities, thus expanding CPU usage. Specifically, the physical machine might allocate 50% of the computing resources from cores 0-15 to company A, the remaining 50% to company B, and cores 16-31 to company C. If tenants A and B within company A fully utilize all 8 cores, a redistribution mechanism is needed to reallocate their computing resources. However, if company A is fully utilizing all 8 cores but only using 50% of cores 0-15, Cgroups cannot trigger the redistribution mechanism.
[0071] In view of this, embodiments of this application provide a resource isolation system that can continuously acquire the computing resource usage of different tenants, and then dynamically adjust the number of threads called by different tenants based on the tenant type and the computing resource usage of different tenants, so as to adjust the computing resource usage of different tenants, thereby enabling multiple tenants to fully utilize the computing resources in the system and improve the utilization rate of processor computing resources.
[0072] Compared to related technologies that detect idle values, this resource isolation system does not require detecting idle values to trigger a minimum resource protection mechanism. Instead, it dynamically adjusts the computing resource usage of each tenant based on their individual usage, allowing each tenant to make full use of computing resources.
[0073] After determining the amount of computing resources each tenant needs to increase or decrease, this resource isolation system can calculate the number of threads that need to be added or removed based on the increased or decreased computing resources. This system can increase or decrease the number of threads for each tenant, thereby increasing or decreasing the computing resources used by each tenant and ensuring effective isolation of computing resources between tenants.
[0074] In addition, this resource isolation system can continuously obtain the computing resource usage of different users, and then dynamically adjust the number of threads called by different users based on the computing resource usage of the tenant and the computing resource usage of multiple users within the tenant, so as to adjust the computing resource usage of different users. This allows multiple users within multiple tenants to fully utilize the computing resources in the system, thereby improving the utilization rate of the processor's computing resources.
[0075] Figure 2 is a schematic diagram of a resource isolation system provided in an embodiment of this application. As shown in Figure 2, the resource isolation system 200 may include a resource management module 210 and a thread management module 220.
[0076] The resource management module 210 is used to obtain the computing resources allocated to multiple tenants at the current time to obtain the computing resource usage of multiple tenants, and to obtain the computing resources allocated to multiple users within multiple tenants at the current time to obtain the computing resource usage of multiple users.
[0077] Computing resources refer to resources where at least one processor executes tasks for multiple tenants or users. Processors can be CPUs, graphics processing units (GPUs), neural processing units (NPUs), etc. When a processor provides services to a tenant or user, the tenant or user can instruct the operating system to automatically call a set number of threads from a thread pool to utilize computing resources to execute their task.
[0078] In one embodiment, Cgroups can control the time slices of processors used by threads to access computing resources. Cgroups allocates different numbers of processor time slices to threads accessing different tenants or users, thus allocating different computing resources to different tenants or users. For example, as shown in Figure 3(a), tenant 1 and tenant 2 jointly use the computing resources of processor 1 and processor 2 through Cgroups. Assume that the utilization rates of the computing resources allocated by Cgroups to tenant 1 and tenant 2 are 80% and 20%, respectively. When Cgroups serves tenant 1 and tenant 2, it can allocate time slices t0, t1, t2, and t3 of processor 1 to tenant 1, and allocate time slice t1 of processor 2 to tenant 2.
[0079] When tenants 1 and 2 execute tasks, during the time interval 0-t0, tenant 1 can use all the resources of processor 1. During the time interval t0-t1, tenant 1 can use all the resources of processor 1, while tenant 2 can use all the resources of processor 2. During the time interval t1-t2, tenant 1 can use all the resources of processor 1. During the time interval t2-t3, tenant 1 can use all the resources of processor 1.
[0080] Tenants can be categorized into shared tenants and dedicated tenants. A shared tenant refers to a tenant that uses shared computing resources. Shared resources are dynamically allocated by the system, and resources are competed for among multiple shared tenants. Resource management for shared tenants is primarily based on adjustments made to the system's remaining resources. In this application, when a shared tenant executes a task, Cgroups accesses the shared resources through threads in the thread group configured for that shared tenant.
[0081] An exclusive tenant refers to a tenant that uses dedicated computing resources. These dedicated computing resources are configured and managed by a user or administrator for a specific tenant based on their needs; other tenants cannot access or use these resources. In this application, when an exclusive tenant executes a task, Cgroups invokes the dedicated resources through threads in the thread group configured for that exclusive tenant.
[0082] In one embodiment, as shown in Figure 3(b), the thread pool corresponding to the processor can manage multiple thread groups, each thread group comprising multiple threads. Each tenant can use at least one configured thread group to allow Cgroups to invoke a portion of the processor's computing resources through multiple threads within that thread group to execute the tenant's tasks. Each user can use at least one configured thread group to allow Cgroups to invoke a portion of the processor's computing resources through multiple threads within that thread group to execute the user's tasks.
[0083] When a shared tenant executes a task, it can invoke a set number of thread groups from the thread pool, allowing Cgroups to access shared resources on the processor through multiple threads within those thread groups. When a dedicated tenant executes a task, it can invoke a set number of thread groups from the thread pool, allowing Cgroups to access dedicated resources on the processor through multiple threads within those thread groups.
[0084] In this embodiment, when allocating computing resources to multiple tenants, the resource management module 210 can collect the computing resources allocated to different tenants at the current moment, and then obtain the utilization ratio of computing resources used by different tenants based on the computing resources allocated to different tenants and the total amount of computing resources. Furthermore, the resource management module 210 can collect the computing resources allocated to different users within different tenants at the current moment, and then obtain the utilization ratio of computing resources used by different users within different tenants based on the computing resources allocated to different users within different tenants and the total amount of computing resources.
[0085] In one embodiment, the resource management module 210 can collect the number of processor time slices allocated to different tenants by Cgroups at the current moment, and then obtain the utilization ratio of computing resources used by different tenants based on the number of processor time slices allocated to different tenants and the total number of time slices of all processors. Alternatively, the resource management module 210 can collect the number of processor time slices allocated to different users within different tenants by Cgroups at the current moment, and then obtain the utilization ratio of computing resources used by different users based on the number of processor time slices allocated to different users within different tenants and the total number of time slices of all processors.
[0086] The thread management module 220 is used to adjust the number of threads for multiple tenants based on the types of multiple tenants and the computing resource usage of multiple tenants. For example, as shown in Figure 4, the process by which the thread management module 220 adjusts the number of threads for a tenant is as follows:
[0087] Step S401: Receive the computing resource usage of multiple tenants.
[0088] Step S402: Detect whether there is an exclusive tenant among the multiple tenants. In one case, if there is no exclusive tenant among the multiple tenants, proceed to step S403. In another case, if there is an exclusive tenant among the multiple tenants, proceed to step S405.
[0089] Step S403: Calculate the amount of idle computing resources based on the usage and total amount of computing resources of multiple tenants, and calculate the number of idle threads that call the idle computing resources based on the amount of idle computing resources.
[0090] Step S404: Configure the idle thread for all shared tenants.
[0091] Specifically, after receiving the computing resource usage data from multiple tenants, the thread management module 220 can detect the type of each tenant. When the thread management module 220 detects that there are no exclusive tenants among the multiple tenants, it can calculate the total computing resource usage of the multiple tenants based on their individual usage data. The thread management module 220 can then calculate the amount of idle computing resources remaining after deducting the total usage of the multiple tenants, based on the difference between the total computing resource usage and the total computing resource usage of the multiple tenants. Finally, the thread management module 220 can calculate the number of idle threads that utilize the idle computing resources based on the amount of computing resources used by a single thread and the amount of idle computing resources.
[0092] Once the thread management module 220 obtains the number of idle threads, it can allocate the idle threads to multiple tenants according to the set rules, so that the computing resources in the idle state can serve all shared tenants, thereby reducing the stress on shared tenants' use of computing resources and improving the utilization rate of computing resources.
[0093] The rules for setting up the allocation can refer to rules such as average allocation or proportional allocation. For example, the thread management module 220 can determine a first proportional relationship between the computing resource usage of multiple tenants based on their respective usage. The thread management module 220 can then divide the idle threads according to this first proportional relationship, obtaining the allocation results. Based on these allocation results, the thread management module 220 can allocate the divided idle threads to the corresponding tenants, ensuring that each tenant receives the necessary computing resources.
[0094] Step S405: Detect whether the total computing resource usage of multiple tenants is less than a first lower limit resource threshold. In one case, if the total computing resource usage of multiple tenants is less than the first lower limit resource threshold, proceed to step S406. In another case, if the total computing resource usage of multiple tenants is greater than or equal to the first lower limit resource threshold, proceed to step S409.
[0095] Step S406: If the total computing resource usage of multiple tenants is less than the first lower limit resource threshold, check whether the computing resource usage of each tenant is less than the configured computing resource amount of that tenant. In one case, if the computing resource usage of a tenant is greater than or equal to the configured computing resource amount of that tenant, proceed to step S407. In another case, if the computing resource usage of a tenant is less than the configured computing resource amount of that tenant, proceed to step S408.
[0096] Step S407: For tenants whose computing resource usage is greater than or equal to the configured computing resource amount, keep the number of threads for that tenant unchanged. Specifically, when multiple tenants are detected in step 406 to have computing resource usage greater than or equal to the configured computing resource amount, keep the number of threads for these multiple tenants unchanged.
[0097] Step S408: For tenants whose computing resource usage is less than the configured computing resource amount, increase the number of threads for that tenant. Specifically, if multiple tenants are detected in step 406 to have computing resource usage less than the configured computing resource amount, increase the number of threads for these multiple tenants.
[0098] Specifically, when the thread management module 220 determines that there is an exclusive tenant among the multiple tenants, it can calculate the total computing resource usage of the multiple tenants based on their individual usage. The thread management module 220 can then detect whether the total computing resource usage of the multiple tenants is less than a first lower limit resource threshold. This first lower limit resource threshold refers to the minimum amount of computing resources that the multiple tenants must use. This threshold is typically a ratio, representing the ratio between the minimum computing resources used by the multiple tenants and the total amount of computing resources used.
[0099] If the total computing resource usage by multiple tenants is less than the first lower limit resource threshold, it indicates that the multiple tenants are using relatively few computing resources. In this case, the thread management module 220 can increase the number of threads configured for multiple tenants, allowing them to use more computing resources and improve their work efficiency.
[0100] When the total usage of computing resources by multiple tenants is less than the first lower limit resource threshold, the thread management module 220 can detect whether the usage of computing resources by a dedicated tenant is less than the configured amount of computing resources for that tenant. The configured amount of computing resources for a dedicated tenant refers to the dedicated computing resources used by the dedicated tenant.
[0101] If the computing resource usage of all or part of the exclusive tenants is greater than or equal to the configured computing resource limit for that tenant, it indicates that these tenants are already fully utilizing their computing resources. In this case, the thread management module 220 does not need to increase the number of threads configured for these tenants.
[0102] If the computing resource usage of all or part of the exclusive tenants is less than the configured computing resource limit for that tenant, it indicates that these tenants are not fully utilizing the computing resources. In this case, the thread management module 220 can increase the number of threads configured for these tenants, allowing them to use more computing resources and improve their work efficiency.
[0103] In one embodiment, the thread management module 220 can determine the amount of additional computing resources a dedicated tenant can acquire based on the difference between the allocated computing resources and the tenant's actual computing resource usage. The thread management module 220 can then calculate the number of threads that can utilize these additional computing resources. Finally, the thread management module 220 can add the corresponding number of threads to the dedicated tenant, thus increasing the amount of allocated computing resources available to the tenant.
[0104] Step S409: If the total computing resource usage of multiple tenants is greater than or equal to a first lower limit resource threshold, check whether the total computing resource usage of multiple tenants is greater than a first upper limit resource threshold. In one case, if the total computing resource usage of multiple tenants is greater than the first upper limit resource threshold, proceed to step S410. In another case, if the total computing resource usage of multiple tenants is less than or equal to the first upper limit resource threshold, proceed to step S407.
[0105] Step S410: If the total computing resource usage of multiple tenants exceeds a first upper limit resource threshold, check whether the computing resource usage of each tenant exceeds the configured computing resource limit for that tenant. In one case, if the computing resource usage of a tenant exceeds the configured computing resource limit for that tenant, proceed to step S411. In another case, if the computing resource usage of a tenant is less than or equal to the configured computing resource limit for that tenant, proceed to step S407.
[0106] Step S411: Reduce the number of threads for the tenant, and ensure that the number of threads for the tenant is greater than or equal to 1.
[0107] Specifically, when the total computing resource usage of multiple tenants exceeds a first upper limit resource threshold, the thread management module 220 detects whether the total computing resource usage of multiple tenants exceeds the first upper limit resource threshold. The first upper limit resource threshold refers to the maximum limit on computing resources used by multiple tenants. This threshold is typically a proportional value, representing the ratio between the maximum computing resources used by multiple tenants and the total amount of computing resources.
[0108] If the total usage of computing resources by multiple tenants is between the first lower limit resource threshold and the first upper limit resource threshold, it indicates that the multiple tenants have fully utilized the computing resources. In this case, the thread management module 220 does not need to increase or decrease the number of threads for the tenants.
[0109] If the total computing resource usage by multiple tenants exceeds the first upper limit resource threshold, it indicates that multiple tenants are using a large amount of computing resources. In this case, the thread management module 220 can reduce the number of threads for multiple tenants, allowing them to reduce their computing resource usage and avoid computing resource strain, which could prevent the database system from serving some tenants.
[0110] When the total usage of computing resources by multiple tenants exceeds the first upper limit resource threshold, the thread management module 220 can detect whether the usage of computing resources by an exclusive tenant exceeds the configured amount of computing resources for that tenant.
[0111] If the computing resource usage of all or some exclusive tenants is less than or equal to the configured computing resource amount for that tenant, it means that the overall computing resources are insufficient even without these exclusive tenants fully utilizing their configured computing resources. In this case, the thread management module 220 does not need to reduce the number of threads for these tenants, thus avoiding further increasing the number of tenants that the database system cannot serve, thereby reducing the reliability of the product.
[0112] If the computing resource usage of all or some dedicated tenants exceeds the configured computing resource limit for that tenant, it indicates that these dedicated tenants are overusing their configured computing resources, causing an overall shortage of computing resources. In this case, the thread management module 220 can reduce the number of threads used by these dedicated tenants, ensuring that the number of threads used by these tenants is greater than or equal to one. By reducing the number of threads used by these dedicated tenants, the thread management module 220 can prevent computing resource strain, thereby reducing the number of tenants that the database system cannot serve, and thus improving product reliability.
[0113] In one embodiment, the thread management module 220 can calculate the proportional relationship between the computing resource usage of each exclusive tenant based on their respective resource usage. After determining the amount of computing resource usage that needs to be reduced, the thread management module 220 can calculate the number of threads that need to utilize that reduced resource usage. The thread management module 220 can then divide the threads to be reduced according to the proportional relationship, obtaining a division result. Based on the division result, the thread management module 220 can reduce the number of threads in each exclusive tenant, allowing each exclusive tenant to reduce its corresponding computing resources.
[0114] In this embodiment, after receiving the computing resource usage data of different tenants, the thread management module 220 can dynamically adjust the number of threads called by different tenants based on the tenant type and their computing resource usage. This adjusts the computing resource usage of different tenants, allowing multiple tenants to fully utilize the computing resources in the system and improving the utilization rate of the processor's computing resources. Compared to related technologies that detect idle values, the resource isolation system 200 does not need to detect idle values to trigger a low-altitude protection mechanism. Instead, it dynamically adjusts the computing resource usage of each tenant based on their individual usage data, ensuring that each tenant can fully utilize the computing resources.
[0115] The thread management module 220 is used to adjust the number of threads for multiple users based on the computing resource usage of the tenant and the computing resource usage of multiple users within the tenant. As shown in Figure 5, the process by which the thread management module 220 adjusts the number of threads for users within the tenant is as follows:
[0116] Step S501: Determine the completion of the tenant's thread adjustment.
[0117] Step S502: Detect whether the total computing resource usage of multiple users within the adjusted tenant is less than a first lower threshold. In one case, if the total computing resource usage of multiple users within the adjusted tenant is less than a second lower threshold, proceed to step S503. In another case, if the total computing resource usage of multiple users within the adjusted tenant is greater than or equal to the second lower threshold, proceed to step S506.
[0118] Step S503: If the total computing resource usage of multiple users within the adjusted tenant is less than the second lower limit resource threshold, check whether the computing resource usage of each user within the tenant is less than the user's configured computing resource limit. In one case, if the user's computing resource usage is greater than or equal to the user's configured computing resource limit, proceed to step S504. In another case, if the user's computing resource usage is less than the user's configured computing resource limit, proceed to step S505.
[0119] Step S504: For users whose computing resource usage is greater than or equal to the configured computing resource amount, keep the number of threads for that user unchanged.
[0120] Step S505: For users whose computing resource usage is less than the configured computing resource amount, increase the number of threads for that user.
[0121] Specifically, after the thread management module 220 determines that the threads of multiple tenants have been adjusted, it can sequentially adjust the number of threads for multiple users within each tenant. The thread management module 220 can calculate the total computing resource usage of multiple users based on their computing resource usage. The thread management module 220 then checks whether the total computing resource usage of multiple users within the adjusted tenant is less than a second lower limit resource threshold. This second lower limit resource threshold refers to the minimum required computing resources for multiple users. This threshold is generally a ratio, that is, the ratio between the minimum computing resources used by multiple users and the total computing resources of the tenant.
[0122] If the total computing resource usage of multiple users within a tenant after adjustment is less than the second lower limit resource threshold, it indicates that the multiple users within the tenant are using relatively few computing resources. In this case, the thread management module 220 can increase the number of threads for multiple users within the tenant, allowing multiple users to use more computing resources and thus improving their work efficiency.
[0123] When the total computing resource usage of multiple users within a tenant after adjustment is less than the second lower limit resource threshold, the thread management module 220 can detect whether the computing resource usage of multiple users within the tenant exceeds the configured computing resource limit for that user. The configured computing resource limit for a user refers to the dedicated computing resources used by that user.
[0124] If the computing resource usage of all or some users is greater than or equal to the configured computing resource limit for that user, it means that these users have fully utilized the computing resources. In this case, the thread management module 220 does not need to increase the number of threads for these users.
[0125] If the computing resource usage of all or some users is less than the configured computing resource limit for that user, it indicates that these users are not fully utilizing the tenant's computing resources. In this case, the thread management module 220 can increase the number of threads for these users, allowing them to use more computing resources and improve their work efficiency.
[0126] In one embodiment, the thread management module 220 can determine the amount of computing resources a user can add based on the difference between the user's configured computing resources and the user's actual computing resource usage. The thread management module 220 can then calculate the number of threads that can utilize those additional computing resources. Finally, the thread management module 220 can add the corresponding number of threads to the user's available computing resource configuration.
[0127] Step S506: If the total computing resource usage of multiple users within the adjusted tenant is greater than or equal to the second lower limit resource threshold, check whether the total computing resource usage of multiple users within the adjusted tenant is greater than the first upper limit threshold. In one case, if the total computing resource usage of multiple users within the adjusted tenant is greater than the second upper limit resource threshold, proceed to step S507. In another case, if the total computing resource usage of multiple users within the adjusted tenant is less than or equal to the second upper limit resource threshold, proceed to step S504.
[0128] Step S507: If the total computing resource usage of multiple users within the adjusted tenant exceeds the second upper limit resource threshold, check whether the computing resource usage of each user within the tenant exceeds the user's configured computing resource limit. In one case, if the user's computing resource usage exceeds the user's configured computing resource limit, proceed to step S508. In another case, if the user's computing resource usage is less than or equal to the user's configured computing resource limit, proceed to step S504.
[0129] Step S508: Reduce the number of user threads, and the number of user threads is greater than or equal to 1.
[0130] Specifically, if the total computing resource usage of multiple users within the adjusted tenant is greater than or equal to the second lower limit resource threshold, the thread management module 220 can detect whether the total computing resource usage of multiple users within the adjusted tenant exceeds the second upper limit resource threshold. The second upper limit resource threshold refers to the maximum limit on computing resources used by multiple users. This second upper limit resource threshold is generally a proportional value, that is, the ratio between the maximum computing resources used by multiple users and the total computing resources of the tenant.
[0131] If, after adjustment, the computing resources of multiple users within the tenant are between the second lower limit resource threshold and the second upper limit resource threshold, it indicates that the multiple users within the tenant have fully utilized the computing resources. In this case, the thread management module 220 does not need to increase or decrease the number of threads for the multiple users within the tenant.
[0132] If the computing resources of multiple users within the adjusted tenant exceed the second upper limit resource threshold, it indicates that these users are using excessive computing resources. In this case, the thread management module 220 can reduce the number of threads for these users, allowing them to reduce their computing resource usage and avoid resource strain that could prevent the database system from serving them.
[0133] When the total usage of computing resources by multiple users within a tenant exceeds the second upper limit resource threshold, the thread management module 220 can detect whether the usage of computing resources by each user within the tenant exceeds the configured amount of computing resources for that user.
[0134] If the computing resource usage of all or some users is less than or equal to the user's configured computing resources, it means that the overall computing resources are insufficient even without fully utilizing the configured computing resources for these tenants. In this case, the thread management module 220 does not need to reduce the number of threads for these users, thus avoiding further increasing the number of users that the database system cannot serve, thereby reducing the reliability of the product.
[0135] If the computing resource usage of all or some users exceeds their allocated computing resources, it indicates that these users are overusing their allocated computing resources, causing an overall shortage of computing resources. In this case, the thread management module 220 can reduce the number of threads used by these users, ensuring that the number of threads used by these users is greater than or equal to one. Reducing the number of threads used by these users by the thread management module 220 can prevent computing resource strain, thereby reducing the number of users that the database system cannot serve, and thus improving product reliability.
[0136] In one embodiment, the thread management module 220 can calculate the proportional relationship between the computing resource usage of each user based on their individual resource usage. After determining the amount of computing resource usage that needs to be reduced, the thread management module 220 can calculate the number of threads that need to utilize that reduced resource usage. The thread management module 220 can then divide the threads to be reduced according to the proportional relationship, obtaining a division result. Based on the division result, the thread management module 220 can reduce the number of threads for each user, allowing each user to reduce their corresponding computing resources.
[0137] In this embodiment, the thread management module 220, upon receiving the computing resource usage of different users, can dynamically adjust the number of threads called by different users based on the computing resource usage of the tenant and the computing resource usage of multiple users within the tenant. This allows for the adjustment of computing resource usage by different users, enabling multiple users within multiple tenants to fully utilize the computing resources in the system and improve the utilization rate of the processor's computing resources.
[0138] It should be understood that the functional modules and devices involved in the aforementioned resource isolation system 200 can all be implemented through software or hardware, depending on the actual situation, and are not limited here. Furthermore, the functional modules and devices involved in the aforementioned resource isolation system 200 can be arranged individually or integrated, and are not limited here.
[0139] The above is a description of the resource isolation system 200 provided in this application embodiment. It is understood that the resource isolation system 200 can be configured on a cloud computing platform, for example, deployed on at least one virtual machine or container instance, so that the cloud computing platform can provide resource isolation services. Of course, the resource isolation system 200 can also be configured on nodes other than the cloud computing platform, for example, deployed in at least one data center or on at least one server, depending on the actual situation, and is not limited here. The cloud computing platform can provide pages related to public cloud services for users to remotely access public cloud services. In this embodiment, users can pre-purchase the resource isolation services provided by the resource isolation system 200 on the cloud computing platform. For ease of understanding, the interaction between the user and the cloud computing platform is described below.
[0140] As shown in Figure 6, the interaction between the user and the cloud computing platform mainly includes: the user logs into the cloud computing platform 600 through a web page on the client side, selects and purchases cloud services (i.e., resource isolation services) related to the resource isolation system 200 on the cloud computing platform 600, and after purchase, the user can generate the resource isolation system 200 on the cloud computing platform 600 based on the functions provided by the resource isolation service. The cloud computing platform 600 is mainly used to manage the infrastructure for running the resource isolation service. For example, the infrastructure for the resource isolation service may include multiple data centers located in different regions, each data center including multiple servers. The data centers can provide basic resources for the resource isolation service, such as computing resources and storage resources. Therefore, when purchasing and using the resource isolation service, the user mainly pays for the resources used. When using the resource isolation service, the user can input their requirements for the resource isolation service through the configuration interface, application program interface (API), or user interaction interface provided by the cloud computing platform 600. The cloud computing platform 600 can then generate a resource isolation service matching the user's (or other software / hardware, etc.) input requirements.
[0141] Alternatively, some modules in the resource isolation system 200 can be configured on the cloud side and others on the edge side, thereby achieving resource isolation services through edge-cloud collaboration. Furthermore, the resource isolation system 200 can also be entirely configured on the edge side, depending on the specific circumstances; no limitation is made here.
[0142] This application provides a schematic diagram of the structure of a resource isolation device. Based on the execution function, the resource isolation device can be divided into a resource management module 210 and a thread management module 220 in the resource isolation system 200 shown in Figure 2. The resource isolation device can be an application program, software code, etc., deployed on a computing device or a cluster of computing devices. The computing device can be a server, computer, laptop, tablet, smartphone, etc. The resource isolation device can be deployed on a cloud server. If the resource isolation device is deployed on a cloud service, the designer can use a local device to call the cloud server to use the resource isolation device to complete the corresponding task. The specific implementation process of the resource isolation device is as follows:
[0143] The resource management module 210 is used to obtain the computing resource usage of each tenant among multiple tenants. The thread management module 220 is used to obtain the total computing resource usage of multiple tenants based on the computing resource usage of each tenant. The thread management module 220 is also used to either increase the number of threads in the multiple tenants or keep the number of threads in the multiple tenants unchanged when the total computing resource usage of the multiple tenants is less than a first lower limit resource threshold. The threads of the multiple tenants are used to access the computing resources of at least one processor.
[0144] In one implementation, the thread management module 220 is specifically used to detect whether the computing resource usage of each tenant among the multiple tenants is less than the configured computing resource amount of the corresponding tenant when the total computing resource usage of multiple tenants is less than a first lower limit resource threshold. Specifically, the thread management module 220 is used to increase the number of threads of the first tenant when the computing resource usage of the first tenant is less than the configured computing resource amount of the first tenant. The multiple tenants include the first tenant. Specifically, the thread management module 220 is used to keep the number of threads of the first tenant unchanged when the computing resource usage of the first tenant is greater than or equal to the configured computing resource amount of the first tenant.
[0145] In one implementation, before increasing the number of threads in multiple tenants or keeping the number of threads in multiple tenants unchanged when the total usage of computing resources among multiple tenants is less than a first lower limit resource threshold, the thread management module 220 is further configured to detect whether there is an exclusive tenant among the multiple tenants. An exclusive tenant refers to a tenant that uses dedicated computing resources in at least one processor. If there is no exclusive tenant among the multiple tenants, the thread management module 220 is further configured to determine the idle threads that are calling the idle computing resources of at least one processor. The thread management module 220 is further configured to allocate the idle threads to the multiple tenants.
[0146] In one implementation, before increasing the number of threads in multiple tenants or keeping the number of threads in multiple tenants unchanged when the total usage of computing resources among multiple tenants is less than a first lower limit resource threshold, the thread management module 220 is further configured to detect whether there is an exclusive tenant among the multiple tenants. An exclusive tenant refers to a tenant that uses dedicated computing resources in at least one processor. If there is no exclusive tenant among the multiple tenants, the thread management module 220 is further configured to determine the idle threads that are calling the idle computing resources of at least one processor. The thread management module 220 is further configured to allocate the idle threads to the multiple tenants.
[0147] In one implementation, the thread management module 220 is further configured to detect whether the total computing resource usage of multiple tenants exceeds a first upper limit resource threshold when the total computing resource usage of multiple tenants is greater than or equal to a first lower limit resource threshold. The thread management module 220 is also configured to maintain the number of threads of multiple tenants unchanged when the total computing resource usage of multiple tenants is less than or equal to the first upper limit resource threshold. The thread management module 220 is further configured to reduce the number of threads of multiple tenants or maintain the number of threads of multiple tenants unchanged when the total computing resource usage of multiple tenants exceeds the first upper limit resource threshold.
[0148] In one implementation, the thread management module 220 is specifically used to detect whether the computing resource usage of each tenant among the multiple tenants exceeds the configured computing resource limit when the total computing resource usage of multiple tenants exceeds a first upper limit resource threshold. Specifically, the thread management module 220 is used to reduce the number of threads in the second tenant when the computing resource usage of the second tenant exceeds the configured computing resource limit. The multiple tenants include the second tenant. Specifically, the thread management module 220 is used to maintain the number of threads in the second tenant unchanged when the computing resource usage of the second tenant is less than or equal to the configured computing resource limit.
[0149] In one implementation, the thread management module 220 is further configured to determine that the third tenant's thread adjustment has been completed. The multiple tenants include the third tenant, and the third tenant includes multiple users. The thread management module 220 is further configured to detect whether the total computing resource usage of the multiple users is less than a second lower limit resource threshold. The thread management module 220 is further configured to, if the total computing resource usage of the multiple users is less than the second lower limit resource threshold, either increase the number of threads for the multiple users or keep the number of threads for the multiple users unchanged.
[0150] In one implementation, the thread management module 220 is specifically used to detect whether the computing resource usage of each user among the multiple users is less than the configured computing resource amount when the total computing resource usage of multiple users is less than a second lower limit resource threshold. Specifically, the thread management module 220 is used to increase the number of threads for the first user when the computing resource usage of the first user is less than the configured computing resource amount for the first user. The multiple users include the first user. Specifically, the thread management module 220 is used to keep the number of threads for the first user unchanged when the computing resource usage of the first user is greater than or equal to the configured computing resource amount for the first user.
[0151] In one implementation, the thread management module 220 is further configured to detect whether the total computing resource usage of multiple users exceeds a second upper limit resource threshold when the total computing resource usage of multiple users is greater than or equal to a second lower limit resource threshold. The thread management module 220 is also configured to maintain the number of threads for multiple users unchanged when the total computing resource usage of multiple users is less than or equal to the second upper limit resource threshold. The thread management module 220 is further configured to reduce the number of threads for multiple users or maintain the number of threads for multiple users unchanged when the total computing resource usage of multiple users exceeds the second upper limit resource threshold.
[0152] In one implementation, the thread management module 220 is specifically used to detect whether the computing resource usage of each user among the multiple users exceeds the configured computing resource limit when the total computing resource usage of multiple users exceeds a second upper limit resource threshold. Specifically, the thread management module 220 is used to reduce the number of threads for the second user when the computing resource usage of the second user exceeds the configured computing resource limit for the second user. The multiple users include the second user. Specifically, the thread management module 220 is used to maintain the number of threads for the second user unchanged when the computing resource usage of the second user is less than or equal to the configured computing resource limit for the second user.
[0153] Both the resource management module 210 and the thread management module 220 can be implemented in software or in hardware. For example, the implementation of the resource management module 210 will be described below. Similarly, the implementation of the thread management module 220 can refer to the implementation of the resource management module 210.
[0154] As an example of a software functional unit, the resource management module 210 may include code running on computing instances. These computing instances may include at least one of physical hosts (computing devices), virtual machines, and containers. Furthermore, the aforementioned computing instances may be one or more. For example, the resource management module 210 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed within the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed within 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.
[0155] 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.
[0156] As an example of a hardware functional unit, the resource management module 210 may include at least one computing device, such as a server. Alternatively, the resource management module 210 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.
[0157] The resource management module 210 includes multiple computing devices that can be distributed within the same region or in different regions. Similarly, the resource management module 210 can be distributed within the same Availability Zone (AZ) or in different AZs. Likewise, the resource management module 210 can be distributed within 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.
[0158] It should be noted that, in other embodiments, the resource management module 210 can be used to execute any step in the resource isolation method, and the thread management module 220 can be used to execute any step in the resource isolation method. The steps implemented by the resource management module 210 and the thread management module 220 can be specified as needed. The resource isolation device can achieve all its functions by implementing different steps in the resource isolation method through the resource management module 210 and the thread management module 220 respectively.
[0159] Figure 7 is a schematic diagram of a computing device provided in an embodiment of this application. As shown in Figure 7, the computing device 700 includes a bus 710, a processor 720, a memory 730, and a communication interface 740. The processor 720, the memory 730, and the communication interface 740 communicate with each other via the bus 710. The computing device 700 can be a server, computer, laptop, server rack, etc. It should be understood that this application does not limit the number of processors and memories in the computing device 700.
[0160] Bus 710 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 7, but this does not imply that there is only one bus or one type of bus. Bus 710 can include pathways for transmitting information between various components of computing device 700 (e.g., processor 720, memory 730, communication interface 740).
[0161] The processor 720 can be any one or more of the following: CPU, GPU, microprocessor (MP), or digital signal processor (DSP).
[0162] The memory 730 may include volatile memory, such as random access memory (RAM). The memory 730 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0163] The memory 730 stores executable program code, which the processor 720 executes to implement the functions of the aforementioned modules, such as the resource management module 210 and the thread management module 220, thereby implementing the resource isolation method. In other words, the memory 730 stores instructions for executing the resource isolation method.
[0164] Alternatively, the memory 730 stores executable code, which the processor 720 executes to implement the functions of the aforementioned modules, thereby implementing the resource isolation method. That is, the memory 730 stores instructions for executing the resource isolation method.
[0165] The communication interface 740 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 700 and other devices or communication networks.
[0166] This application also provides a computing device cluster. The computing device cluster includes at least one computing device. The 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 terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0167] As shown in Figure 8, the computing device cluster includes at least one computing device 700. The memory 730 of one or more computing devices 700 in the computing device cluster may store the same instructions for executing resource isolation methods.
[0168] In some possible implementations, the memory 730 of one or more computing devices 700 in the computing device cluster may also store partial instructions for executing the resource isolation method. In other words, a combination of one or more computing devices 700 can jointly execute instructions for executing the resource isolation method.
[0169] It should be noted that the memory 730 in different computing devices 700 within the computing device cluster can store different instructions, which are used to execute some of the functions of the resource management module 210 and the thread management module 220 mentioned above. That is, the instructions stored in the memory 730 of different computing devices 700 can implement the functions of one or more modules in the resource management module 210 and the thread management module 220 mentioned above.
[0170] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 9 illustrates one possible implementation. As shown in Figure 9, two computing devices, computing device 700A and computing device 700B, are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this type of possible implementation, the memory 730 in computing device 700A stores instructions for executing some of the functions of the resource management module 210 and thread management module 220. Simultaneously, the memory 730 in computing device 700B stores instructions for executing other parts of the functions of the resource management module 210 and thread management module 220.
[0171] The connection method between the computing device clusters shown in Figure 9 can be considered as follows: taking into account that the resource isolation method provided in this application requires a large amount of data storage, it is considered that the functions implemented by another part of the above-mentioned resource management module 210 and thread management module 220 are handed over to the computing device 700B for execution.
[0172] It should be understood that the functions of computing device 700A shown in Figure 9 can also be performed by multiple computing devices 700. Similarly, the functions of computing device 700B can also be performed by multiple computing devices 700.
[0173] This application also provides another computing device cluster. The connection relationship between the computing devices in this computing device cluster can be similarly referred to the connection method of the computing device cluster described in Figures 7 and 8. The difference is that the memory 730 of one or more computing devices 700 in this computing device cluster can store the same instructions for executing resource isolation methods.
[0174] In some possible implementations, the memory 730 of one or more computing devices 700 in the computing device cluster may also store partial instructions for executing the resource isolation method. In other words, a combination of one or more computing devices 700 can jointly execute instructions for executing the resource isolation method.
[0175] It should be noted that the memory 730 in different computing devices 700 within the computing device cluster can store different instructions for executing some functions of the computing device 700. That is, the instructions stored in the memory 730 of different computing devices 700 can implement the functions of one or more modules in the resource management module 210 and thread management module 220 mentioned above.
[0176] 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 runs on at least one computing device, it causes the at least one computing device to perform a resource isolation method.
[0177] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, 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 the computing device to perform a resource isolation method.
[0178] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A resource isolation method, characterized in that, The method is applied to a resource isolation system, the resource isolation system including at least one processor, and the method includes: Get the computing resource usage of each tenant in a multi-tenant group; Based on the computing resource usage of each tenant, the total computing resource usage of the multiple tenants is obtained; If the total usage of computing resources by the multiple tenants is less than a first lower limit resource threshold, the number of threads of the multiple tenants may be increased or kept constant; the threads of the multiple tenants are used to call the computing resources of the at least one processor.
2. The method according to claim 1, characterized in that, The step of increasing the number of threads for the multiple tenants or keeping the number of threads for the multiple tenants unchanged when the total usage of computing resources for the multiple tenants is less than a first lower limit resource threshold specifically includes: If the total usage of computing resources of the multiple tenants is less than the first lower limit resource threshold, it is detected whether the usage of computing resources of each tenant among the multiple tenants is less than the configured amount of computing resources of the corresponding tenant. If the computing resource usage of the first tenant is less than the configured computing resource amount of the first tenant, the number of threads of the first tenant is increased; the multiple tenants include the first tenant; If the computing resource usage of the first tenant is greater than or equal to the computing resource configuration of the first tenant, the number of threads of the first tenant remains unchanged.
3. The method according to claim 1 or 2, characterized in that, Before increasing the number of threads for the multiple tenants or keeping the number of threads for the multiple tenants unchanged when the total usage of computing resources for the multiple tenants is less than a first lower limit resource threshold, the method further includes: Detect whether there is an exclusive tenant among the multiple tenants, wherein the exclusive tenant refers to a tenant that uses dedicated computing resources in the at least one processor; In the absence of an exclusive tenant among the multiple tenants, determine the idle thread that invokes the idle computing resources of the at least one processor; The idle thread is assigned to the multiple tenants.
4. The method according to any one of claims 1-3, characterized in that, The method further includes: If the total usage of computing resources by the multiple tenants is greater than or equal to the first lower limit resource threshold, it is detected whether the total usage of computing resources by the multiple tenants is greater than the first upper limit resource threshold. If the total usage of computing resources by the multiple tenants is less than or equal to the first upper limit resource threshold, the number of threads of the multiple tenants shall remain unchanged. If the total usage of computing resources by the multiple tenants exceeds the first upper limit resource threshold, the number of threads of the multiple tenants may be reduced or kept constant.
5. The method according to claim 4, characterized in that, When the total computing resource usage of the multiple tenants exceeds the first upper limit resource threshold, reducing the number of threads in the multiple tenants or keeping the number of threads in the multiple tenants unchanged specifically includes: If the total usage of computing resources by the multiple tenants exceeds the first upper limit resource threshold, it is detected whether the usage of computing resources by each of the multiple tenants exceeds the configured amount of computing resources for the corresponding tenant. If the computing resource usage of the second tenant exceeds the configured computing resource amount of the second tenant, the number of threads of the second tenant shall be reduced; the multiple tenants include the second tenant. If the computing resource usage of the second tenant is less than or equal to the configured computing resource amount of the second tenant, the number of threads of the second tenant remains unchanged.
6. The method according to any one of claims 1-5, characterized in that, The method further includes: The thread that determines the third tenant has completed the adjustment; the multiple tenants include the third tenant, and the third tenant includes multiple users; Detect whether the total computing resource usage of the multiple users is less than the second lower limit resource threshold; If the total computing resource usage of the multiple users is less than the second lower limit resource threshold, either increase the number of threads of the multiple users or keep the number of threads of the multiple users unchanged.
7. The method according to claim 6, characterized in that, The method further includes: If the total computing resource usage of the multiple users is greater than or equal to the second lower limit resource threshold, it is detected whether the total computing resource usage of the multiple users is greater than the second upper limit resource threshold. If the total computing resource usage of the multiple users is less than or equal to the second upper limit resource threshold, the number of threads of the multiple users shall remain unchanged. If the total computing resource usage of the multiple users exceeds the second upper limit resource threshold, the number of threads of the multiple users may be reduced or kept unchanged.
8. A resource isolation device, characterized in that, include: The resource management module is used to obtain the computing resource usage of each tenant among multiple tenants; The thread management module is used to obtain the total computing resource usage of the multiple tenants based on the computing resource usage of each tenant. If the total usage of computing resources by the multiple tenants is less than a first lower limit resource threshold, the number of threads of the multiple tenants may be increased or kept constant; the threads of the multiple tenants are used to call the computing resources of the at least one processor.
9. The apparatus according to claim 8, characterized in that, The thread management module is specifically used to detect whether the computing resource usage of each tenant among the multiple tenants is less than the configured computing resource amount of the corresponding tenant when the total computing resource usage of the multiple tenants is less than the first lower limit resource threshold. If the computing resource usage of the first tenant is less than the configured computing resource amount of the first tenant, the number of threads of the first tenant is increased; the multiple tenants include the first tenant; If the computing resource usage of the first tenant is greater than or equal to the computing resource configuration of the first tenant, the number of threads of the first tenant remains unchanged.
10. The apparatus according to claim 8 or 9, characterized in that, Before the thread management module increases the number of threads for the multiple tenants or keeps the number of threads for the multiple tenants unchanged when the total usage of computing resources for the multiple tenants is less than a first lower limit resource threshold, it is further used to... Detect whether there is an exclusive tenant among the multiple tenants, wherein the exclusive tenant refers to a tenant that uses dedicated computing resources in the at least one processor; In the absence of an exclusive tenant among the multiple tenants, determine the idle thread that invokes the idle computing resources of the at least one processor; The idle thread is assigned to the multiple tenants.
11. The apparatus according to any one of claims 8-10, characterized in that, The thread management module is further configured to detect whether the total computing resource usage of the multiple tenants is greater than the first upper limit resource threshold when the total computing resource usage of the multiple tenants is greater than or equal to the first lower limit resource threshold. If the total usage of computing resources by the multiple tenants is less than or equal to the first upper limit resource threshold, the number of threads of the multiple tenants shall remain unchanged. If the total usage of computing resources by the multiple tenants exceeds the first upper limit resource threshold, the number of threads of the multiple tenants may be reduced or kept constant.
12. The apparatus according to claim 11, characterized in that, The thread management module is specifically used to detect whether the computing resource usage of each tenant among the multiple tenants is greater than the configured computing resource amount of the corresponding tenant when the total computing resource usage of the multiple tenants is greater than the first upper limit resource threshold. If the computing resource usage of the second tenant exceeds the configured computing resource amount of the second tenant, the number of threads of the second tenant shall be reduced; the multiple tenants include the second tenant. If the computing resource usage of the second tenant is less than or equal to the configured computing resource amount of the second tenant, the number of threads of the second tenant remains unchanged.
13. The apparatus according to any one of claims 8-12, characterized in that, The thread management module is also used to determine when the thread of the third tenant has completed the adjustment; the multiple tenants include the third tenant, and the third tenant includes multiple users; Detect whether the total computing resource usage of the multiple users is less than the second lower limit resource threshold; If the total computing resource usage of the multiple users is less than the second lower limit resource threshold, either increase the number of threads of the multiple users or keep the number of threads of the multiple users unchanged.
14. The apparatus according to claim 13, characterized in that, The thread management module is also used to detect whether the total computing resource usage of the multiple users is greater than the second upper limit resource threshold when the total computing resource usage of the multiple users is greater than or equal to the second lower limit resource threshold. If the total computing resource usage of the multiple users is less than or equal to the second upper limit resource threshold, the number of threads of the multiple users shall remain unchanged. If the total computing resource usage of the multiple users exceeds the second upper limit resource threshold, the number of threads of the multiple users may be reduced or kept unchanged.
15. A computing device cluster, characterized in that, include: 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-7.
16. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a computing device, cause the computing device to perform the method as described in any one of claims 1-7.
17. A computer program product containing instructions, characterized in that, The computer program product stores instructions that, when executed by a computing device, cause the computing device to perform the method according to any one of claims 1-7.
Citation Information
Patent Citations
Method and device used for controlling using of computer resource in data base service
CN103136055A
Resource management method for tenants and tenant management system
CN115617468A
Tenant resource allocation method and device, equipment and storage medium
CN117687803A
Resource cluster scheduling method based on multi-tenant sharing, computer and storage medium
CN117851035A
Automatic resource quota calculations based on tenant workloads
US20230176918A1