WO2017133421A1 - Method and device for sharing resources among multiple tenants - Google Patents

Method and device for sharing resources among multiple tenants Download PDF

Info

Publication number
WO2017133421A1
WO2017133421A1 PCT/CN2017/071022 CN2017071022W WO2017133421A1 WO 2017133421 A1 WO2017133421 A1 WO 2017133421A1 CN 2017071022 W CN2017071022 W CN 2017071022W WO 2017133421 A1 WO2017133421 A1 WO 2017133421A1
Authority
WO
WIPO (PCT)
Prior art keywords
cpu core
tenant
cpu
usage rate
preset
Prior art date
Application number
PCT/CN2017/071022
Other languages
French (fr)
Chinese (zh)
Inventor
文继军
王伟
徐文韬
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2017133421A1 publication Critical patent/WO2017133421A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and apparatus for multi-tenant resource sharing.
  • a tenant In the era of cloud computing, a large number of computing resources are brought together to provide services for users. Users can rent computing resources from the cloud, which can enjoy the benefits of low cost, and can be secured by security and reliability.
  • a tenant usually corresponds to an organization, such as a company, a school, and so on.
  • computing resources are divided by a CPU (Central Processing Unit) core, and all tenants obtain a CPU core through a competition mechanism, which easily leads to a large difference in CPU cores that different tenants compete for. It is possible for a tenant who competes more CPU cores to meet the needs of the tenant with fewer CPU cores, and tenants competing for fewer CPU cores need more CPU cores to meet the needs of the tenant, resulting in a CPU core. The resource allocation is unreasonable.
  • the ability of the tenant to compete for the CPU core may change with time. For example, the tenant's network environment is better at this moment, competing for more CPU cores, and the next time the network environment changes. Poor, the CPU core used to serve the tenant may serve other tenants, resulting in an increase in the number of CPU core switches and inefficient handling of tenant demand.
  • the present invention provides a method and an apparatus for multi-tenant sharing resources, which are used to solve the problem that the CPU core allocation in the prior art is unreasonable and the number of CPU core switching times is increased due to the tenant acquiring the CPU core through the competition mechanism, and the tenant demand is processed. Inefficient problem.
  • a method for multi-tenant sharing resources including:
  • the central processor CPU management distributor estimates the average usage rate of the tenant's CPU core; if it is determined that the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, the tenant is The CPU core information corresponding to at least one CPU core of each of the leased CPU cores is added to a preset CPU core linked list in the storage space, and the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for re Assigning; if it is determined that the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the preset CPU core, assigning, to the tenant, a CPU core corresponding to at least one CPU core information in the CPU core linked list respectively
  • the average usage rate of the CPU core is an average value of usage rates of the CPU cores rented by the tenant within a set time period, and the tenant is stored in a storage space managed by the CPU management distributor. Any tenant.
  • the CPU management allocator can estimate the average usage rate of the CPU core of the tenant within the set duration, and when the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant,
  • the CPU core information corresponding to at least one CPU core of the CPU core leased by the tenant is added to the CPU core list for redistribution.
  • at least one stored CPU is selected from the CPU core list.
  • the CPU core corresponding to the core information is assigned to the tenant, thereby passing the average use of the CPU core to the tenant within the set duration.
  • the estimation of the rate enables the CPU management allocator management to dynamically allocate the CPU cores rented by the tenants stored in the storage space according to the estimated average usage rate of the tenants, thereby avoiding the CPU caused by the competition in the prior art.
  • the method further includes: when the CPU manages a new tenant added to the storage space, the new tenant is allocated in the CPU core list. At least one CPU core information corresponding to the CPU core.
  • the CPU core corresponding to at least one CPU core information in the CPU core linked list can be allocated to the new group, thereby avoiding new users competing for the CPU core through the competition mechanism, thereby avoiding In the prior art, the unreasonable problem of CPU core allocation due to competition, while reducing the number of CPU core switching, thereby improving the efficiency of processing tenant requirements.
  • the CPU core linked list includes an idle linked list and a candidate linked list; when the average usage rate of the tenant's CPU core is less than the minimum usage rate of the CPU core preset for the tenant
  • the CPU management allocator adds CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant to the free list; when the average usage rate of the CPU core of the tenant is greater than
  • the CPU management distributor allocates at least one CPU of each CPU core rented by the tenant
  • the CPU core information corresponding to the core and the lease priority information mapping of the tenant lease CPU core are added to the candidate linked list; wherein, the expected usage rate of the tenant's CPU core is greater than the minimum usage of the tenant's CPU core rate.
  • the tenant can reduce the number of CPU cores to be rented, thus reducing the nuclear information of the leased CPU core.
  • the tenant is explained There is a demand for the leased CPU core.
  • the tenant's CPU core can be used as a candidate solution to further refine the CPU core list. The allocation of CPU cores rented by tenants is more reasonable.
  • the CPU management allocator determines that an average usage rate of the CPU core of the tenant is greater than a maximum usage rate of a CPU core preset for the tenant, and the free list is If it is empty, the CPU core information corresponding to the at least one lease priority information selected in descending order of the lease priority information stored in the candidate linked list is selected, and the CPU core corresponding to the selected CPU core information is allocated.
  • a CPU core corresponding to at least one CPU core information is allocated to the tenant; wherein a desired usage rate of the tenant's CPU core is less than a maximum usage rate of the tenant's CPU core.
  • the CPU management allocator further refines the scheme for allocating the CPU core by using the expected usage rate of the CPU core of the tenant and the maximum usage rate for the tenant, the allocation of the CPU core leased by the tenant is more reasonable. And the CPU core with low priority of the tenant is preferentially provided to the CPU core tenant, thereby ensuring the use of the high priority group.
  • the CPU management allocator determines that an average usage rate of the CPU core of the tenant is greater than a expected usage rate of a CPU core preset for the tenant, and is smaller than If the maximum usage rate of the CPU core preset by the tenant is empty and the free list is empty, the CPU core is no longer allocated to the tenant.
  • the CPU management allocator determines that the CPU core needs to be allocated for at least two tenants, the lease priority information of the CPU core is rented according to each of the at least two tenants. In the low order, each of the tenants is assigned a CPU core.
  • the CPU management allocator allocates a CPU core to a tenant with a high priority priority when it is determined that at least two CPUs are allocated to the tenant, the demand of the high priority tenant for the CPU core is ensured.
  • the second aspect provides an apparatus for sharing resources by a multi-tenant, including: a calculation module and a judgment module; wherein the calculation module is configured to estimate an average usage rate of the tenant's CPU core, and the average usage rate of the CPU core is An average value of usage rates of the CPU cores rented by the tenant in the set time period, the tenant is any tenant stored in the storage space managed by the CPU management splitter; the determining module is configured to determine the tenant When the average usage rate of the CPU core is less than the expected usage rate of the CPU core preset for the tenant, the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant is added to the storage.
  • the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation; determining that the average usage rate of the tenant's CPU core is greater than the preset CPU core When the expected usage rate is reached, the tenant is allocated a CPU core corresponding to at least one CPU core information in the CPU core linked list.
  • the CPU core information corresponding to at least one CPU core of the CPU core leased by the tenant is added to the CPU core list for redistribution.
  • at least one stored CPU is selected from the CPU core list.
  • the CPU core corresponding to the core information is allocated to the tenant, so that the device can dynamically allocate the storage space according to the estimated average occupancy rate of the tenant by estimating the average usage rate of the CPU core within the set time period.
  • the CPU cores rented by the tenants stored in the system avoid the unreasonable problem of the CPU core allocation caused by the competition in the prior art, and reduce the number of switching of the CPU cores, thereby improving the efficiency of processing the tenant requirements.
  • the apparatus further includes: a processing module; when the processing module is configured to add a new tenant in the storage space, assign the CPU core linked list to the new tenant At least one of the CPU core information corresponds to the CPU core.
  • the CPU core corresponding to at least one CPU core information in the CPU core linked list can be allocated to the new group, thereby avoiding new users competing for the CPU core through the competition mechanism, thereby avoiding In the prior art, the unreasonable problem of CPU core allocation due to competition, while reducing the number of CPU core switching, thereby improving the efficiency of processing tenant requirements.
  • the CPU core linked list includes a free linked list and a candidate linked list; and the determining module is specifically configured to: when an average usage rate of the tenant's CPU core is less than preset for the tenant When the minimum usage rate of the CPU core is used, CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant is added to the free list; when the average usage rate of the CPU core of the tenant is greater than a CPU corresponding to at least one of the CPU cores rented by the tenant when the minimum usage rate of the CPU core set in advance by the tenant is smaller than the expected usage rate of the CPU core preset for the tenant
  • the core information, and the lease priority information map of the tenant lease CPU core are added to the candidate list; wherein the expected usage rate of the tenant's CPU core is greater than the minimum usage rate of the tenant's CPU core.
  • the tenant can reduce the number of CPU cores leased, so the core information of the leased CPU core is added to the free list, and the average usage of the CPU core of the estimated tenant is greater than the preset for the tenant.
  • the minimum usage rate of the CPU core is less than the expected usage rate of the CPU core preset for the tenant, the tenant has a demand for the rented CPU core, and the other CPU has a CPU core requirement and no free CPU core.
  • the tenant's CPU core can be used as a candidate solution.
  • the determining module is specifically configured to: if it is determined that an average usage rate of the CPU core of the tenant is greater than a maximum usage rate of a CPU core preset for the tenant, and If the free list is empty, the CPU core information corresponding to the at least one lease priority information selected in descending order of the lease priority information stored in the candidate linked list is selected, and the CPU corresponding to the selected CPU core information is selected.
  • the core is allocated to the tenant; if it is determined that the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the CPU core preset for the tenant, and the free linked list is not empty, then the idle linked list is A CPU core corresponding to the stored at least one CPU core information is allocated to the tenant; wherein a desired usage rate of the tenant's CPU core is less than a maximum usage rate of the tenant's CPU core.
  • the scheme for allocating the CPU core is further refined by the expected usage rate of the CPU core for the tenant and the maximum usage rate for the tenant, the allocation of the CPU core leased by the tenant is more reasonable, and the tenant is preferentially prioritized.
  • a CPU with a lower priority is provided to the CPU core tenant, thus ensuring the use of high priority groups.
  • the determining module is further configured to: if it is determined that an average usage rate of the CPU core of the tenant is greater than a expected usage rate of a CPU core preset for the tenant, and less than If the tenant has a maximum usage rate of the CPU core set in advance, and the free linked list is empty, the CPU core is no longer allocated to the tenant.
  • the determining module is further configured to: if it is determined that the CPU core needs to be allocated to at least two tenants, renting the CPU core's lease priority information according to each of the at least two tenants. From the highest to the lowest order, each of the tenants is assigned a CPU core.
  • the CPU management allocator allocates a CPU core to a tenant with a high priority priority when it is determined that at least two CPUs are allocated to the tenant, the demand of the high priority tenant for the CPU core is ensured.
  • 1a is a schematic diagram of a system architecture of a multi-tenant shared resource according to an embodiment of the present invention
  • FIG. 1b is a schematic structural diagram of a server according to an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of a method for multi-tenant sharing resources according to an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of a method for multi-tenant sharing resources according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of an apparatus for multi-tenant sharing resources according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of hardware of an apparatus for multi-tenant sharing resources according to an embodiment of the present invention.
  • FIG. 1 is a schematic diagram of a system architecture of a multi-tenant shared resource according to an embodiment of the present invention.
  • the system architecture includes: a server, and a plurality of terminal devices, where the server includes a CPU management allocator and a plurality of CPU cores, where The tenant sends a request to the server through the APP (Application) in the terminal device.
  • the server allocates a CPU core to the tenant through the CPU management allocator, and performs a request of the tenant.
  • the CPU management allocator records the tenant through the storage space managed by the CPU management allocator. Relevant information, including but not limited to the tenant's own information, such as priority, name, etc., the tenant uses the CPU core usage record.
  • the CPU management allocator can dynamically allocate the CPU core to the stored tenants in the storage space managed by the CPU management agent according to the estimated average usage rate of the tenant CPU core, thereby The irrational problem of the CPU core allocation caused by the competition in the prior art is avoided, and the number of switching of the CPU core is reduced, thereby improving the efficiency of processing the tenant demand.
  • a method for a multi-tenant to share resources includes:
  • the CPU management allocator estimates the average usage rate of the tenant's CPU core.
  • the average usage rate of the CPU core is the average value of the usage rate of each CPU core rented by the tenant within the set time period, and the tenant is the CPU management allocator. Any tenant that has been stored in the managed storage space;
  • Step 201 The CPU management distributor determines that the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, and the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant. Add to the preset CPU core linked list in the storage space, and the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation;
  • Step 202 The CPU management allocator determines, for the tenant, a CPU core corresponding to at least one CPU core information in the CPU core linked list, if it is determined that the average usage rate of the tenant's CPU core is greater than a preset usage rate of the CPU core.
  • the set duration is a period of time after the CPU management allocator estimates the average usage rate of the CPU core of the first tenant, that is, the average usage rate of the CPU core of the tenant estimated by the CPU management allocator.
  • the average usage rate of the CPU core of the tenant for a period of time in the future.
  • the CPU management allocator predicts or estimates the average usage rate of the CPU core of the tenant in the set duration by counting the tenant CPU core running data.
  • the CPU management allocator periodically estimates the average usage rate of the CPU core of the first tenant. Specifically, the CPU management allocator estimates the average usage rate of the CPU core of the first tenant in the period at the beginning of each period.
  • step 201 when the CPU management allocator determines that the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the first tenant, the first tenant rents the CPU core according to a preset algorithm.
  • the CPU management allocator rents the tenant.
  • the CPU core information corresponding to at least one CPU core of each CPU core is added to the idle linked list; when the average usage rate of the tenant's CPU core is greater than the minimum usage rate of the CPU core preset for the tenant, and less than for the tenant.
  • the CPU management allocator adds the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant, and the lease priority information mapping of the tenant leased CPU core to the candidate.
  • the linked list wherein the expected usage rate of the tenant's CPU core is greater than the minimum usage rate of the tenant's CPU core.
  • the expected usage rate of the CPU core preset for tenant 1 is 70%, and the minimum usage rate of the CPU core preset for tenant 1 is 50%:
  • Scenario 1 If the average usage rate of the CPU core of the tenant 1 estimated by the CPU management allocator is 40%, since the average usage rate of the CPU core is smaller than the minimum usage rate of the CPU core preset for the tenant 1, according to the preset The algorithm determines that the number of released CPU cores is 1, and adds the corresponding number of cores of the CPU core to the free list. Specifically, the step of determining the number of released CPU cores is as follows:
  • the number of cores is four, where N is the expected number of CPU cores that are preset for the tenant 1. If the number of CPU cores rented by the current tenant 1 is five, the number of CPU cores that can be released is one.
  • the CPU core corresponding to the CPU core information stored in the free list indicates that the tenant no longer uses the CPU core, and the CPU core is in an idle state.
  • the algorithm for determining the number of released CPU cores is not limited to the above algorithm, and other algorithms that can be used to determine the number of released CPU cores may be used.
  • Scenario 2 If the average usage rate of the CPU core of the tenant estimated by the CPU management allocator is 60%, since the average usage rate of the CPU core is greater than the minimum usage rate and less than the expected usage rate, it is determined according to a preset algorithm. The number of CPU cores to be reassigned, and the core information of the corresponding number of CPU cores and the priority information mapping of the tenant-learned CPU cores are added to the candidate list.
  • the CPU core corresponding to the CPU core information stored in the candidate linked list is the CPU core currently used by the tenant.
  • the CPU core can be allocated to the tenant who needs to apply for the CPU core.
  • step 202 when it is determined that the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the CPU core preset for the tenant, further determining the number of the CPU cores that the tenant needs to apply for renting according to a preset algorithm.
  • the determined number of CPU cores allocated to the tenant is a CPU core corresponding to at least one CPU core information stored in the idle linked list, wherein the maximum usage rate of the CPU core preset for the tenant is greater than the CPU core preset for the tenant. Expected usage.
  • the determined number of CPU cores allocated to the tenant is the CPU stored in the free list.
  • the core information corresponds to the CPU core.
  • the determined number of CPU cores allocated to the tenant is the CPU core stored in the candidate linked list.
  • the CPU core corresponding to the information.
  • the CPU management allocator determines that the CPU core needs to be allocated for at least two tenants
  • the lease priority information of each of the at least two tenants renting the CPU core is in descending order, respectively.
  • Each tenant allocates a CPU core.
  • the CPU management allocator when a new tenant is added to the storage space managed by the CPU management allocator, the CPU management allocator is The new tenant allocates a CPU core corresponding to at least one CPU core information in the CPU core linked list.
  • the new tenant is allocated with at least one CPU core information in the free linked list.
  • the CPU core is configured to allocate a CPU core corresponding to at least one CPU core information in the candidate linked list to the new tenant, so as to ensure that the new tenant can be allocated to the usable CPU core.
  • the tenant information is stored in the storage space managed by the CPU management allocator.
  • the method for sharing resources by the multi-tenant according to the embodiment of the present invention includes:
  • Step 300 The CPU management allocator determines the order of priority of the tenant to rent the CPU in the storage space according to the priority information of the tenant renting the CPU core.
  • the CPU management allocator determines the CPU core information in the free list and the candidate list that can be used for reallocation, and performs the following steps in sequence according to the order of priority of the tenant to rent the CPU:
  • Step 301 The CPU management allocator estimates an average usage rate of the CPU core of the tenant stored in the storage space, and the average usage rate of the CPU core is an average of the usage rates of the CPU cores rented by the tenant within the set duration. value.
  • Step 302 the CPU management allocator determines whether the average usage rate of the tenant's CPU core is less than the minimum usage rate of the CPU core preset for the tenant, and if so, step 304 is performed, otherwise step 303 is performed;
  • Step 303 the CPU management allocator determines whether the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, and if so, step 305 is performed, otherwise step 306 is performed;
  • Step 304 The CPU management allocator determines the number of CPU cores that can be released in the CPU core rented by the tenant, and adds a corresponding number of CPU core information that can be released to the idle linked list, and the CPU core information saved in the idle linked list The corresponding CPU core is used for reallocation, and step 306 is performed.
  • Step 305 The CPU management allocator determines the number of CPU cores that can be used for reallocation in the CPU core rented by the tenant, and uses the corresponding number of CPU core information that can be used for reallocation and the priority of the tenant to lease the CPU core.
  • the mapping of the level information is added to the candidate linked list, and the CPU core corresponding to the CPU core information saved in the candidate linked list is used for reallocation, and step 306 is performed.
  • Step 306 The CPU management allocator determines whether there is still a tenant in the storage space that needs to estimate the average usage rate of the CPU core in the set time period. If yes, the current tenant is switched to the next tenant adjacent to the current tenant priority information, and then Go to step 301, otherwise go to step 307;
  • the CPU management allocator sequentially executes according to the priority order of the CPU cores that are greater than the expected usage rate of the pre-set CPU cores.
  • Step 307 The CPU management allocator determines the number of CPU cores that the tenant needs to apply for lease when determining that the average usage rate of the tenant's CPU core is greater than the expected usage rate preset for the tenant;
  • Step 308 the CPU management allocator determines that the average usage rate of the tenant's CPU core is greater than the maximum usage rate of the CPU core preset for the tenant, and the free linked list is not empty, then selects the CPU that needs to be applied from the free list.
  • the core information is allocated to the tenant corresponding to the selected CPU core information.
  • Step 309 if the CPU management allocator determines that the average usage rate of the tenant's CPU core is greater than the maximum usage rate of the CPU core preset for the tenant, and the free linked list is empty, the CPU core priority is rented from the candidate linked list according to the tenant. In the low-to-high order, select the CPU core information that needs to be applied, and assign the CPU core corresponding to the selected CPU core information to the tenant.
  • Step 310 The CPU management allocator determines that the average usage rate of the tenant's CPU core is greater than the expected usage rate of the CPU core preset for the tenant, less than the maximum usage rate of the CPU core preset for the tenant, and the idle chain. If the table is empty, the tenant is no longer assigned a CPU core.
  • Step 311 The CPU management allocator determines that the average usage rate of the tenant's CPU core is greater than the expected usage rate of the CPU core preset for the tenant, less than the maximum usage rate of the CPU core preset for the tenant, and the free list is not If it is empty, the CPU core information that needs to be applied is selected from the free list, and the CPU core corresponding to the selected CPU core information is allocated to the tenant for use.
  • the embodiment of the present invention further provides a device for multi-tenant sharing resources.
  • the method for multi-tenant sharing resources in the embodiment of the present invention is a method for multi-tenant sharing resources, and thus the present invention is implemented.
  • the implementation of the device of the example refer to the implementation of the method, and the repeated description is not repeated.
  • an apparatus for sharing resources by a multi-tenant includes:
  • the calculation module 400 is configured to estimate the average usage rate of the tenant's CPU core.
  • the average usage rate of the CPU core is an average value of the usage rates of the CPU cores rented by the tenant within the set time period, and the tenant is managed by the CPU management distributor. Any tenant already stored in the storage space;
  • the determining module 401 is configured to: when determining that the average usage rate of the CPU core of the tenant is less than the expected usage rate of the CPU core preset for the tenant, the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant Added to the preset CPU core linked list in the storage space, the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation; determining that the average usage rate of the tenant's CPU core is greater than the expected use of the preset CPU core At the time of the rate, the tenant is assigned a CPU core corresponding to at least one CPU core information in the CPU core linked list.
  • the optional device further includes: a processing module 402, configured to allocate, to the new tenant, a CPU core corresponding to at least one CPU core information in the CPU core linked list when the new tenant is added in the storage space.
  • a processing module 402 configured to allocate, to the new tenant, a CPU core corresponding to at least one CPU core information in the CPU core linked list when the new tenant is added in the storage space.
  • the CPU core linked list includes a free linked list and a candidate linked list; and the determining module 401 is specifically configured to: when the average usage rate of the tenant's CPU core is less than the minimum usage rate of the CPU core preset for the tenant, the tenants are rented The CPU core information corresponding to at least one CPU core in the CPU core is added to the free list; when the average usage rate of the tenant's CPU core is greater than the minimum usage rate of the CPU core preset for the tenant, and less than the CPU core preset for the tenant When the expected usage rate is used, the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant, and the lease priority information mapping of the tenant leased CPU core are added to the candidate linked list; wherein, the tenant's CPU core The expected usage rate is greater than the minimum usage of the tenant's CPU core.
  • the determining module 401 is specifically configured to: if it is determined that the average usage rate of the tenant's CPU core is greater than the maximum usage rate of the CPU core preset for the tenant, and the free linked list is empty, according to the lease priority stored in the candidate linked list.
  • the CPU core information corresponding to the at least one lease priority information selected in the order from low to high, the CPU core corresponding to the selected CPU core information is allocated to the tenant; if the average usage rate of the CPU core of the tenant is determined to be greater than The CPU core of the idle list is allocated to the tenant, and the expected CPU usage of the tenant core is less than the tenant The maximum usage of the CPU core.
  • the determining module 401 is further configured to: if it is determined that the average usage rate of the tenant's CPU core is greater than the expected usage rate of the CPU core preset for the tenant, and less than the maximum usage rate of the CPU core preset for the tenant, and idle If the linked list is empty, the CPU core is no longer assigned to the tenant.
  • the determining module 401 is further configured to: if it is determined that the CPU core needs to be allocated to at least two tenants, the lease priority information of the CPU cores rented by each of the at least two tenants is in descending order, Each tenant is assigned a CPU core.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or may exist as a separate physical entity, or two or more modules may be integrated into one.
  • the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated modules if implemented in the form of software functional modules and sold or used as separate products, may be stored in a computer readable storage medium.
  • the medium includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the methods described in various embodiments of the present application.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
  • a hardware structure diagram of a device 50 for multi-tenant sharing resources includes a processor 51, a memory 52, an input/output interface 53, a communication interface 54 and a bus 55, wherein the processor 51, The memory 52, the input/output interface 53 and the communication interface 54 realize a communication connection with each other through the bus 55.
  • the bus is indicated by a thick line in FIG. 5, and the connection manner between other components is merely illustrative, and is not To be limited.
  • the bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 5, but it does not mean that there is only one bus or one type of bus.
  • the processor 51 may include a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits for executing related programs.
  • CPU general-purpose central processing unit
  • ASIC application specific integrated circuit
  • the memory 52 may be a read only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM).
  • Memory 52 can store operating systems, other applications, and operational data.
  • the program code for implementing the technical solution provided by the embodiment of the present invention is stored in the memory 52 and executed by the processor 51 when the technical solution provided by the embodiment of the present invention is implemented by software or firmware.
  • the CPU management allocator estimates the average usage rate of the tenant's CPU core.
  • the average usage rate of the CPU core is the average value of the usage rate of each CPU core rented by the tenant within the set duration.
  • the tenant is The CPU manages any tenant stored in the storage space managed by the allocator.
  • the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, at least each of the CPU cores rented by the tenant is The CPU core information corresponding to a CPU core is added to the preset CPU core linked list in the storage space, and the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation, and if the average usage rate of the tenant's CPU core is determined to be greater than The pre-set CPU core's expected usage rate is assigned to the tenant by the CPU core corresponding to at least one CPU core information in the CPU core linked list.
  • This technical solution can be based on the estimated tenant average usage rate. Dynamically allocating CPU cores rented by tenants stored in the storage space, thereby avoiding the unreasonable problem of CPU core allocation caused by competition in the prior art. When reducing the number of switches CPU core, thereby increasing the efficiency of the processing needs of the tenants.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the present invention may employ computer programs implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) in which computer usable program code is embodied. The form of the product.
  • computer usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Abstract

