WO2023035664A1 - 资源分配方法、云主机、计算机可读存储介质 - Google Patents

资源分配方法、云主机、计算机可读存储介质 Download PDF

Info

Publication number
WO2023035664A1
WO2023035664A1 PCT/CN2022/093964 CN2022093964W WO2023035664A1 WO 2023035664 A1 WO2023035664 A1 WO 2023035664A1 CN 2022093964 W CN2022093964 W CN 2022093964W WO 2023035664 A1 WO2023035664 A1 WO 2023035664A1
Authority
WO
WIPO (PCT)
Prior art keywords
iothread
cpu cores
available
cpu core
processed
Prior art date
Application number
PCT/CN2022/093964
Other languages
English (en)
French (fr)
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 WO2023035664A1 publication Critical patent/WO2023035664A1/zh

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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to but not limited to the technical field of cloud computing, and in particular relates to a resource allocation method, a cloud host, and a computer-readable storage medium.
  • the input and output thread is the unit responsible for running the event processing loop in the Quick EMUlator (QEMU), which can make the input and output IO processing of the cloud host in the cloud server completely separate from the main thread, so that The IO processing of the cloud host runs in multiple different IOThreads to make full use of multi-core processors.
  • the existing IOThread randomly uses the central processing unit (Central Processing Unit, CPU) core of the IOthread isolation domain, and multiple IOThreads may use one CPU core at the same time, resulting in low IO performance of the cloud host.
  • CPU Central Processing Unit
  • Embodiments of the present application provide a resource allocation method, a cloud host, and a computer-readable storage medium.
  • the embodiment of the present application provides a resource allocation method, which is applied to the first cloud host of the cloud server, including: determining the available CPU cores from the CPU cores; The CPU core allocates a target CPU core for the IOThread to be processed, wherein the target CPU core is exclusively occupied by the IOThread to be processed.
  • the embodiment of the present application also provides a cloud host, including: a memory, a processor, and a computer program stored on the memory and operable on the processor, wherein the processor executes the computer program
  • the program implements the resource allocation method described in any one of the embodiments of the first aspect.
  • the embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to execute the resource allocation method described in any one embodiment of the first aspect. .
  • FIG. 1 is a flow chart of the steps of a resource allocation method provided by an embodiment of the present application
  • Fig. 2 is a flow chart of steps for determining the priority of IOThread to be processed provided by another embodiment of the present application;
  • Fig. 3 is the flow chart of the steps of allocating the target CPU core for the IOThread to be processed provided by another embodiment of the present application;
  • Fig. 4 is the flow chart of the steps of allocating the target CPU core for the IOThread to be processed provided by another embodiment of the present application;
  • FIG. 5 is a flow chart of steps for determining available CPU cores from CPU cores provided by another embodiment of the present application.
  • FIG. 6 is a flow chart of steps for distributing a target CPU core for an IOThread to be processed according to another embodiment of the present application
  • FIG. 7 is a flow chart of steps for creating an isolated domain provided by another embodiment of the present application.
  • FIG. 8 is a flow chart of steps for re-determining available CPU cores provided by another embodiment of the present application.
  • FIG. 9 is a flowchart of the steps of a resource allocation method provided by another embodiment of the present application.
  • Fig. 10 is a structural diagram of a cloud host provided by another embodiment of the present application.
  • the present application provides a resource allocation method, a cloud host, and a computer-readable storage medium, wherein the resource allocation method includes: determining available CPU cores from CPU cores; The CPU core allocates a target CPU core for the IOThread to be processed, wherein the target CPU core is exclusively occupied by the IOThread to be processed.
  • the target CPU core can be exclusively used by the pending IOThread, thereby improving the IO processing performance of the cloud host.
  • Figure 1 is a flow chart of the steps of a resource allocation method provided by an embodiment of the present application, the resource allocation method is applied to the first cloud host of the cloud server, the resource allocation method includes but is not limited to the following step S110 , S120.
  • Step S110 determining available CPU cores from CPU cores.
  • the available CPU cores refer to the CPU cores in the CPU core resource pool in the cloud server except the CPU cores occupied by the system process or the CPU cores already occupied by IOThread, from the CPU core resources of the first cloud host Obtain available CPU cores from the pool, which can provide allocatable CPU core resources for IOThread.
  • Step S120 acquiring the pending IOThread, and assigning a target CPU core to the pending IOThread from the available CPU cores according to preset rules, wherein the target CPU core is exclusively occupied by the pending IOThread.
  • the to-be-processed IOThread generated by the first cloud host is obtained, and the target CPU core is assigned to the to-be-processed IOThread according to the preset rules in the first cloud host, and the target CPU core assigned to the to-be-processed IOThread is assigned by the IOThread is used exclusively.
  • allocating an exclusive target CPU core for the IOThread to be processed can effectively avoid the situation that multiple IOThreads occupy one CPU core at the same time, reduce the waste of CPU resources, and thereby improve the IO processing performance of the cloud host.
  • the number of IOThreads to be processed is at least two. Referring to FIG. 2 , before step S120 in the embodiment shown in FIG. 1 , the following step S210 is also included but not limited to.
  • Step S210 determining the priority of each IOThread to be processed.
  • determining the priority of each IOThread to be processed according to the importance of the IO processing business can provide a data basis for assigning the target CPU core to the IOThread to be processed, thereby further ensuring that the importance of the IO processing business is higher The priority of the thread is to get CPU core resources.
  • step S120 in the embodiment shown in FIG. 1 includes but is not limited to the following steps S310 and S320.
  • Step S310 determining the proportion of available resources, where the proportion of resources is the ratio of the number of available CPU cores to the number of CPU cores.
  • Step S320 when the proportion of available resources is less than the first threshold, assign a target CPU core to each pending IOThread from the available CPU cores in descending order of priority.
  • the first threshold is set corresponding to the proportion of available resources of the current first cloud host, and is used to determine the load status of the IO processing of the first cloud host, and the first threshold is preset in the first cloud host.
  • Available resource ratio threshold which represents the minimum value of the ratio of the number of available CPU cores to the number of CPU cores when the first cloud host is under normal IO load.
  • the ratio of available resources is less than the first threshold, it means that the first cloud host Currently in a state of high IO load, in this case, according to the order of the priority of the pending IOThread from high to low, assign a target CPU core to each pending IOThread from the available CPU cores, since the priority corresponds to each pending The business importance of the IO processing of IOThread is determined. Therefore, according to the technical solution of the present application, threads with higher priority can be guaranteed to enjoy CPU core resources first, so as to ensure the normal operation of important businesses.
  • step S320 in the embodiment shown in FIG. 3 includes but is not limited to the following step S410 .
  • Step S410 in the case that the target CPU core is allocated to the pending IOThread with the upper level of priority, allocate the target CPU core for the pending IOThread with the lower level of priority from the remaining available CPU cores.
  • the pending IOThread of the upper level of priority refers to the pending IOThread with the highest priority among the pending IOThreads generated by the current first cloud host.
  • the pending IOThread of the first level of priority allocates the target CPU core for the pending IOThread of the upper level of priority.
  • step S110 in the embodiment shown in FIG. 1 includes but is not limited to the following steps S510 and S520.
  • Step S510 creating an isolation domain, and assigning at least two CPU cores to the isolation domain.
  • Step S520 determining the CPU cores in isolation as available CPU cores.
  • isolation domain the purpose of creating an isolation domain, assigning CPU cores to the isolation domain, and determining the CPU cores in the isolation domain as available CPU cores is to bind the CPU cores to the isolation domain for each pending processing in the isolation domain.
  • IOThread is used.
  • the isolation domain in this application provides CPU core resources for processing IOThread, and is only used for pending IOThread; the first cloud host also has a system isolation domain dedicated to processing system processes.
  • the isolation domain of this application The domain and the system isolation domain are independent of each other, which can effectively ensure the reasonable utilization of the CPU core resources of the first cloud host.
  • this application does not limit the specific allocation strategy for allocating CPU cores to isolation domains, and may adopt a depth-first strategy or a breadth-first strategy, which can be selected by those skilled in the art according to actual needs.
  • the cloud server further includes at least one second cloud host, and each second cloud host is communicatively connected to the first cloud host. Referring to FIG. 6, step S120 in the embodiment shown in FIG. Including but not limited to the following steps S610-S630.
  • Step S610 determining a first number, where the first number is the number of available CPU cores in the isolation domain.
  • Step S620 determining a second number, where the second number is the number of IOThreads to be processed.
  • Step S630 when the first number is less than the second number, schedule the available CPU cores of the second cloud host to the isolation domain, wherein the number of available CPU cores scheduled from the second cloud host is based on the difference between the second number and the first number The value is determined.
  • the embodiment of the present application does not limit the cycle time for detecting the numerical relationship between the first quantity and the second quantity, which may be real-time detection or periodic detection, and those skilled in the art may choose according to actual needs.
  • the fourth number is determined according to the difference between the second number and the first number.
  • the fourth number is the number of available CPU cores required by the first cloud host , dispatching a fourth number of available CPU cores from the second cloud host of the cloud server to the isolation domain, so as to satisfy the requirement that each IOThread to be processed in the first cloud host can be assigned to an available CPU core for exclusive use.
  • this embodiment of the present application does not limit the specific method of scheduling available CPU cores from the second cloud host. It may be that the first cloud host sends a resource request to the second cloud host in the cloud server, and the resource request carries the first The number information of the available CPU cores required by the cloud host, i.e. the fourth number; the second cloud host that can satisfy the resource request feeds back the resource response information to the first cloud host, and the first cloud host sends the second cloud host's resource response information according to the resource response information The available CPU cores are scheduled to the isolation domain, and the first cloud host allocates the available CPU cores for the pending IOThread from the scheduled isolation domain.
  • obtaining the first number and the second number can monitor the proportion of available CPU core resources in the isolation domain, thereby realizing dynamic scheduling of CPU core resources between cloud hosts in the cloud server , to effectively avoid the problem that the pending IOThread seizes CPU core resources, causing the IO processing of important services to be affected.
  • step S510 in the embodiment shown in FIG. 5 includes but is not limited to the following steps S710 and S720 .
  • Step S710 obtaining isolation domain configuration information, the isolation domain configuration information includes a third number, and the third number represents the number of available CPU cores in the isolation domain.
  • Step S720 when the number of unoccupied CPU cores is greater than the third number, create an isolation domain with the third number as the capacity of the CPU cores.
  • the scheme can provide a resource basis for the allocation of target CPU cores for pending IOThreads.
  • step S810 is also included but not limited to.
  • Step S810 when the pending IOThread completes IO processing through the target CPU core, re-determine the target CPU core as an available CPU core.
  • the target CPU core is re-determined as an available CPU core to provide an allocatable resource for the subsequent IOThread to be processed by the first cloud host.
  • CPU core resources so as to ensure the effective use of CPU core resources.
  • FIG. 9 is a flowchart of steps of a resource allocation method provided by another embodiment of the present application.
  • the resource allocation method includes the following steps S910-S950.
  • Step S910 divide the IOThreads generated by all the cloud hosts on the cloud server into high, medium and low priorities according to business importance.
  • Step S920 when the number of all IOThreads is less than the number of current IOThread isolation cores, the IOThreads are sequentially bound to the corresponding IOThread isolation cores, and at this time the input and output IO requests of the IOThreads can be satisfied to the greatest extent, wherein the IOThread isolation cores are cloud hosts Available CPU cores in the isolation domain.
  • Step S930 when the number of all IOThreads is greater than the number of the current IOThread isolation cores, determine the priority of the IOThreads, and individually bind the high priority IOThreads to one IOThread isolation core.
  • Step S940 in the case of completing the allocation of isolated cores to the high-priority IOThread, sequentially binding the medium-priority IOThread to the remaining isolated cores in the isolation domain of the cloud host.
  • Step S950 in the case of completing the isolation core allocation of the medium priority IOThread, binding the low priority IOThread to the last remaining isolated core in the isolation domain of the cloud host.
  • FIG. 10 is a structural diagram of a cloud host provided by another embodiment of the present application.
  • An embodiment of the present application also provides a cloud host 1000, the terminal includes: a memory 1010, a processor 1020 and a storage A computer program on the memory 1010 and executable on the processor 1020 .
  • the processor 1020 and the memory 1010 may be connected through a bus or in other ways.
  • the non-transitory software programs and instructions required to realize the resource allocation method of the above-mentioned embodiment are stored in the memory 1010, and when executed by the processor 1020, the resources of the first cloud host 1000 applied to the cloud server in the above-mentioned embodiment are executed
  • the allocation method for example, executes method step S110 to method step S120 in Fig. 1 described above, method step S210 in Fig. 2 , method step S310 to method step S320 in Fig. 3 , method step S410 in Fig. 4 , and Fig. Method step S510 to method step S520 in 5, method step S610 to method step S630 in FIG. 6 , method step S710 to method step S720 in FIG. 7 , method step S810 in FIG. 8 .
  • the device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • an embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by a processor 1020 or a controller, for example, by Execution by a processor 1020 in the embodiment of the above-mentioned cloud host 1000 can make the above-mentioned processor 1020 execute the resource allocation method applied to the first cloud host 1000 of the cloud server in the above-mentioned embodiment, for example, execute the above-described Method step S110 to method step S120, method step S210 in Fig. 2, method step S310 to method step S320 in Fig. 3, method step S410 in Fig. 4, method step S510 to method step S520 in Fig. 5, Fig.
  • a processor such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit .
  • Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media).
  • computer storage media includes both volatile and nonvolatile media implemented in any method or technology for storage of information, such as computer readable instructions, data structures, program modules, or other data. permanent, removable and non-removable media.
  • Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, tape, magnetic disk storage or other magnetic storage devices, or can Any other medium used to store desired information and which can be accessed by a computer.
  • communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media .
  • Embodiments of the present application include a resource allocation method, a cloud host, and a computer-readable storage medium, wherein the resource allocation method includes: determining available CPU cores from CPU cores; A target CPU core is allocated to the IOThread to be processed from available CPU cores, wherein the target CPU core is exclusively occupied by the IOThread to be processed.
  • the target CPU core can be exclusively used by the pending IOThread, thereby improving the IO processing performance of the cloud host.

Abstract

一种资源分配方法、云主机、计算机可读存储介质,其中,所述资源分配方法包括:从中央处理器CPU核中确定可用CPU核;获取待处理输入输出线程IOThread,根据预置规则从所述可用CPU核中为待处理IOThread分配目标CPU核,其中,所述目标CPU核由所述待处理IOThread独占。

Description

资源分配方法、云主机、计算机可读存储介质
相关申请的交叉引用
本申请基于申请号为202111060494.9、申请日为2021年9月10日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本申请涉及但不限于云计算技术领域,尤其涉及一种资源分配方法、云主机、计算机可读存储介质。
背景技术
输入输出线程(Input Output Thread,IOThread)是快速模拟处理器(Quick EMUlator,QEMU)中负责运行事件处理循环的单元,能够使得云服务器中云主机的输入输出IO处理能够完全脱离主线程,从而使得云主机的IO处理运行在多个不同的IOThread里,达到充分利用多核处理器的效果。现有的IOThread随机使用IOthread隔离域的中央处理器(Central Processing Unit,CPU)核,会出现多个IOThread同时使用一个CPU核的情况,从而导致云主机的IO性能较低。
发明内容
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
本申请实施例提供了一种资源分配方法、云主机、计算机可读存储介质。
第一方面,本申请实施例提供了一种资源分配方法,应用于云服务器的第一云主机,包括:从CPU核中确定可用CPU核;获取待处理IOThread,根据预置规则从所述可用CPU核中为待处理IOThread分配目标CPU核,其中,所述目标CPU核由所述待处理IOThread独占。
第二方面,本申请实施例还提供了一种云主机,包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如第一方面任意一项实施例所述的资源分配方法。
第三方面,本申请实施例还提供了一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行如第一方面任意一项实施例所述的资源分配方法。
本申请的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本申请而了解。本申请的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。
附图说明
附图用来提供对本申请技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本申请的技术方案,并不构成对本申请技术方案的限制。
图1是本申请一个实施例提供的资源分配方法的步骤流程图;
图2是本申请另一个实施例提供的确定待处理IOThread的优先级的步骤流程图;
图3是本申请另一个实施例提供的为待处理IOThread分配目标CPU核的步骤流程图;
图4是本申请另一个实施例提供的为待处理IOThread分配目标CPU核的步骤流程图;
图5是本申请另一个实施例提供的从CPU核中确定可用CPU核的步骤流程图;
图6是本申请另一个实施例提供的为待处理IOThread分配目标CPU核的步骤流程图;
图7是本申请另一个实施例提供的创建隔离域的步骤流程图;
图8是本申请另一个实施例提供的重新确定可用CPU核的步骤流程图;
图9是本申请另一个实施例提供的资源分配方法的步骤流程图;
图10是本申请另一个实施例提供的云主机的结构图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
需要说明的是,虽然在装置示意图中进行了功能模块划分,在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于装置中的模块划分,或流程图中的顺序执行所示出或描述的步骤。说明书、权利要求书或上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
本申请提供了一种资源分配方法、云主机、计算机可读存储介质,其中,所述资源分配方法包括:从CPU核中确定可用CPU核;获取待处理IOThread,根据预置规则从所述可用CPU核中为待处理IOThread分配目标CPU核,其中,所述目标CPU核由所述待处理IOThread独占。根据本申请实施例提供的方案,能够实现待处理IOThread独占使用目标CPU核,从而提升云主机的IO处理性能。
下面结合附图,对本申请实施例作进一步阐述。
如图1所示,图1是本申请一个实施例提供的资源分配方法的步骤流程图,该资源分配方法应用于云服务器的第一云主机,该资源分配方法包括但不限于有以下步骤S110、S120。
步骤S110,从CPU核中确定可用CPU核。
可以理解的是,可用CPU核指的是云服务器中的CPU核资源池中除了被系统进程占用的CPU核或已被IOThread占用的CPU核以外的CPU核,从第一云主机的CPU核资源池中获取可用CPU核,能够为IOThread提供可分配的CPU核资源。
步骤S120,获取待处理IOThread,根据预置规则从可用CPU核中为待处理IOThread分配目标CPU核,其中,目标CPU核由待处理IOThread独占。
可以理解的是,获取第一云主机产生的待处理的IOThread,根据第一云主机中的预置规则为待处理的IOThread分配目标CPU核,该分配至待处理IOThread的目标CPU核由待处理IOThread独占使用。根据本申请的技术方案,为待处理IOThread分配独占使用的目标CPU核,能够有效避免出现多个IOThread同时占用一个CPU核的情况,减少CPU资源的浪费,从而提高了云主机的IO处理性能。
另外,在本申请一实施例中,待处理IOThread的数量至少为二,参照图2,在图1所示实施例中的步骤S120之前,还包括但不限于有以下步骤S210。
步骤S210,确定每个待处理IOThread的优先级。
本领域技术人员可以理解的是,根据IO处理业务重要性确定每个待处理IOThread的优先级,能够为分配目标CPU核给待处理IOThread提供数据基础,从而能够进一步保障IO处理业务重要性较高的线程的优先得到CPU核资源。
需要注意的是,确定待处理IOThread的实现方法为本领域技术人员所熟知,本申请在此并不多做限制。
另外,参考图3,在本申请一实施例中,图1所示实施例中的步骤S120包括但不限于有以下步骤S310、S320。
步骤S310,确定可用资源占比,其中,资源占比为可用CPU核的数量与CPU核的数量的比值。
步骤S320,当可用资源占比小于第一阈值,根据优先级由高到低的顺序,从可用CPU核中为每一个待处理IOThread分配目标CPU核。
可以理解的是,第一阈值是对应当前第一云主机的可用资源占比而设定,用于确定第一云主机的IO处理的负载状态,第一阈值为第一云主机中预置的可用资源占比阈值,表征第一云主机处于正常IO负载的情况下的可用CPU核的数量与CPU核的数量的比值的最低值,当可用资源占比小于第一阈值,表示第一云主机当前处于高IO负载状态,在此情况下,根据待处理IOThread的优先级由高到低的顺序,从可用CPU核中为每一个待处理IOThread分配目标CPU核,由于优先级是对应每个待处理IOThread的IO处理的业务重要性而确定,因此,根据本申请的技术方案,能够保证优先级较高的线程优先享有CPU核资源,保证重要业务的正常运行。
另外,参考图4,在本申请一实施例中,图3所示实施例中的步骤S320包括但不限于有以下步骤S410。
步骤S410,在完成对具有上一级优先级的待处理IOThread分配目标CPU核的情况下,从剩余的可用CPU核中为具有下一级优先级的待处理IOThread分配目标CPU核。
可以理解的是,上一级优先级的待处理IOThread指的是当前第一云主机产生的待处理IOThread中优先级最高的待处理IOThread,从当前第一云主机产生的待处理IOThread中获取上一级优先级的待处理IOThread,为上一级优先级的待处理IOThread分配目标CPU核,在完成对上一级优先级的待处理IOThread分配目标CPU核的情况下,继续从剩余的具有下一级优先级的待处理IOThread中获取优先级最高的待处理IOThread,并从剩余的可用CPU核中,为下一级优先级的待处理IOThread中优先级最高的待处理IOThread分配目标CPU核,根据本申请的技术方案,在第一云主机高IO负载的情况下,能够保证上一级优先级的待处理IOThread能够优先获得可用CPU核资源,保证重要IO处理业务的优先运行。
另外,参考图5,在本申请一实施例中,图1所示实施例中的步骤S110包括但不限于有以下步骤S510、S520。
步骤S510,创建隔离域,将至少两个CPU核分配至隔离域。
步骤S520,将隔离中的CPU核确定为可用CPU核。
可以理解的是,创建隔离域,并为隔离域分配CPU核,将隔离域中的CPU核确定为可用CPU核,是为了将CPU核绑定到隔离域上,供隔离域中的各个待处理IOThread使用,需要说明的是,本申请中的隔离域为处理IOThread提供CPU核资源,仅用于待处理IOThread;第 一云主机还具有专门用于处理系统进程的系统隔离域,本申请的隔离域与系统隔离域相互独立,能够有效保证第一云主机的CPU核资源的合理利用。
需要说明的是,本申请并不限制创建隔离域的具体数量,本领域技术人员可以根据实际需求进行调整。
需要说明的是,本申请并不限制分配CPU核至隔离域的具体分配策略,可以是采用深度优先策略或广度优先策略,本领域技术人员可以根据实际需求进行选择。
另外,在本申请一实施例中,云服务器还包括至少一个第二云主机,每个第二云主机与第一云主机通信连接,参考图6,图1所示实施例中的步骤S120还包括但不限于有以下步骤S610-S630。
步骤S610,确定第一数量,第一数量为隔离域中可用CPU核的数量。
步骤S620,确定第二数量,第二数量为待处理IOThread的数量。
步骤S630,当第一数量小于第二数量,将第二云主机的可用CPU核调度至隔离域,其中,从第二云主机调度的可用CPU核的数量根据第二数量和第一数量的差值确定。
需要说明的是,本申请实施例并不限制检测第一数量和第二数量的数值关系的周期时间,可以是实时检测,还可以是周期性检测,本领域技术人员可以根据实际需求进行选择。
可以理解的是,当检测到第一数量小于第二数量,即隔离域中可用CPU核的数量小于待处理IOThread的数量,在此情况下,不能保证每个待处理IOThread能够独占使用可用CPU核,存在待处理IOThread抢占可用CPU核的风险,根据本申请的技术方案,根据第二数量和第一数量的差值确定第四数量,第四数量为第一云主机需要的可用CPU核的数量,从云服务器的第二云主机中调度数量为第四数量的可用CPU核至隔离域,以满足第一云主机中的每个待处理IOThread能够分配到独占使用的可用CPU核的需求。
需要说明的是,本申请实施例并不限制从第二云主机调度可用CPU核的具体方式,可以是第一云主机向云服务器中的第二云主机发送资源请求,资源请求携带有第一云主机所需的可用CPU核的数量信息,即第四数量;能够满足资源请求的第二云主机反馈资源应答信息至第一云主机,第一云主机根据资源应答信息将第二云主机的可用CPU核调度至隔离域,第一云主机从已完成调度的隔离域中为待处理IOThread分配可用CPU核。
可以理解的是,根据本申请的技术方案,获取第一数量以及第二数量,能够监控隔离域中可用CPU核资源的占比,从而实现动态调度云服务器中各云主机之间的CPU核资源,有效避免待处理IOThread抢占CPU核资源,导致重要业务的IO处理受到影响的问题。
另外,参考图7,在本申请一实施例中,图5所示实施例中的步骤S510包括但不限于有以下步骤S710、S720。
步骤S710,获取隔离域配置信息,隔离域配置信息包括第三数量,第三数量表征隔离域中的可用CPU核的数量。
步骤S720,当未被占用的CPU核的数量大于第三数量,以第三数量为CPU核的容量创建隔离域。
可以理解的是,配置隔离域,为隔离域分配可用核,需要结合当前云主机的CPU核中可用CPU核的数量,为隔离域配置的CPU核小于或等于第三数量,根据本申请的技术方案,能够为待处理IOThread分配目标CPU核提供资源基础。
另外,参照图8,在本申请一实施例中,在图1所示实施例中的步骤S120之后,还包括 但不限于有以下步骤S810。
步骤S810,当待处理IOThread通过目标CPU核完成IO处理,将目标CPU核重新确定为可用CPU核。
可以理解的是,在待处理IOThread通过目标CPU核完成IO处理后,释放已占用的资源,将目标CPU核重新确定为可用CPU核,为第一云主机后续产生的待处理IOThread提供可分配的CPU核资源,从而保证CPU核资源的有效利用。
另外,为了对本申请提供的资源分配方法进行更详细的说明,以下以一个具体示例对本申请的技术方案进行描述。
示例一:参考图9,图9是本申请另一个实施例提供的资源分配方法的步骤流程图,该资源分配方法包括以下步骤S910-S950。
步骤S910,将云服务器上所有的云主机产生的IOThread根据业务重要性进行高中低优先级划分。
步骤S920,当所有IOThread的数量小于当前IOThread隔离核的数量,将IOThread依次绑定到相应的IOThread隔离核上,此时能够最大程度满足IOThread的输入输出IO请求,其中,IOThread隔离核为云主机的隔离域中的可用CPU核。
步骤S930,当所有IOThread的数量大于当前IOThread隔离核的数量,确定IOThread的优先级,将高优先级的IOThread单独绑定到一个IOThread隔离核上。
步骤S940,在完成对高优先级的IOThread的隔离核分配的情况下,将中优先级的IOThread依次绑定到云主机的隔离域中剩余的隔离核上。
步骤S950,在完成对中优先级的IOThread的隔离核分配的情况下,将低优先级的IOThread绑定到云主机的隔离域中剩余的最后一个隔离核上。
另外,参考图10,图10是本申请另一个实施例提供的云主机的结构图,本申请的一个实施例还提供了一种云主机1000,该终端包括:存储器1010、处理器1020及存储在存储器1010上并可在处理器1020上运行的计算机程序。
处理器1020和存储器1010可以通过总线或者其他方式连接。
实现上述实施例的资源分配方法所需的非暂态软件程序以及指令存储在存储器1010中,当被处理器1020执行时,执行上述实施例中的应用于云服务器的第一云主机1000的资源分配方法,例如,执行以上描述的图1中的方法步骤S110至方法步骤S120、图2中的方法步骤S210、图3中的方法步骤S310至方法步骤S320、图4中的方法步骤S410、图5中的方法步骤S510至方法步骤S520、图6中的方法步骤S610至方法步骤S630、图7中的方法步骤S710至方法步骤S720、图8中的方法步骤S810。
以上所描述的装置实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
此外,本申请的一个实施例还提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令被一个处理器1020或控制器执行,例如,被上述云主机1000实施例中的一个处理器1020执行,可使得上述处理器1020执行上述实施例中的应用于云服务器的第一云主机1000的资源分配方法,例如,执行以上描述的图1中的方法步骤S110至方法步骤S120、图2中的方法步骤S210、图3中的方法步骤S310至方法步骤 S320、图4中的方法步骤S410、图5中的方法步骤S510至方法步骤S520、图6中的方法步骤S610至方法步骤S630、图7中的方法步骤S710至方法步骤S720、图8中的方法步骤S810。本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统可以被实施为软件、固件、硬件及其适当的组合。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。
本申请实施例包括一种资源分配方法、云主机、计算机可读存储介质,其中,所述资源分配方法包括:从CPU核中确定可用CPU核;获取待处理IOThread,根据预置规则从所述可用CPU核中为待处理IOThread分配目标CPU核,其中,所述目标CPU核由所述待处理IOThread独占。根据本申请实施例提供的方案,能够实现待处理IOThread独占使用目标CPU核,从而提升云主机的IO处理性能。
以上是对本申请的一些实施进行了具体说明,但本申请并不局限于上述实施方式,熟悉本领域的技术人员在不违背本申请范围的前提下还可作出种种的等同变形或替换,这些等同的变形或替换均包含在本申请权利要求所限定的范围内。