Provided are a method and a device for sharing resources among multiple tenants. Said method comprises: a CPU management allocator estimating an average usage of CPU cores of a tenant; if it is determined that the average usage of the CPU cores of the tenant is less than an expected usage of the CPU cores that is preset for the tenant, adding CPU core information corresponding to the at least one CPU core rented by the tenant into a preset CPU core link list in a storage space; and if it is determined that the average usage of the CPU core of the tenant is greater than the preset expected usage of the CPU cores, allocating to the tenant a CPU core respectively corresponding to the at least one piece of CPU core information in the CPU core link list. Since the CPU management allocator is able to dynamically allocate the CPU cores rented by the tenant that is stored in the storage space, said method avoids the problem of unreasonable allocation of CPU cores.

Description

一种多租户资源共享的方法及装置Method and device for sharing multi-tenant resources
本申请要求在2016年2月5日提交中国专利局、申请号为201610082020.7、申请名称为“一种多租户资源共享的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application, filed on Feb. 5, 2016, the Chinese Patent Application No. 201610082020.7, the entire disclosure of which is incorporated herein In this application.
技术领域Technical field
本发明涉及计算机技术领域,特别涉及一种多租户资源共享的方法及装置。The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for multi-tenant resource sharing.
背景技术Background technique
在云计算时代,大量的计算资源集中到一起,统一为用户提供服务,用户从云上租用计算资源,既可以享受低成本的好处,又可以得到安全性、可靠性的保证,其中,用户又称为租户,一个租户通常对应一个组织,例如公司、学校等。In the era of cloud computing, a large number of computing resources are brought together to provide services for users. Users can rent computing resources from the cloud, which can enjoy the benefits of low cost, and can be secured by security and reliability. Known as a tenant, a tenant usually corresponds to an organization, such as a company, a school, and so on.
在现有技术中计算资源是以CPU(Central Processing Unit,中央处理器)核为单位划分的,所有租户通过竞争机制来获取CPU核,这样容易导致不同的租户竞争到的CPU核差异较大,有可能竞争到CPU核较多的租户仅需较少的CPU核即能满足该租户的需求,而竞争到CPU核较少的租户需要较多的CPU核才能满足该租户的需求,造成CPU核资源分配不合理,此外,租户的竞争CPU核的能力随着时间的不同,可能会发生变化,例如该时刻该租户的网络环境较好,竞争到较多的CPU核,下一时刻网络环境变差,用于服务该租户的CPU核就有可能为其他租户服务,导致CPU核切换次数增多,处理租户需求的效率低。In the prior art, computing resources are divided by a CPU (Central Processing Unit) core, and all tenants obtain a CPU core through a competition mechanism, which easily leads to a large difference in CPU cores that different tenants compete for. It is possible for a tenant who competes more CPU cores to meet the needs of the tenant with fewer CPU cores, and tenants competing for fewer CPU cores need more CPU cores to meet the needs of the tenant, resulting in a CPU core. The resource allocation is unreasonable. In addition, the ability of the tenant to compete for the CPU core may change with time. For example, the tenant's network environment is better at this moment, competing for more CPU cores, and the next time the network environment changes. Poor, the CPU core used to serve the tenant may serve other tenants, resulting in an increase in the number of CPU core switches and inefficient handling of tenant demand.
发明内容Summary of the invention
本发明提供一种多租户共享资源的方法及装置,用以解决现有技术中存在的CPU核分配不合理以及由于租户通过竞争机制来获取CPU核,导致的CPU核切换次数增多,处理租户需求效率低的问题。The present invention provides a method and an apparatus for multi-tenant sharing resources, which are used to solve the problem that the CPU core allocation in the prior art is unreasonable and the number of CPU core switching times is increased due to the tenant acquiring the CPU core through the competition mechanism, and the tenant demand is processed. Inefficient problem.
第一方面,提供了一种多租户共享资源的方法,包括:In a first aspect, a method for multi-tenant sharing resources is provided, including:
中央处理器CPU管理分配器预估租户的CPU核的平均使用率;若确定所述租户的CPU核的平均使用率小于针对所述租户预先设置的CPU核的期望使用率,则将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到所述存储空间中预设的CPU核链表中,所述CPU核链表中存储的CPU核信息对应的CPU核用于重新分配;若确定所述租户的CPU核的平均使用率大于所述预先设置的CPU核的期望使用率,则为所述租户分配所述CPU核链表中的至少一个CPU核信息分别对应的CPU核,其中,所述CPU核的平均使用率为所述租户在设定时长内所租用的各个CPU核的使用率的平均值,所述租户为所述CPU管理分配器管理的存储空间中已存储的任意租户。The central processor CPU management distributor estimates the average usage rate of the tenant's CPU core; if it is determined that the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, the tenant is The CPU core information corresponding to at least one CPU core of each of the leased CPU cores is added to a preset CPU core linked list in the storage space, and the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for re Assigning; if it is determined that the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the preset CPU core, assigning, to the tenant, a CPU core corresponding to at least one CPU core information in the CPU core linked list respectively The average usage rate of the CPU core is an average value of usage rates of the CPU cores rented by the tenant within a set time period, and the tenant is stored in a storage space managed by the CPU management distributor. Any tenant.
由于CPU管理分配器能够预估设定时长内租户的CPU核的平均使用率,且在当该租户的CPU核的平均使用率小于针对该租户预先设置的CPU核的期望使用率时,将该租户所租用的CPU核中至少一个CPU核对应的CPU核信息添加到CPU核链表中,用于重新分配,当确定租户需要租用CPU核时,则从CPU核链表中选择至少一个已存储的CPU核信息分别对应的CPU核分配给该租户,从而通过对租户在设定时长内CPU核的平均使用 率的预估,使得CPU管理分配器管理能够根据预估的租户的平均使用率,动态地分配存储空间中已存储的租户所租用的CPU核,从而避免了现有技术中因竞争导致的CPU核分配的不合理的问题,同时减少了CPU核的切换次数,从而提高了处理租户需求的效率。Since the CPU management allocator can estimate the average usage rate of the CPU core of the tenant within the set duration, and when the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, The CPU core information corresponding to at least one CPU core of the CPU core leased by the tenant is added to the CPU core list for redistribution. When it is determined that the tenant needs to rent the CPU core, at least one stored CPU is selected from the CPU core list. The CPU core corresponding to the core information is assigned to the tenant, thereby passing the average use of the CPU core to the tenant within the set duration. The estimation of the rate enables the CPU management allocator management to dynamically allocate the CPU cores rented by the tenants stored in the storage space according to the estimated average usage rate of the tenants, thereby avoiding the CPU caused by the competition in the prior art. The unreasonable problem of nuclear distribution, while reducing the number of CPU core switching, thus improving the efficiency of processing tenant needs.
在第一方面的基础上,可选的,所述方法还包括:所述CPU管理分配器在所述存储空间中增加的新租户时,则为所述新租户分配所述CPU核链表中的至少一个CPU核信息分别对应的CPU核。On the basis of the first aspect, the method further includes: when the CPU manages a new tenant added to the storage space, the new tenant is allocated in the CPU core list. At least one CPU core information corresponding to the CPU core.
由于当在存储空间中增加新的租户时,能够为该新组户分配CPU核链表中的至少一个CPU核信息分别对应的CPU核,避免了新用户通过竞争机制,竞争CPU核,从而避免了现有技术中因竞争导致的CPU核分配的不合理的问题,同时减少了CPU核的切换次数,从而提高了处理租户需求的效率。When a new tenant is added to the storage space, the CPU core corresponding to at least one CPU core information in the CPU core linked list can be allocated to the new group, thereby avoiding new users competing for the CPU core through the competition mechanism, thereby avoiding In the prior art, the unreasonable problem of CPU core allocation due to competition, while reducing the number of CPU core switching, thereby improving the efficiency of processing tenant requirements.
在第一方面的基础上,可选的,所述CPU核链表包括空闲链表和候选链表;当所述租户的CPU核的平均使用率小于针对所述租户预先设置的CPU核的最小使用率时,所述CPU管理分配器将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到所述空闲链表中;当所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的最小使用率、且小于针对所述租户预先设置的CPU核的期望使用率时,所述CPU管理分配器将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息,以及所述租户租用CPU核的租用优先级信息映射添加到所述候选链表中;其中,所述租户的CPU核的期望使用率大于所述租户的CPU核的最小使用率。On the basis of the first aspect, optionally, the CPU core linked list includes an idle linked list and a candidate linked list; when the average usage rate of the tenant's CPU core is less than the minimum usage rate of the CPU core preset for the tenant The CPU management allocator adds CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant to the free list; when the average usage rate of the CPU core of the tenant is greater than When the minimum usage rate of the CPU core preset by the tenant is less than the expected usage rate of the CPU core preset for the tenant, the CPU management distributor allocates at least one CPU of each CPU core rented by the tenant The CPU core information corresponding to the core and the lease priority information mapping of the tenant lease CPU core are added to the candidate linked list; wherein, the expected usage rate of the tenant's CPU core is greater than the minimum usage of the tenant's CPU core rate.
由于当预估的租户的CPU核的平均使用率小于针对该租户预先设置的CPU核的最小使用率时,该租户可以减少租用CPU核的个数,因此将减少租用的CPU核的核信息添加的空闲链表中,而当预估的租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的最小使用率、小于针对该租户预先设置的CPU核的期望使用率时,说明该租户对租用的CPU核有需求,能够在其他租户对CPU核有需求、且没有空闲的CPU核可以租用时,可以将该租户的CPU核作为一种候选方案,通过细化CPU核链表,进一步使得对租户所租用的CPU核的分配更加合理。Since the average usage rate of the estimated tenant's CPU core is less than the minimum usage rate of the CPU core preset for the tenant, the tenant can reduce the number of CPU cores to be rented, thus reducing the nuclear information of the leased CPU core. In the free list, when the average usage rate of the CPU core of the estimated tenant is greater than the minimum usage rate of the CPU core preset for the tenant, and less than the expected usage rate of the CPU core preset for the tenant, the tenant is explained There is a demand for the leased CPU core. When other tenants have CPU core requirements and no idle CPU core can be rented, the tenant's CPU core can be used as a candidate solution to further refine the CPU core list. The allocation of CPU cores rented by tenants is more reasonable.
在第一方面的基础上,可选的,所述CPU管理分配器若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的最大使用率、且所述空闲链表为空,则按照所述候选链表中存储的租用优先级信息从低到高的顺序选择出的至少一个租用优先级信息分别对应的CPU核信息,将选择出的CPU核信息对应的CPU核分配给所述租户;若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的期望使用率、且所述空闲链表不为空,则将所述空闲链表中存储的至少一个CPU核信息对应的CPU核分配给所述租户;其中,所述租户的CPU核的期望使用率小于所述租户的CPU核的最大使用率。On the basis of the first aspect, optionally, the CPU management allocator determines that an average usage rate of the CPU core of the tenant is greater than a maximum usage rate of a CPU core preset for the tenant, and the free list is If it is empty, the CPU core information corresponding to the at least one lease priority information selected in descending order of the lease priority information stored in the candidate linked list is selected, and the CPU core corresponding to the selected CPU core information is allocated. Giving the tenant; if it is determined that the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the CPU core preset for the tenant, and the free linked list is not empty, storing the stored in the free list A CPU core corresponding to at least one CPU core information is allocated to the tenant; wherein a desired usage rate of the tenant's CPU core is less than a maximum usage rate of the tenant's CPU core.
由于CPU管理分配器通过针对该租户的CPU核的期望使用率和针对该租户的最大使用率,对分配CPU核的方案进行进一步的细化,使得对租户所租用的CPU核的分配更加合理,并且优先将租户优先级低的CPU核提供给需要CPU核租户,从而保证了高优先级组户的使用。Since the CPU management allocator further refines the scheme for allocating the CPU core by using the expected usage rate of the CPU core of the tenant and the maximum usage rate for the tenant, the allocation of the CPU core leased by the tenant is more reasonable. And the CPU core with low priority of the tenant is preferentially provided to the CPU core tenant, thereby ensuring the use of the high priority group.
在第一方面的基础上,可选的,所述CPU管理分配器若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的期望使用率、且小于针对所述租户预先设置的CPU核的最大使用率、且所述空闲链表为空,则不再为所述租户分配CPU核。 On the basis of the first aspect, optionally, the CPU management allocator determines that an average usage rate of the CPU core of the tenant is greater than a expected usage rate of a CPU core preset for the tenant, and is smaller than If the maximum usage rate of the CPU core preset by the tenant is empty and the free list is empty, the CPU core is no longer allocated to the tenant.
由于该方案对分配CPU核的方案进行了进一步的细化,使得对租户所租用的CPU核的分配更加合理。Because the scheme further refines the scheme for allocating CPU cores, the allocation of CPU cores rented by tenants is more reasonable.
在第一方面的基础上,可选的,所述CPU管理分配器若确定需要为至少两个租户分配CPU核,则按照至少两个租户中每个租户租用CPU核的租用优先级信息从高到低的顺序,分别为所述每个租户分配CPU核。On the basis of the first aspect, optionally, if the CPU management allocator determines that the CPU core needs to be allocated for at least two tenants, the lease priority information of the CPU core is rented according to each of the at least two tenants. In the low order, each of the tenants is assigned a CPU core.
由于CPU管理分配器在确定至少需要为两个租户分配CPU核时,优先为优先级高的租户分配CPU核,因此保证了优先级高的租户对于CPU核的需求。Since the CPU management allocator allocates a CPU core to a tenant with a high priority priority when it is determined that at least two CPUs are allocated to the tenant, the demand of the high priority tenant for the CPU core is ensured.
第二方面,提供了一种多租户共享资源的装置,包括:计算模块、判断模块;其中,计算模块用于预估租户的CPU核的平均使用率,所述CPU核的平均使用率为所述租户在设定时长内所租用的各个CPU核的使用率的平均值,所述租户为所述CPU管理分配器管理的存储空间中已存储的任意租户;判断模块用于在确定所述租户的CPU核的平均使用率小于针对所述租户预先设置的CPU核的期望使用率时,则将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到所述存储空间中预设的CPU核链表中,所述CPU核链表中存储的CPU核信息对应的CPU核用于重新分配;在确定所述租户的CPU核的平均使用率大于所述预先设置的CPU核的期望使用率时,则为所述租户分配所述CPU核链表中的至少一个CPU核信息分别对应的CPU核。The second aspect provides an apparatus for sharing resources by a multi-tenant, including: a calculation module and a judgment module; wherein the calculation module is configured to estimate an average usage rate of the tenant's CPU core, and the average usage rate of the CPU core is An average value of usage rates of the CPU cores rented by the tenant in the set time period, the tenant is any tenant stored in the storage space managed by the CPU management splitter; the determining module is configured to determine the tenant When the average usage rate of the CPU core is less than the expected usage rate of the CPU core preset for the tenant, the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant is added to the storage. In the CPU core linked list preset in the space, the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation; determining that the average usage rate of the tenant's CPU core is greater than the preset CPU core When the expected usage rate is reached, the tenant is allocated a CPU core corresponding to at least one CPU core information in the CPU core linked list.
由于计算模块能够预估设定时长内租户的CPU核的平均使用率,且判断模块在当该租户的CPU核的平均使用率小于针对该租户预先设置的CPU核的期望使用率时,将该租户所租用的CPU核中至少一个CPU核对应的CPU核信息添加到CPU核链表中,用于重新分配,当确定租户需要租用CPU核时,则从CPU核链表中选择至少一个已存储的CPU核信息分别对应的CPU核分配给该租户,从而通过对租户在设定时长内CPU核的平均使用率的预估,使得该装置能够根据预估的租户的平均使用率,动态地分配存储空间中已存储的租户所租用的CPU核,从而避免了现有技术中因竞争导致的CPU核分配的不合理的问题,同时减少了CPU核的切换次数,从而提高了处理租户需求的效率。Since the calculation module can estimate the average usage rate of the CPU core of the tenant within the set duration, and the judging module is when the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, The CPU core information corresponding to at least one CPU core of the CPU core leased by the tenant is added to the CPU core list for redistribution. When it is determined that the tenant needs to rent the CPU core, at least one stored CPU is selected from the CPU core list. The CPU core corresponding to the core information is allocated to the tenant, so that the device can dynamically allocate the storage space according to the estimated average occupancy rate of the tenant by estimating the average usage rate of the CPU core within the set time period. The CPU cores rented by the tenants stored in the system avoid the unreasonable problem of the CPU core allocation caused by the competition in the prior art, and reduce the number of switching of the CPU cores, thereby improving the efficiency of processing the tenant requirements.
在第二方面的基础上,可选的,该装置还包括:处理模块;所述处理模块用于在所述存储空间中增加的新租户时,则为所述新租户分配所述CPU核链表中的至少一个CPU核信息分别对应的CPU核。On the basis of the second aspect, optionally, the apparatus further includes: a processing module; when the processing module is configured to add a new tenant in the storage space, assign the CPU core linked list to the new tenant At least one of the CPU core information corresponds to the CPU core.
由于当在存储空间中增加新的租户时,能够为该新组户分配CPU核链表中的至少一个CPU核信息分别对应的CPU核,避免了新用户通过竞争机制,竞争CPU核,从而避免了现有技术中因竞争导致的CPU核分配的不合理的问题,同时减少了CPU核的切换次数,从而提高了处理租户需求的效率。When a new tenant is added to the storage space, the CPU core corresponding to at least one CPU core information in the CPU core linked list can be allocated to the new group, thereby avoiding new users competing for the CPU core through the competition mechanism, thereby avoiding In the prior art, the unreasonable problem of CPU core allocation due to competition, while reducing the number of CPU core switching, thereby improving the efficiency of processing tenant requirements.
在第二方面的基础上,可选的,所述CPU核链表包括空闲链表和候选链表;所述判断模块,具体用于当所述租户的CPU核的平均使用率小于针对所述租户预先设置的CPU核的最小使用率时,将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到所述空闲链表中;当所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的最小使用率、且小于针对所述租户预先设置的CPU核的期望使用率时,将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息,以及所述租户租用CPU核的租用优先级信息映射添加到所述候选链表中;其中,所述租户的CPU核的期望使用率大于所述租户的CPU核的最小使用率。On the basis of the second aspect, optionally, the CPU core linked list includes a free linked list and a candidate linked list; and the determining module is specifically configured to: when an average usage rate of the tenant's CPU core is less than preset for the tenant When the minimum usage rate of the CPU core is used, CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant is added to the free list; when the average usage rate of the CPU core of the tenant is greater than a CPU corresponding to at least one of the CPU cores rented by the tenant when the minimum usage rate of the CPU core set in advance by the tenant is smaller than the expected usage rate of the CPU core preset for the tenant The core information, and the lease priority information map of the tenant lease CPU core are added to the candidate list; wherein the expected usage rate of the tenant's CPU core is greater than the minimum usage rate of the tenant's CPU core.
由于当预估的租户的CPU核的平均使用率小于针对该租户预先设置的CPU核的最小 使用率时,该租户可以减少租用CPU核的个数,因此将减少租用的CPU核的核信息添加的空闲链表中,而当预估的租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的最小使用率、小于针对该租户预先设置的CPU核的期望使用率时,说明该租户对租用的CPU核有需求,能够在其他租户对CPU核有需求、且没有空闲的CPU核可以租用时,可以将该租户的CPU核作为一种候选方案,通过细化CPU核链表,进一步使得对租户所租用的CPU核的分配更加合理。Because the average usage of the CPU core of the estimated tenant is less than the minimum of the CPU core preset for the tenant. When the usage rate is used, the tenant can reduce the number of CPU cores leased, so the core information of the leased CPU core is added to the free list, and the average usage of the CPU core of the estimated tenant is greater than the preset for the tenant. When the minimum usage rate of the CPU core is less than the expected usage rate of the CPU core preset for the tenant, the tenant has a demand for the rented CPU core, and the other CPU has a CPU core requirement and no free CPU core. When the lease is available, the tenant's CPU core can be used as a candidate solution. By refining the CPU core linked list, the allocation of the CPU cores rented by the tenants is further rationalized.
在第二方面的基础上,可选的,所述判断模块,具体用于若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的最大使用率、且所述空闲链表为空,则按照所述候选链表中存储的租用优先级信息从低到高的顺序选择出的至少一个租用优先级信息分别对应的CPU核信息,将选择出的CPU核信息对应的CPU核分配给所述租户;若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的期望使用率、且所述空闲链表不为空,则将所述空闲链表中存储的至少一个CPU核信息对应的CPU核分配给所述租户;其中,所述租户的CPU核的期望使用率小于所述租户的CPU核的最大使用率。On the basis of the second aspect, the determining module is specifically configured to: if it is determined that an average usage rate of the CPU core of the tenant is greater than a maximum usage rate of a CPU core preset for the tenant, and If the free list is empty, the CPU core information corresponding to the at least one lease priority information selected in descending order of the lease priority information stored in the candidate linked list is selected, and the CPU corresponding to the selected CPU core information is selected. The core is allocated to the tenant; if it is determined that the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the CPU core preset for the tenant, and the free linked list is not empty, then the idle linked list is A CPU core corresponding to the stored at least one CPU core information is allocated to the tenant; wherein a desired usage rate of the tenant's CPU core is less than a maximum usage rate of the tenant's CPU core.
由于通过针对该租户的CPU核的期望使用率和针对该租户的最大使用率,对分配CPU核的方案进行进一步的细化,使得对租户所租用的CPU核的分配更加合理,并且优先将租户优先级低的CPU核提供给需要CPU核租户,从而保证了高优先级组户的使用。Since the scheme for allocating the CPU core is further refined by the expected usage rate of the CPU core for the tenant and the maximum usage rate for the tenant, the allocation of the CPU core leased by the tenant is more reasonable, and the tenant is preferentially prioritized. A CPU with a lower priority is provided to the CPU core tenant, thus ensuring the use of high priority groups.
在第二方面的基础上,可选的,所述判断模块,还用于若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的期望使用率、且小于针对所述租户预先设置的CPU核的最大使用率、且所述空闲链表为空,则不再为所述租户分配CPU核。On the basis of the second aspect, optionally, the determining module is further configured to: if it is determined that an average usage rate of the CPU core of the tenant is greater than a expected usage rate of a CPU core preset for the tenant, and less than If the tenant has a maximum usage rate of the CPU core set in advance, and the free linked list is empty, the CPU core is no longer allocated to the tenant.
由于该方案对分配CPU核的方案进行了进一步的细化,使得对租户所租用的CPU核的分配更加合理。Because the scheme further refines the scheme for allocating CPU cores, the allocation of CPU cores rented by tenants is more reasonable.
在第二方面的基础上,可选的,所述判断模块,还用于若确定需要为至少两个租户分配CPU核,则按照至少两个租户中每个租户租用CPU核的租用优先级信息从高到低的顺序,分别为所述每个租户分配CPU核。On the basis of the second aspect, the determining module is further configured to: if it is determined that the CPU core needs to be allocated to at least two tenants, renting the CPU core's lease priority information according to each of the at least two tenants. From the highest to the lowest order, each of the tenants is assigned a CPU core.
由于CPU管理分配器在确定至少需要为两个租户分配CPU核时,优先为优先级高的租户分配CPU核,因此保证了优先级高的租户对于CPU核的需求。Since the CPU management allocator allocates a CPU core to a tenant with a high priority priority when it is determined that at least two CPUs are allocated to the tenant, the demand of the high priority tenant for the CPU core is ensured.
附图说明DRAWINGS
图1a为本发明实施例多租户共享资源的系统架构示意图;1a is a schematic diagram of a system architecture of a multi-tenant shared resource according to an embodiment of the present invention;
图1b为本发明实施例服务器结构示意图;1b is a schematic structural diagram of a server according to an embodiment of the present invention;
图2为本发明实施例多租户共享资源的方法流程示意图;2 is a schematic flowchart of a method for multi-tenant sharing resources according to an embodiment of the present invention;
图3为本发明实施例多租户共享资源的方法流程示意图;3 is a schematic flowchart of a method for multi-tenant sharing resources according to an embodiment of the present invention;
图4为本发明实施例多租户共享资源的装置的示意图;4 is a schematic diagram of an apparatus for multi-tenant sharing resources according to an embodiment of the present invention;
图5为本发明实施例多租户共享资源的装置的硬件结构示意图。FIG. 5 is a schematic structural diagram of hardware of an apparatus for multi-tenant sharing resources according to an embodiment of the present invention.
具体实施方式detailed description
为了使本发明的目的、技术方案和优点更加清楚,下面结合说明书附图对本发明实施例作进一步详细描述。In order to make the objects, technical solutions, and advantages of the present invention more comprehensible, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings.
为使得每个租户能够从云端租用到CPU核来满足该租户的需求,解决现有技术中存在 的CPU核分配不合理以及CPU核切换次数较多的问题,本发明实施例提供了一种多租户共享资源的方法。In order to enable each tenant to rent from the cloud to the CPU core to meet the needs of the tenant, the solution exists in the prior art. The method of the multi-tenant sharing resources is provided by the embodiment of the present invention.
图1a为本发明实施例多租户共享资源的系统架构示意图,该系统架构包括:服务器、和多个终端设备,其中服务器如图1b所示,包括CPU管理分配器和多个CPU核,其中,租户通过终端设备中的APP(应用,Application)向服务器发送请求,服务器通过CPU管理分配器为租户分配CPU核,执行租户的请求,CPU管理分配器通过CPU管理分配器所管理的存储空间记录租户的相关信息,该信息包括但不限于租户自身的信息,如优先级、名称等,租户使用CPU核的使用记录等。FIG. 1 is a schematic diagram of a system architecture of a multi-tenant shared resource according to an embodiment of the present invention. The system architecture includes: a server, and a plurality of terminal devices, where the server includes a CPU management allocator and a plurality of CPU cores, where The tenant sends a request to the server through the APP (Application) in the terminal device. The server allocates a CPU core to the tenant through the CPU management allocator, and performs a request of the tenant. The CPU management allocator records the tenant through the storage space managed by the CPU management allocator. Relevant information, including but not limited to the tenant's own information, such as priority, name, etc., the tenant uses the CPU core usage record.
采用本发明实施例提供的技术方案,由于CPU管理分配器能够根据预估的租户CPU核的平均使用率,动态地为CPU管理分配器所管理的存储空间中已存储的租户分配CPU核,从而避免了现有技术中因竞争导致的CPU核分配的不合理的问题,同时减少了CPU核的切换次数,从而提高了处理租户需求的效率。According to the technical solution provided by the embodiment of the present invention, the CPU management allocator can dynamically allocate the CPU core to the stored tenants in the storage space managed by the CPU management agent according to the estimated average usage rate of the tenant CPU core, thereby The irrational problem of the CPU core allocation caused by the competition in the prior art is avoided, and the number of switching of the CPU core is reduced, thereby improving the efficiency of processing the tenant demand.
下面对本发明实施例提供的技术方案进行详细说明。The technical solutions provided by the embodiments of the present invention are described in detail below.
如图2所示,本发明实施例多租户共享资源的方法,包括:As shown in FIG. 2, a method for a multi-tenant to share resources according to an embodiment of the present invention includes:
步骤200,CPU管理分配器预估租户的CPU核的平均使用率,CPU核的平均使用率为租户在设定时长内所租用的各个CPU核的使用率的平均值,租户为CPU管理分配器管理的存储空间中已存储的任意租户;In step 200, the CPU management allocator estimates the average usage rate of the tenant's CPU core. The average usage rate of the CPU core is the average value of the usage rate of each CPU core rented by the tenant within the set time period, and the tenant is the CPU management allocator. Any tenant that has been stored in the managed storage space;
步骤201,CPU管理分配器若确定租户的CPU核的平均使用率小于针对租户预先设置的CPU核的期望使用率,则将租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到存储空间中预设的CPU核链表中,CPU核链表中存储的CPU核信息对应的CPU核用于重新分配;Step 201: The CPU management distributor determines that the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, and the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant. Add to the preset CPU core linked list in the storage space, and the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation;
步骤202,CPU管理分配器若确定租户的CPU核的平均使用率大于预先设置的CPU核的期望使用率,则为租户分配CPU核链表中的至少一个CPU核信息分别对应的CPU核。Step 202: The CPU management allocator determines, for the tenant, a CPU core corresponding to at least one CPU core information in the CPU core linked list, if it is determined that the average usage rate of the tenant's CPU core is greater than a preset usage rate of the CPU core.
需要说明的是,在步骤200中,设定时长为CPU管理分配器预估第一租户的CPU核的平均使用率之后的一段时间,即CPU管理分配器估计的租户的CPU核的平均使用率为未来一段时间的该租户的CPU核的平均使用率。It should be noted that, in step 200, the set duration is a period of time after the CPU management allocator estimates the average usage rate of the CPU core of the first tenant, that is, the average usage rate of the CPU core of the tenant estimated by the CPU management allocator. The average usage rate of the CPU core of the tenant for a period of time in the future.
具体的,CPU管理分配器通过统计该租户CPU核运行数据,来预测或估计该租户在设定时长内的CPU核的平均使用率。Specifically, the CPU management allocator predicts or estimates the average usage rate of the CPU core of the tenant in the set duration by counting the tenant CPU core running data.
可选的,CPU管理分配器周期性估计第一租户的CPU核的平均使用率,具体的,CPU管理分配器在每周期开始时,估计该周期中第一租户的CPU核的平均使用率。Optionally, the CPU management allocator periodically estimates the average usage rate of the CPU core of the first tenant. Specifically, the CPU management allocator estimates the average usage rate of the CPU core of the first tenant in the period at the beginning of each period.
在步骤201中,当CPU管理分配器确定该租户的CPU核的平均使用率小于针对第一租户预先设置的CPU核的期望使用率时,根据预设的算法,确定第一租户租用的CPU核中能够用于重新分配的CPU核的个数,并将相应个数的CPU核信息添加到CPU核链表中。In step 201, when the CPU management allocator determines that the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the first tenant, the first tenant rents the CPU core according to a preset algorithm. The number of CPU cores that can be used for reallocation, and adds a corresponding number of CPU core information to the CPU core list.
若CPU核链表包括空闲链表和候选链表,可选的,当该租户的CPU核的平均使用率小于针对该租户预先设置的CPU核的最小使用率时,CPU管理分配器将该租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到空闲链表中;当该租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的最小使用率、且小于针对该租户预先设置的CPU核的期望使用率时,CPU管理分配器将该租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息,以及该租户租用CPU核的租用优先级信息映射添加到候选链表中;其中,该租户的CPU核的期望使用率大于该租户的CPU核的最小使用率。 If the CPU core linked list includes a free linked list and a candidate linked list, optionally, when the average usage rate of the tenant's CPU core is less than the minimum usage rate of the CPU core preset for the tenant, the CPU management allocator rents the tenant. The CPU core information corresponding to at least one CPU core of each CPU core is added to the idle linked list; when the average usage rate of the tenant's CPU core is greater than the minimum usage rate of the CPU core preset for the tenant, and less than for the tenant When the expected usage rate of the CPU core is set, the CPU management allocator adds the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant, and the lease priority information mapping of the tenant leased CPU core to the candidate. In the linked list; wherein the expected usage rate of the tenant's CPU core is greater than the minimum usage rate of the tenant's CPU core.
以租户1为例,针对租户1预先设置的CPU核的期望使用率为70%,针对租户1预先设置的CPU核的最小使用率为50%:Taking tenant 1 as an example, the expected usage rate of the CPU core preset for tenant 1 is 70%, and the minimum usage rate of the CPU core preset for tenant 1 is 50%:
情景一:若CPU管理分配器预估的租户1的CPU核的平均使用率为40%,由于CPU核的平均使用率小于针对租户1预先设置的CPU核的最小使用率,则根据预先设置的算法,确定释放的CPU核的个数为1,并将相应个数的CPU核的核信息添加到空闲链表中,具体的,确定释放的CPU核的个数为1的步骤可以如下:Scenario 1: If the average usage rate of the CPU core of the tenant 1 estimated by the CPU management allocator is 40%, since the average usage rate of the CPU core is smaller than the minimum usage rate of the CPU core preset for the tenant 1, according to the preset The algorithm determines that the number of released CPU cores is 1, and adds the corresponding number of cores of the CPU core to the free list. Specifically, the step of determining the number of released CPU cores is as follows:
租户1在设定时长中需要租用的CPU核的个数为n=40%/50%*N,当N=4时,n=3.2,向下取整,则在设定时长中需要租用CPU核的个数为4,其中,N为针对租户1预先设置的CPU核的期望个数,若当前租户1租用的CPU核的个数为5,则能够释放的CPU核的个数为1。The number of CPU cores that tenant 1 needs to lease during the set duration is n=40%/50%*N. When N=4, n=3.2, rounding down, the CPU needs to be rented in the set duration. The number of cores is four, where N is the expected number of CPU cores that are preset for the tenant 1. If the number of CPU cores rented by the current tenant 1 is five, the number of CPU cores that can be released is one.
其中,空闲链表中保存的CPU核信息对应的CPU核,指的是租户不再使用该CPU核,该CPU核处于空闲状态。The CPU core corresponding to the CPU core information stored in the free list indicates that the tenant no longer uses the CPU core, and the CPU core is in an idle state.
需要说明的是,确定释放的CPU核的个数的算法不限于上述算法,其他能够用于确定释放的CPU核的个数的算法均可。It should be noted that the algorithm for determining the number of released CPU cores is not limited to the above algorithm, and other algorithms that can be used to determine the number of released CPU cores may be used.
情景二:若CPU管理分配器估计的租户的CPU核的平均使用率为60%,由于CPU核的平均使用率大于最小使用率、且小于期望使用率,则根据预先设置的算法,确定能够用于重新分配的CPU核的个数,并将相应个数的CPU核的核信息、以及租户租用CPU核的优先级信息映射添加到候选链表中。Scenario 2: If the average usage rate of the CPU core of the tenant estimated by the CPU management allocator is 60%, since the average usage rate of the CPU core is greater than the minimum usage rate and less than the expected usage rate, it is determined according to a preset algorithm. The number of CPU cores to be reassigned, and the core information of the corresponding number of CPU cores and the priority information mapping of the tenant-learned CPU cores are added to the candidate list.
其中,候选链表中存储的CPU核信息对应的CPU核为租户当前还在使用的CPU核,当有需要申请CPU核的租户时,可将该CPU核分配给需要申请CPU核的租户。The CPU core corresponding to the CPU core information stored in the candidate linked list is the CPU core currently used by the tenant. When there is a tenant that needs to apply for the CPU core, the CPU core can be allocated to the tenant who needs to apply for the CPU core.
步骤202中,当确定租户的CPU核的平均使用率大于针对租户预先设置的CPU核的期望使用率时,进一步,根据预设的算法,确定该租户需要申请租用CPU核的个数。In step 202, when it is determined that the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the CPU core preset for the tenant, further determining the number of the CPU cores that the tenant needs to apply for renting according to a preset algorithm.
具体的,当租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的期望使用率、且小于针对该租户预先设置的CPU核的最大使用率,且空闲链表不为空时,则为该租户分配的确定个数的CPU核为空闲链表中存储的至少一个CPU核信息分别对应的CPU核,其中,针对租户预先设置的CPU核的最大使用率大于针对租户预先设置的CPU核的期望使用率。Specifically, when the average usage rate of the tenant's CPU core is greater than the expected usage rate of the CPU core preset for the tenant and less than the maximum usage rate of the CPU core preset for the tenant, and the free list is not empty, then The determined number of CPU cores allocated to the tenant is a CPU core corresponding to at least one CPU core information stored in the idle linked list, wherein the maximum usage rate of the CPU core preset for the tenant is greater than the CPU core preset for the tenant. Expected usage.
当租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的期望使用率、且小于针对该租户预先设置的CPU核的最大使用率,且空闲链表为空时,则不再为第二租户分配CPU核。When the average usage rate of the tenant's CPU core is greater than the expected usage rate of the CPU core preset for the tenant, and is less than the maximum usage rate of the CPU core preset for the tenant, and the free list is empty, it is no longer the first The second tenant allocates the CPU core.
当租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的最大使用率,且空闲链表不为空时,则为该租户分配的确定个数的CPU核为空闲链表中存储的CPU核信息分别对应的CPU核。When the average usage rate of the tenant's CPU core is greater than the maximum usage rate of the CPU core preset for the tenant, and the free list is not empty, the determined number of CPU cores allocated to the tenant is the CPU stored in the free list. The core information corresponds to the CPU core.
当租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的最大使用率,且空闲链表为空时,则为该租户分配的确定个数的CPU核为候选链表中存储的CPU核信息分别对应的CPU核。When the average usage rate of the tenant's CPU core is greater than the maximum usage rate of the CPU core preset for the tenant, and the free list is empty, the determined number of CPU cores allocated to the tenant is the CPU core stored in the candidate linked list. The CPU core corresponding to the information.
需要说明的是,当CPU管理分配器若确定需要为至少两个租户分配CPU核,则按照至少两个租户中每个租户租用CPU核的租用优先级信息从高到低的顺序,分别为每个租户分配CPU核。It should be noted that, when the CPU management allocator determines that the CPU core needs to be allocated for at least two tenants, the lease priority information of each of the at least two tenants renting the CPU core is in descending order, respectively. Each tenant allocates a CPU core.
此外,当CPU管理分配器所管理的存储空间中增加新租户时,CPU管理分配器为该 新租户分配CPU核链表中的至少一个CPU核信息分别对应的CPU核。In addition, when a new tenant is added to the storage space managed by the CPU management allocator, the CPU management allocator is The new tenant allocates a CPU core corresponding to at least one CPU core information in the CPU core linked list.
可选的,当CPU管理分配器所管理的存储空间中增加新租户时,CPU管理分配器若确定空闲链表不为空,则为该新租户分配空闲链表中的至少一个CPU核信息分别对应的CPU核;若确定空闲链表为空,则为该新租户分配候选链表中的至少一个CPU核信息分别对应的CPU核,从而保证新租户能够分配到能够使用的CPU核。Optionally, when a new tenant is added to the storage space managed by the CPU management allocator, if the CPU management allocator determines that the free linked list is not empty, the new tenant is allocated with at least one CPU core information in the free linked list. The CPU core is configured to allocate a CPU core corresponding to at least one CPU core information in the candidate linked list to the new tenant, so as to ensure that the new tenant can be allocated to the usable CPU core.
租户信息存储在CPU管理分配器所管理的存储空间中,如图3所示,本发明实施例多租户共享资源的方法,包括:The tenant information is stored in the storage space managed by the CPU management allocator. As shown in FIG. 3, the method for sharing resources by the multi-tenant according to the embodiment of the present invention includes:
步骤300,CPU管理分配器根据租户租用CPU核的优先级信息,确定存储空间中租户租用CPU的优先级的顺序。Step 300: The CPU management allocator determines the order of priority of the tenant to rent the CPU in the storage space according to the priority information of the tenant renting the CPU core.
CPU管理分配器确定空闲链表和候选链表中的能够用于重新分配的CPU核信息,按照租户租用CPU的优先级顺序,依次执行下列步骤:The CPU management allocator determines the CPU core information in the free list and the candidate list that can be used for reallocation, and performs the following steps in sequence according to the order of priority of the tenant to rent the CPU:
步骤301,CPU管理分配器预估存储空间中已存储的租户的CPU核的平均使用率,该CPU核的平均使用率为该租户在设定时长内所租用的各个CPU核的使用率的平均值。Step 301: The CPU management allocator estimates an average usage rate of the CPU core of the tenant stored in the storage space, and the average usage rate of the CPU core is an average of the usage rates of the CPU cores rented by the tenant within the set duration. value.
步骤302,CPU管理分配器判断该租户的CPU核的平均使用率是否小于针对该租户预先设置的CPU核的最小使用率,若是,则执行步骤304,否则执行步骤303; Step 302, the CPU management allocator determines whether the average usage rate of the tenant's CPU core is less than the minimum usage rate of the CPU core preset for the tenant, and if so, step 304 is performed, otherwise step 303 is performed;
步骤303,CPU管理分配器判断该租户的CPU核的平均使用率是否小于针对该租户预先设置的CPU核的期望使用率,若是,则执行步骤305,否则执行步骤306; Step 303, the CPU management allocator determines whether the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, and if so, step 305 is performed, otherwise step 306 is performed;
步骤304,CPU管理分配器确定该租户租用的CPU核中能够释放的CPU核的个数,并将能够释放的相应个数的CPU核信息添加到空闲链表中,空闲链表中保存的CPU核信息对应的CPU核用于重新分配,执行步骤306。Step 304: The CPU management allocator determines the number of CPU cores that can be released in the CPU core rented by the tenant, and adds a corresponding number of CPU core information that can be released to the idle linked list, and the CPU core information saved in the idle linked list The corresponding CPU core is used for reallocation, and step 306 is performed.
步骤305,CPU管理分配器确定该租户租用的CPU核中能够用于重新分配的CPU核的个数,并将能够用于重新分配的相应个数的CPU核信息以及该租户租用CPU核的优先级信息的映射添加到候选链表中,候选链表中保存的CPU核信息对应的CPU核用于重新分配,执行步骤306。Step 305: The CPU management allocator determines the number of CPU cores that can be used for reallocation in the CPU core rented by the tenant, and uses the corresponding number of CPU core information that can be used for reallocation and the priority of the tenant to lease the CPU core. The mapping of the level information is added to the candidate linked list, and the CPU core corresponding to the CPU core information saved in the candidate linked list is used for reallocation, and step 306 is performed.
步骤306,CPU管理分配器判断存储空间是否还存在需要预估设定时长内CPU核的平均使用率的租户,若是,将当前租户切换为与当前租户优先级信息相邻的下一个租户,重新执行步骤301,否则执行步骤307;Step 306: The CPU management allocator determines whether there is still a tenant in the storage space that needs to estimate the average usage rate of the CPU core in the set time period. If yes, the current tenant is switched to the next tenant adjacent to the current tenant priority information, and then Go to step 301, otherwise go to step 307;
CPU管理分配器按照CPU核的平均使用率大于预先设置的CPU核的期望使用率租户的优先级顺序,依次执行:The CPU management allocator sequentially executes according to the priority order of the CPU cores that are greater than the expected usage rate of the pre-set CPU cores.
步骤307,CPU管理分配器在确定租户的CPU核的平均使用率大于针对该租户预先设置的期望使用率时,确定该租户需要申请租用的CPU核的个数;Step 307: The CPU management allocator determines the number of CPU cores that the tenant needs to apply for lease when determining that the average usage rate of the tenant's CPU core is greater than the expected usage rate preset for the tenant;
步骤308,CPU管理分配器若确定租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的最大使用率、且空闲链表不为空,则从空闲链表中选择需要申请个数的CPU核信息,并将选择的CPU核信息分别对应的CPU核分配给该租户使用。 Step 308, the CPU management allocator determines that the average usage rate of the tenant's CPU core is greater than the maximum usage rate of the CPU core preset for the tenant, and the free linked list is not empty, then selects the CPU that needs to be applied from the free list. The core information is allocated to the tenant corresponding to the selected CPU core information.
步骤309,CPU管理分配器若确定租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的最大使用率、且空闲链表为空,则从候选链表中按照租户租用CPU核优先级从低到高顺序,选择需要申请个数的CPU核信息,并将选择的CPU核信息分别对应的CPU核分配给该租户使用。 Step 309, if the CPU management allocator determines that the average usage rate of the tenant's CPU core is greater than the maximum usage rate of the CPU core preset for the tenant, and the free linked list is empty, the CPU core priority is rented from the candidate linked list according to the tenant. In the low-to-high order, select the CPU core information that needs to be applied, and assign the CPU core corresponding to the selected CPU core information to the tenant.
步骤310,CPU管理分配器若确定租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的期望使用率、小于针对该租户预先设置的CPU核的最大使用率、且空闲链 表为空,则不再为该租户分配CPU核。Step 310: The CPU management allocator determines that the average usage rate of the tenant's CPU core is greater than the expected usage rate of the CPU core preset for the tenant, less than the maximum usage rate of the CPU core preset for the tenant, and the idle chain. If the table is empty, the tenant is no longer assigned a CPU core.
步骤311,CPU管理分配器若确定租户的CPU核的平均使用率大于针对该租户预先设置的CPU核的期望使用率、小于针对该租户预先设置的CPU核的最大使用率、且空闲链表不为空,则从空闲链表中选择需要申请个数的CPU核信息,并将选择的CPU核信息分别对应的CPU核分配给该租户使用。Step 311: The CPU management allocator determines that the average usage rate of the tenant's CPU core is greater than the expected usage rate of the CPU core preset for the tenant, less than the maximum usage rate of the CPU core preset for the tenant, and the free list is not If it is empty, the CPU core information that needs to be applied is selected from the free list, and the CPU core corresponding to the selected CPU core information is allocated to the tenant for use.
基于同一发明构思,本发明实施例中还提供了一种多租户共享资源的装置,由于本发明实施例多租户共享资源的装置对应的方法为一种多租户共享资源的方法,因此本发明实施例的设备的实施可以参见方法的实施,重复之处不再赘述。Based on the same inventive concept, the embodiment of the present invention further provides a device for multi-tenant sharing resources. The method for multi-tenant sharing resources in the embodiment of the present invention is a method for multi-tenant sharing resources, and thus the present invention is implemented. For the implementation of the device of the example, refer to the implementation of the method, and the repeated description is not repeated.
如图4所示,本发明实施例多租户共享资源的装置,包括:As shown in FIG. 4, an apparatus for sharing resources by a multi-tenant according to an embodiment of the present invention includes:
计算模块400,用于预估租户的CPU核的平均使用率,CPU核的平均使用率为租户在设定时长内所租用的各个CPU核的使用率的平均值,租户为CPU管理分配器管理的存储空间中已存储的任意租户;The calculation module 400 is configured to estimate the average usage rate of the tenant's CPU core. The average usage rate of the CPU core is an average value of the usage rates of the CPU cores rented by the tenant within the set time period, and the tenant is managed by the CPU management distributor. Any tenant already stored in the storage space;
判断模块401,用于在确定租户的CPU核的平均使用率小于针对租户预先设置的CPU核的期望使用率时,则将租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到存储空间中预设的CPU核链表中,CPU核链表中存储的CPU核信息对应的CPU核用于重新分配;在确定租户的CPU核的平均使用率大于预先设置的CPU核的期望使用率时,则为租户分配CPU核链表中的至少一个CPU核信息分别对应的CPU核。The determining module 401 is configured to: when determining that the average usage rate of the CPU core of the tenant is less than the expected usage rate of the CPU core preset for the tenant, the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant Added to the preset CPU core linked list in the storage space, the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation; determining that the average usage rate of the tenant's CPU core is greater than the expected use of the preset CPU core At the time of the rate, the tenant is assigned a CPU core corresponding to at least one CPU core information in the CPU core linked list.
可选的该装置还包括:处理模块402,用于在存储空间中增加的新租户时,则为新租户分配CPU核链表中的至少一个CPU核信息分别对应的CPU核。The optional device further includes: a processing module 402, configured to allocate, to the new tenant, a CPU core corresponding to at least one CPU core information in the CPU core linked list when the new tenant is added in the storage space.
可选的,CPU核链表包括空闲链表和候选链表;判断模块401,具体用于当租户的CPU核的平均使用率小于针对租户预先设置的CPU核的最小使用率时,将租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到空闲链表中;当租户的CPU核的平均使用率大于针对租户预先设置的CPU核的最小使用率、且小于针对租户预先设置的CPU核的期望使用率时,将租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息,以及租户租用CPU核的租用优先级信息映射添加到候选链表中;其中,租户的CPU核的期望使用率大于租户的CPU核的最小使用率。Optionally, the CPU core linked list includes a free linked list and a candidate linked list; and the determining module 401 is specifically configured to: when the average usage rate of the tenant's CPU core is less than the minimum usage rate of the CPU core preset for the tenant, the tenants are rented The CPU core information corresponding to at least one CPU core in the CPU core is added to the free list; when the average usage rate of the tenant's CPU core is greater than the minimum usage rate of the CPU core preset for the tenant, and less than the CPU core preset for the tenant When the expected usage rate is used, the CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant, and the lease priority information mapping of the tenant leased CPU core are added to the candidate linked list; wherein, the tenant's CPU core The expected usage rate is greater than the minimum usage of the tenant's CPU core.
可选的,判断模块401,具体用于若确定租户的CPU核的平均使用率大于针对租户预先设置的CPU核的最大使用率、且空闲链表为空,则按照候选链表中存储的租用优先级信息从低到高的顺序选择出的至少一个租用优先级信息分别对应的CPU核信息,将选择出的CPU核信息对应的CPU核分配给租户;若确定租户的CPU核的平均使用率大于针对租户预先设置的CPU核的期望使用率、且空闲链表不为空,则将空闲链表中的至少一个CPU核信息对应的CPU核分配给租户;其中,租户的CPU核的期望使用率小于租户的CPU核的最大使用率。Optionally, the determining module 401 is specifically configured to: if it is determined that the average usage rate of the tenant's CPU core is greater than the maximum usage rate of the CPU core preset for the tenant, and the free linked list is empty, according to the lease priority stored in the candidate linked list. The CPU core information corresponding to the at least one lease priority information selected in the order from low to high, the CPU core corresponding to the selected CPU core information is allocated to the tenant; if the average usage rate of the CPU core of the tenant is determined to be greater than The CPU core of the idle list is allocated to the tenant, and the expected CPU usage of the tenant core is less than the tenant The maximum usage of the CPU core.
可选的,判断模块401,还用于若确定租户的CPU核的平均使用率大于针对租户预先设置的CPU核的期望使用率、且小于针对租户预先设置的CPU核的最大使用率、且空闲链表为空,则不再为租户分配CPU核。Optionally, the determining module 401 is further configured to: if it is determined that the average usage rate of the tenant's CPU core is greater than the expected usage rate of the CPU core preset for the tenant, and less than the maximum usage rate of the CPU core preset for the tenant, and idle If the linked list is empty, the CPU core is no longer assigned to the tenant.
可选的,判断模块401,还用于若确定需要为至少两个租户分配CPU核,则按照至少两个租户中每个租户租用CPU核的租用优先级信息从高到低的顺序,分别为每个租户分配CPU核。Optionally, the determining module 401 is further configured to: if it is determined that the CPU core needs to be allocated to at least two tenants, the lease priority information of the CPU cores rented by each of the at least two tenants is in descending order, Each tenant is assigned a CPU core.
需要说明的是,本发明实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分, 实际实现时可以有另外的划分方式,另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。It should be noted that the division of the module in the embodiment of the present invention is schematic, and is only a logical function division. In an actual implementation, there may be another manner of division. In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or may exist as a separate physical entity, or two or more modules may be integrated into one. In the module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated modules, if implemented in the form of software functional modules and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the embodiments of the present invention may contribute to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage. The medium includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
如图5所示,为本发明实施例多租户共享资源的装置50的硬件结构示意图,包括处理器51,存储器52,输入/输出接口53,通信接口54和总线55,其中,处理器51、存储器52、输入/输出接口53和通信接口54通过总线55实现彼此之间的通信连接,总线在图5中以粗线表示,其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图5中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。As shown in FIG. 5, a hardware structure diagram of a device 50 for multi-tenant sharing resources according to an embodiment of the present invention includes a processor 51, a memory 52, an input/output interface 53, a communication interface 54 and a bus 55, wherein the processor 51, The memory 52, the input/output interface 53 and the communication interface 54 realize a communication connection with each other through the bus 55. The bus is indicated by a thick line in FIG. 5, and the connection manner between other components is merely illustrative, and is not To be limited. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 5, but it does not mean that there is only one bus or one type of bus.
处理器51可以包括通用的中央处理器(Central Processing Unit,CPU),微处理器,应用专用集成电路(Application Specific Integrated Circuit,ASIC),或者一个或多个集成电路,用于执行相关程序,以实现本发明实施例所提供的技术方案。The processor 51 may include a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits for executing related programs. The technical solution provided by the embodiment of the present invention is implemented.
存储器52可以是只读存储器(Read Only Memory,ROM),静态存储设备,动态存储设备或者随机存取存储器(Random Access Memory,RAM)。存储器52可以存储操作系统、其他应用程序和运算数据。在通过软件或者固件来实现本发明实施例提供的技术方案时,用于实现本发明实施例提供的技术方案的程序代码保存在存储器52中,并由处理器51来执行。The memory 52 may be a read only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). Memory 52 can store operating systems, other applications, and operational data. The program code for implementing the technical solution provided by the embodiment of the present invention is stored in the memory 52 and executed by the processor 51 when the technical solution provided by the embodiment of the present invention is implemented by software or firmware.
从上述内容可以看出,CPU管理分配器预估租户的CPU核的平均使用率,CPU核的平均使用率为租户在设定时长内所租用的各个CPU核的使用率的平均值,租户为CPU管理分配器管理的存储空间中已存储的任意租户,若确定租户的CPU核的平均使用率小于针对租户预先设置的CPU核的期望使用率,则将租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到存储空间中预设的CPU核链表中,CPU核链表中存储的CPU核信息对应的CPU核用于重新分配,若确定租户的CPU核的平均使用率大于预先设置的CPU核的期望使用率,则为租户分配CPU核链表中的至少一个CPU核信息分别对应的CPU核,这种技术方案由于CPU管理分配器管理能够根据预估的租户的平均使用率,动态地分配存储空间中已存储的租户所租用的CPU核,从而避免了现有技术中因竞争导致的CPU核分配的不合理的问题,同时减少了CPU核的切换次数,从而提高了处理租户需求的效率。As can be seen from the above, the CPU management allocator estimates the average usage rate of the tenant's CPU core. The average usage rate of the CPU core is the average value of the usage rate of each CPU core rented by the tenant within the set duration. The tenant is The CPU manages any tenant stored in the storage space managed by the allocator. If it is determined that the average usage rate of the tenant's CPU core is less than the expected usage rate of the CPU core preset for the tenant, at least each of the CPU cores rented by the tenant is The CPU core information corresponding to a CPU core is added to the preset CPU core linked list in the storage space, and the CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation, and if the average usage rate of the tenant's CPU core is determined to be greater than The pre-set CPU core's expected usage rate is assigned to the tenant by the CPU core corresponding to at least one CPU core information in the CPU core linked list. This technical solution can be based on the estimated tenant average usage rate. Dynamically allocating CPU cores rented by tenants stored in the storage space, thereby avoiding the unreasonable problem of CPU core allocation caused by competition in the prior art. When reducing the number of switches CPU core, thereby increasing the efficiency of the processing needs of the tenants.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程 序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the present invention may employ computer programs implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) in which computer usable program code is embodied. The form of the product.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While the preferred embodiment of the invention has been described, it will be understood that Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and the modifications and
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。 It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and modifications of the invention