Claims (10)

  1. 一种资源分配方法,应用于云服务器的第一云主机,包括:
    从中央处理器CPU核中确定可用CPU核;
    获取待处理输入输出线程IOThread,根据预置规则从所述可用CPU核中为待处理IOThread分配目标CPU核,其中,所述目标CPU核由所述待处理IOThread独占。
  2. 根据权利要求1所述的方法,,所述待处理IOThread的数量至少为二,在所述根据预置规则从所述可用CPU核中为待处理IOThread分配目标CPU核之前,所述方法还包括:
    确定每个所述待处理IOThread的优先级。
  3. 根据权利要求2所述的方法,其中,所述根据预置规则从所述可用CPU核中为待处理IOThread分配目标CPU核,包括:
    确定可用资源占比,其中,所述资源占比为所述可用CPU核的数量与所述CPU核的数量的比值;
    当可用资源占比小于第一阈值,根据所述优先级由高到低的顺序,从所述可用CPU核中为每一个所述待处理IOThread分配所述目标CPU核。
  4. 根据权利要求3所述的方法,其中,所述优先级的数量至少为二,所述根据所述优先级由高到低的顺序,从所述可用CPU核中为每一个所述待处理IOThread分配所述目标CPU核,包括:
    在完成对具有上一级优先级的所述待处理IOThread分配所述目标CPU核的情况下,从剩余的所述可用CPU核中为具有下一级优先级的所述待处理IOThread分配所述目标CPU核。
  5. 根据权利要求1所述的方法,其中,所述从中央处理器CPU核中确定可用CPU核,包括:
    创建隔离域,将至少两个CPU核分配至所述隔离域;
    将所述隔离域中的所述CPU核确定为所述可用CPU核。
  6. 根据权利要求5所述的方法,其中,所述云服务器还包括至少一个第二云主机,每个所述第二云主机与所述第一云主机通信连接,所述根据预置规则从所述可用CPU核中为待处理IOThread分配目标CPU核,还包括:
    确定第一数量,所述第一数量为所述隔离域中所述可用CPU核的数量;
    确定第二数量,所述第二数量为所述待处理IOThread的数量;
    当所述第一数量小于所述第二数量,将第二云主机的可用CPU核调度至所述隔离域,其中,从所述第二云主机调度的可用CPU核的数量根据所述第二数量和所述第一数量的差值确定。
  7. 根据权利要求5所述的方法,其中,所述创建隔离域,包括:
    获取隔离域配置信息,所述隔离域配置信息包括第三数量,所述第三数量表征所述隔离域中的所述可用CPU核的数量;
    当未被占用的CPU核的数量大于所述第三数量,以所述第三数量为CPU核的容量创建所述隔离域。
  8. 根据权利要求1所述的方法,其中,在所述根据预置规则从所述可用CPU核中为待处理IOThread分配目标CPU核之后,所述方法还包括:
    当所述待处理IOThread通过所述目标CPU核完成输入输出IO处理,将所述目标CPU核重新确定为所述可用CPU核。
  9. 一种云主机,包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如权利要求1至8中任意一项所述的资源分配方法。
  10. 一种计算机可读存储介质,存储有计算机可执行指令,其中,所述计算机可执行指令用于执行如权利要求1至8中任意一项所述的资源分配方法。