Claims (12)

  1. 一种多租户共享资源的方法,其特征在于,包括:A method for multi-tenant sharing resources, comprising:
    中央处理器CPU管理分配器预估租户的CPU核的平均使用率,所述CPU核的平均使用率为所述租户在设定时长内所租用的各个CPU核的使用率的平均值,所述租户为所述CPU管理分配器管理的存储空间中已存储的任意租户;The central processor CPU management distributor estimates an average usage rate of the tenant's CPU core, and the average usage rate of the CPU core is an average value of usage rates of the CPU cores rented by the tenant for a set period of time, The tenant is any tenant stored in the storage space managed by the CPU management allocator;
    所述CPU管理分配器若确定所述租户的CPU核的平均使用率小于针对所述租户预先设置的CPU核的期望使用率,则将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到所述存储空间中预设的CPU核链表中,所述CPU核链表中存储的CPU核信息对应的CPU核用于重新分配;If the CPU management allocator determines that the average usage rate of the CPU core of the tenant is less than the expected usage rate of the CPU core preset for the tenant, at least one CPU core of each CPU core rented by the tenant Corresponding CPU core information is added to a preset CPU core linked list in the storage space, and a CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation;
    所述CPU管理分配器若确定所述租户的CPU核的平均使用率大于所述预先设置的CPU核的期望使用率,则为所述租户分配所述CPU核链表中的至少一个CPU核信息分别对应的CPU核。If the CPU management allocator determines that the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the preset CPU core, assigning, to the tenant, at least one CPU core information in the CPU core linked list respectively Corresponding CPU core.
  2. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 wherein the method further comprises:
    所述CPU管理分配器在所述存储空间中增加的新租户时,则为所述新租户分配所述CPU核链表中的至少一个CPU核信息分别对应的CPU核。When the CPU manages the new tenant added to the storage space, the new tenant allocates a CPU core corresponding to at least one CPU core information in the CPU core linked list.
  3. 如权利要求1或2所述的方法,其特征在于,所述CPU核链表包括空闲链表和候选链表;The method according to claim 1 or 2, wherein said CPU core linked list comprises a free list and a candidate list;
    所述CPU管理分配器将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到CPU核链表中,包括:The CPU management allocator adds the CPU core information corresponding to the at least one CPU core of each CPU core that is rented by the tenant to the CPU core list, and includes:
    当所述租户的CPU核的平均使用率小于针对所述租户预先设置的CPU核的最小使用率时,所述CPU管理分配器将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到所述空闲链表中;When the average usage rate of the CPU core of the tenant is less than the minimum usage rate of the CPU core preset for the tenant, the CPU management allocator corresponding to at least one CPU core of each CPU core rented by the tenant CPU core information is added to the free list;
    当所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的最小使用率、且小于针对所述租户预先设置的CPU核的期望使用率时,所述CPU管理分配器将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息,以及所述租户租用CPU核的租用优先级信息映射添加到所述候选链表中;When the average usage rate of the tenant's CPU core is greater than the minimum usage rate of the CPU core preset for the tenant and less than the expected usage rate of the CPU core preset for the tenant, the CPU management allocator will The CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant, and the lease priority information mapping of the tenant lease CPU core are added to the candidate linked list;
    其中,所述租户的CPU核的期望使用率大于所述租户的CPU核的最小使用率。The expected usage rate of the tenant's CPU core is greater than the minimum usage rate of the tenant's CPU core.
  4. 如权利要求3所述的方法,其特征在于,所述CPU管理分配器为所述租户分配所述CPU核链表中的至少一个CPU核信息分别对应的CPU核,包括:The method of claim 3, wherein the CPU management allocator allocates, to the tenant, a CPU core corresponding to at least one CPU core information in the CPU core linked list, including:
    所述CPU管理分配器若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的最大使用率、且所述空闲链表为空,则按照所述候选链表中存储的租用优先级信息从低到高的顺序选择出的至少一个租用优先级信息分别对应的CPU核信息,将选择出的CPU核信息对应的CPU核分配给所述租户;If the CPU management allocator determines that the average usage rate of the CPU core of the tenant is greater than the maximum usage rate of the CPU core preset for the tenant, and the free linked list is empty, according to the storage in the candidate linked list The CPU core information corresponding to the at least one lease priority information selected in the order of the priority information from the lowest to the highest, and the CPU core corresponding to the selected CPU core information is allocated to the tenant;
    所述CPU管理分配器若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的期望使用率、且所述空闲链表不为空,则将所述空闲链表中的至少一个CPU核信息对应的CPU核分配给所述租户;If the CPU management allocator determines that the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the CPU core preset for the tenant, and the free linked list is not empty, then the idle list is A CPU core corresponding to at least one CPU core information is allocated to the tenant;
    其中,所述租户的CPU核的期望使用率小于所述租户的CPU核的最大使用率。The expected usage rate of the tenant's CPU core is less than the maximum usage rate of the tenant's CPU core.
  5. 如权利要求3或4所述的方法,其特征在于,所述方法还包括:The method of claim 3 or 4, wherein the method further comprises:
    所述CPU管理分配器若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的期望使用率、且小于针对所述租户预先设置的CPU核的最大使用率、且 所述空闲链表为空,则不再为所述租户分配CPU核。The CPU management allocator determines that an average usage rate of the CPU core of the tenant is greater than a expected usage rate of a CPU core preset for the tenant, and is smaller than a maximum usage rate of a CPU core preset for the tenant, and If the free list is empty, the CPU core is no longer allocated to the tenant.
  6. 如权利要求1至5任一所述的方法,其特征在于,所述CPU管理分配器为所述租户分配CPU核,包括:The method according to any one of claims 1 to 5, wherein the CPU management allocator allocates a CPU core to the tenant, including:
    所述CPU管理分配器若确定需要为至少两个租户分配CPU核,则按照至少两个租户中每个租户租用CPU核的租用优先级信息从高到低的顺序,分别为所述每个租户分配CPU核。If the CPU management allocator determines that the CPU core needs to be allocated to at least two tenants, the tenant priority information of each of the at least two tenants renting the CPU core is in descending order, respectively, for each tenant. Assign a CPU core.
  7. 一种多租户共享资源的装置,其特征在于,包括:An apparatus for multi-tenant sharing resources, comprising:
    计算模块,用于预估租户的CPU核的平均使用率,所述CPU核的平均使用率为所述租户在设定时长内所租用的各个CPU核的使用率的平均值,所述租户为所述CPU管理分配器管理的存储空间中已存储的任意租户;a calculation module, configured to estimate an average usage rate of the tenant's CPU core, where the average usage rate of the CPU core is an average value of usage rates of the CPU cores rented by the tenant within a set time period, and the tenant is The CPU manages any tenant stored in a storage space managed by the allocator;
    判断模块,用于在确定所述租户的CPU核的平均使用率小于针对所述租户预先设置的CPU核的期望使用率时,则将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到所述存储空间中预设的CPU核链表中,所述CPU核链表中存储的CPU核信息对应的CPU核用于重新分配;a determining module, configured to: when determining that an average usage rate of the CPU core of the tenant is less than a desired usage rate of a CPU core preset for the tenant, at least one CPU core of each CPU core rented by the tenant Corresponding CPU core information is added to a preset CPU core linked list in the storage space, and a CPU core corresponding to the CPU core information stored in the CPU core linked list is used for reallocation;
    所述判断模块,还用于在确定所述租户的CPU核的平均使用率大于所述预先设置的CPU核的期望使用率时,则为所述租户分配所述CPU核链表中的至少一个CPU核信息分别对应的CPU核。The determining module is further configured to allocate, when the average usage rate of the CPU core of the tenant is greater than the expected usage rate of the preset CPU core, assign the at least one CPU in the CPU core linked list to the tenant. The core information corresponds to the CPU core.
  8. 如权利要求7所述的装置,其特征在于,还包括:处理模块;The apparatus of claim 7 further comprising: a processing module;
    所述处理模块,用于在所述存储空间中增加的新租户时,则为所述新租户分配所述CPU核链表中的至少一个CPU核信息分别对应的CPU核。And the processing module is configured to allocate a CPU core corresponding to at least one CPU core information in the CPU core linked list to the new tenant when the new tenant is added in the storage space.
  9. 如权利要求7或8所述的装置,其特征在于,所述CPU核链表包括空闲链表和候选链表;The apparatus according to claim 7 or 8, wherein said CPU core linked list comprises an idle linked list and a candidate linked list;
    所述判断模块,具体用于:The determining module is specifically configured to:
    当所述租户的CPU核的平均使用率小于针对所述租户预先设置的CPU核的最小使用率时,将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息添加到所述空闲链表中;当所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的最小使用率、且小于针对所述租户预先设置的CPU核的期望使用率时,将所述租户所租用的各个CPU核中的至少一个CPU核对应的CPU核信息,以及所述租户租用CPU核的租用优先级信息映射添加到所述候选链表中;其中,所述租户的CPU核的期望使用率大于所述租户的CPU核的最小使用率。When the average usage rate of the CPU core of the tenant is less than the minimum usage rate of the CPU core preset for the tenant, adding CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant to In the free list; when the average usage rate of the tenant's CPU core is greater than the minimum usage rate of the CPU core preset for the tenant, and less than the expected usage rate of the CPU core preset for the tenant, The CPU core information corresponding to at least one CPU core of each CPU core rented by the tenant, and the lease priority information mapping of the tenant lease CPU core are added to the candidate linked list; wherein, the tenant's CPU core The expected usage rate is greater than the minimum usage rate of the tenant's CPU core.
  10. 如权利要求9所述的装置,其特征在于,所述判断模块,具体用于:The device according to claim 9, wherein the determining module is specifically configured to:
    若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的最大使用率、且所述空闲链表为空,则按照所述候选链表中存储的租用优先级信息从低到高的顺序选择出的至少一个租用优先级信息分别对应的CPU核信息,将选择出的CPU核信息对应的CPU核分配给所述租户;若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的期望使用率、且所述空闲链表不为空,则将所述空闲链表中的至少一个CPU核信息对应的CPU核分配给所述租户;其中,所述租户的CPU核的期望使用率小于所述租户的CPU核的最大使用率。If it is determined that the average usage rate of the CPU core of the tenant is greater than the maximum usage rate of the CPU core preset for the tenant, and the free linked list is empty, the lease priority information stored in the candidate linked list is lower. The CPU core information corresponding to the at least one lease priority information selected in the high order, the CPU core corresponding to the selected CPU core information is allocated to the tenant; if the average usage rate of the CPU core of the tenant is determined to be greater than And assigning, to the tenant, a CPU core corresponding to at least one CPU core information in the idle linked list, where the expected usage rate of the CPU core preset by the tenant is not empty, wherein the CPU core corresponding to the at least one CPU core information in the idle linked list is allocated to the tenant; The expected usage rate of the tenant's CPU core is less than the maximum usage rate of the tenant's CPU core.
  11. 如权利要求9或10所述的装置,其特征在于,所述判断模块,还用于:The device of claim 9 or 10, wherein the determining module is further configured to:
    若确定所述租户的CPU核的平均使用率大于针对所述租户预先设置的CPU核的期望 使用率、且小于针对所述租户预先设置的CPU核的最大使用率、且所述空闲链表为空,则不再为所述租户分配CPU核。If it is determined that the average usage rate of the tenant's CPU core is greater than the expectation of the CPU core preset for the tenant If the usage rate is less than the maximum usage rate of the CPU core preset for the tenant, and the free list is empty, the CPU core is no longer allocated to the tenant.
  12. 如权利要求7至11任一所述的装置,其特征在于,所述判断模块,还用于:The device according to any one of claims 7 to 11, wherein the determining module is further configured to:
    若确定需要为至少两个租户分配CPU核,则按照至少两个租户中每个租户租用CPU核的租用优先级信息从高到低的顺序,分别为所述每个租户分配CPU核。 If it is determined that the CPU core needs to be allocated to at least two tenants, the CPU core is allocated to each of the tenants in descending order of the lease priority information of each of the at least two tenants.