PCT/CN2022/093964 2021-09-10 2022-05-19 资源分配方法、云主机、计算机可读存储介质 WO2023035664A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111060494.9A CN115794362A (zh) 2021-09-10 2021-09-10 资源分配方法、云主机、计算机可读存储介质
CN202111060494.9 2021-09-10

Publications (1)

Publication Number Publication Date
WO2023035664A1 true WO2023035664A1 (zh) 2023-03-16

Family

ID=85473289

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/093964 WO2023035664A1 (zh) 2021-09-10 2022-05-19 资源分配方法、云主机、计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN115794362A (zh)
WO (1) WO2023035664A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117785619A (zh) * 2024-02-27 2024-03-29 深圳超盈智能科技有限公司 一种芯片存储状态的监控方法和系统
CN117785619B (zh) * 2024-02-27 2024-05-10 深圳超盈智能科技有限公司 一种芯片存储状态的监控方法和系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160004554A1 (en) * 2013-03-21 2016-01-07 Fujitsu Limited Information processing device and resource allocation method
CN106484537A (zh) * 2016-09-30 2017-03-08 网易(杭州)网络有限公司 一种cpu核资源的分配方法和设备
CN107368367A (zh) * 2017-05-23 2017-11-21 阿里巴巴集团控股有限公司 资源分配的处理方法、装置及电子设备
CN113032101A (zh) * 2021-03-31 2021-06-25 深信服科技股份有限公司 虚拟机的资源分配方法、服务器及计算机可读存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160004554A1 (en) * 2013-03-21 2016-01-07 Fujitsu Limited Information processing device and resource allocation method
CN106484537A (zh) * 2016-09-30 2017-03-08 网易(杭州)网络有限公司 一种cpu核资源的分配方法和设备
CN107368367A (zh) * 2017-05-23 2017-11-21 阿里巴巴集团控股有限公司 资源分配的处理方法、装置及电子设备
CN113032101A (zh) * 2021-03-31 2021-06-25 深信服科技股份有限公司 虚拟机的资源分配方法、服务器及计算机可读存储介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117785619A (zh) * 2024-02-27 2024-03-29 深圳超盈智能科技有限公司 一种芯片存储状态的监控方法和系统
CN117785619B (zh) * 2024-02-27 2024-05-10 深圳超盈智能科技有限公司 一种芯片存储状态的监控方法和系统

Also Published As

Publication number Publication date
CN115794362A (zh) 2023-03-14

Similar Documents

Publication Publication Date Title
CN107491351B (zh) 一种基于优先级的资源分配方法、装置和设备
CN110941481A (zh) 资源调度方法、装置及系统
CN106406983B (zh) 一种集群中的任务调度方法及装置
CN107515786B (zh) 资源分配方法、主装置、从装置和分布式计算系统
US9052932B2 (en) Hybrid virtual machine configuration management
WO2018006864A1 (zh) 创建虚拟机的方法、装置及系统、控制设备和存储介质
US9027028B2 (en) Controlling the use of computing resources in a database as a service
US9519499B2 (en) Method for dispatching central processing unit of hotspot domain virtual machine and virtual machine system
CN106406987B (zh) 一种集群中的任务执行方法及装置
CN106293893B (zh) 作业调度方法、装置及分布式系统
KR101644800B1 (ko) 컴퓨팅 시스템 및 방법
US20170024251A1 (en) Scheduling method and apparatus for distributed computing system
CN106775948B (zh) 一种基于优先级的云任务调度方法及装置
CN109960569B (zh) 一种虚拟化处理方法及装置
WO2013091219A1 (zh) 并发任务的处理方法及装置
WO2018107945A1 (zh) 一种实现硬件资源分配的方法、装置及存储介质
CN112783659A (zh) 一种资源分配方法、装置、计算机设备及存储介质
CN111104219A (zh) 虚拟核心与物理核心的绑定方法、装置、设备及存储介质
US9697047B2 (en) Cooperation of hoarding memory allocators in a multi-process system
CN106775975B (zh) 进程调度方法及装置
WO2023035664A1 (zh) 资源分配方法、云主机、计算机可读存储介质
JP2013182502A (ja) リソース配分システム、リソース配分方法、及びリソース配分プログラム
JP2015148909A (ja) 並列計算機システム、並列計算機システムの制御方法及び管理ノードの制御プログラム
CN116339989A (zh) 一种混部服务器、混部服务器的资源管理方法及装置
CN115878910A (zh) 线路查询方法、装置和存储介质

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: 22866142

Country of ref document: EP

Kind code of ref document: A1