PCT/CN2017/071022 2016-02-05 2017-01-13 Method and device for sharing resources among multiple tenants WO2017133421A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610082020.7A CN107045457A (en) 2016-02-05 2016-02-05 A kind of method and device of multi-tenant resource-sharing
CN201610082020.7 2016-02-05

Publications (1)

Publication Number Publication Date
WO2017133421A1 true WO2017133421A1 (en) 2017-08-10

Family

ID=59499290

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/071022 WO2017133421A1 (en) 2016-02-05 2017-01-13 Method and device for sharing resources among multiple tenants

Country Status (2)

Country Link
CN (1) CN107045457A (en)
WO (1) WO2017133421A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111597034B (en) * 2019-02-21 2023-04-28 阿里巴巴集团控股有限公司 Processor resource scheduling method and device, terminal equipment and computer storage medium
CN110780992B (en) * 2019-09-20 2023-01-10 苏州浪潮智能科技有限公司 Cloud computing platform optimized deployment method, system, terminal and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102317917A (en) * 2011-06-30 2012-01-11 华为技术有限公司 Hot field virtual machine cpu dispatching method and virtual machine system (vms)
CN102696024A (en) * 2009-10-29 2012-09-26 提姆斯通公司 Computer server able to support CPU virtualisation
CN102946433A (en) * 2012-11-22 2013-02-27 合肥华云通信技术有限公司 Large-scale computer resource monitoring and dispatching method under cloud public service platform
CN104111876A (en) * 2014-07-10 2014-10-22 深圳供电局有限公司 Dynamic resource management device and method based on Oracle resource plan
US20140379924A1 (en) * 2013-06-21 2014-12-25 Microsoft Corporation Dynamic allocation of resources while considering resource reservations

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102696024A (en) * 2009-10-29 2012-09-26 提姆斯通公司 Computer server able to support CPU virtualisation
CN102317917A (en) * 2011-06-30 2012-01-11 华为技术有限公司 Hot field virtual machine cpu dispatching method and virtual machine system (vms)
CN102946433A (en) * 2012-11-22 2013-02-27 合肥华云通信技术有限公司 Large-scale computer resource monitoring and dispatching method under cloud public service platform
US20140379924A1 (en) * 2013-06-21 2014-12-25 Microsoft Corporation Dynamic allocation of resources while considering resource reservations
CN104111876A (en) * 2014-07-10 2014-10-22 深圳供电局有限公司 Dynamic resource management device and method based on Oracle resource plan

Also Published As

Publication number Publication date
CN107045457A (en) 2017-08-15

Similar Documents

Publication Publication Date Title
CN107491351B (en) Resource allocation method, device and equipment based on priority
CN110647394B (en) Resource allocation method, device and equipment
JP5510556B2 (en) Method and system for managing virtual machine storage space and physical hosts
CN108234581B (en) Resource scheduling method and server
US9407514B2 (en) Virtual machine placement
JP6159402B2 (en) Central processing unit resource allocation method and computing node
CN108268317B (en) Resource allocation method and device
WO2016041446A1 (en) Resource allocation method, apparatus and device
WO2019105379A1 (en) Resource management method and apparatus, electronic device, and storage medium
CN111104219A (en) Binding method, device, equipment and storage medium of virtual core and physical core
CN112463392A (en) vGPU management method, vGPU management device, electronic equipment and storage medium
CN108241535B (en) Resource management method and device and server equipment
WO2017133421A1 (en) Method and device for sharing resources among multiple tenants
CN116302327A (en) Resource scheduling method and related equipment
CN110879748A (en) Shared resource allocation method, device and equipment
CN114090249A (en) Resource allocation method, device, electronic equipment and storage medium
CN114253663A (en) Virtual machine resource scheduling method and device
JP2017142838A (en) Resource allocation method of central processing unit and calculation node
CN109412973B (en) Audio processing method and device and storage medium
CN110096355B (en) Shared resource allocation method, device and equipment
CN114281516A (en) Resource allocation method and device based on NUMA attribute
CN111796932A (en) GPU resource scheduling method
CN110750330A (en) Virtual machine creating method, system, electronic equipment and storage medium
JP6365027B2 (en) Allocation program, allocation device, allocation system, and allocation method
CN110209499B (en) Cloud platform resource dynamic configuration method and device and cloud platform

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17746741

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17746741

Country of ref document: EP

Kind code of ref document: A1