CN103838634B - Method and system for dispatching number of virtual machines based on internal storage resource supplying - Google Patents
Method and system for dispatching number of virtual machines based on internal storage resource supplying Download PDFInfo
- Publication number
- CN103838634B CN103838634B CN201410100308.3A CN201410100308A CN103838634B CN 103838634 B CN103838634 B CN 103838634B CN 201410100308 A CN201410100308 A CN 201410100308A CN 103838634 B CN103838634 B CN 103838634B
- Authority
- CN
- China
- Prior art keywords
- memory
- virtual machine
- operating system
- subsystem
- scheduler subsystem
- Prior art date
- Legal status (The legal status 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 status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 37
- 230000006870 function Effects 0.000 claims description 7
- 238000013507 mapping Methods 0.000 claims description 3
- 230000007246 mechanism Effects 0.000 claims description 3
- 238000012545 processing Methods 0.000 claims description 3
- 238000012986 modification Methods 0.000 claims description 2
- 230000004048 modification Effects 0.000 claims description 2
- 239000000523 sample Substances 0.000 claims 2
- 230000006399 behavior Effects 0.000 claims 1
- 230000008859 change Effects 0.000 claims 1
- 230000008439 repair process Effects 0.000 claims 1
- 239000011800 void material Substances 0.000 claims 1
- 238000001514 detection method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000011084 recovery Methods 0.000 description 4
- 238000012360 testing method Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005265 energy consumption Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Abstract
本发明提供一种基于内存资源供给调度虚拟机数量的方法和系统,包括:根据虚拟机创建请求的到达率和系统创建虚拟机服务速率确定他们之间的数量关系,并确定系统允许创建的虚拟机的最优数量;修改宿主操作系统内存资源调度子系统的伙伴算法参数,将系统的可用内存划分为k块;宿主操作系统内存资源调度子系统调度k块内存的某一块给当前虚拟机的客户操作系统内存资源调度子系统;宿主操作系统内存资源调度子系统回收虚拟机客户操作系统内存资源调度子系统的内存。本发明解决了在数据中心物理服务器上宿主操作系统内存资源调度子系统和客户操作系统内存资源调度子系统之间调度内存资源的方法和系统,有效地指导了在物理服务器上调度虚拟机的数量。
The present invention provides a method and system for scheduling the number of virtual machines based on memory resource supply, including: determining the quantitative relationship between them according to the arrival rate of virtual machine creation requests and the service rate of virtual machine creation by the system, and determining the number of virtual machines that the system allows to create The optimal number of machines; modify the partner algorithm parameters of the host operating system memory resource scheduling subsystem, and divide the available memory of the system into k blocks; the host operating system memory resource scheduling subsystem schedules a block of k blocks of memory to the current virtual machine The guest operating system memory resource scheduling subsystem; the host operating system memory resource scheduling subsystem reclaims the memory of the virtual machine guest operating system memory resource scheduling subsystem. The present invention solves the method and system for scheduling memory resources between the memory resource scheduling subsystem of the host operating system and the memory resource scheduling subsystem of the guest operating system on the physical server of the data center, and effectively guides the number of scheduling virtual machines on the physical server .
Description
技术领域technical field
本发明涉及操作系统领域,特别涉及一种基于内存资源供给调度虚拟机数量的方法及系统。The invention relates to the field of operating systems, in particular to a method and system for scheduling the number of virtual machines based on memory resource supply.
背景技术Background technique
虚拟化技术是云计算的基石,云服务商通过提供虚拟化的计算资源和存储资源使得租户在众多的物理服务器上创建数以千计的虚拟机,然后在这些虚拟机上创建多种类型的操作系统,从而不同操作系统的不同服务满足了各种类型租户的需求。然而,在众多的物理服务器上创建数以千计的虚拟机需要解决很多难题,从内存资源调度的角度当前存在的难题主要有:Virtualization technology is the cornerstone of cloud computing. By providing virtualized computing resources and storage resources, cloud service providers enable tenants to create thousands of virtual machines on numerous physical servers, and then create various types of virtual machines on these virtual machines. Operating system, so that different services of different operating systems meet the needs of various types of tenants. However, creating thousands of virtual machines on many physical servers requires solving many problems. From the perspective of memory resource scheduling, the current problems mainly include:
1)在单一物理服务器内存容量既定的情况下,如何定量去估算在该服务器上创建虚拟机的个数;1) When the memory capacity of a single physical server is given, how to quantitatively estimate the number of virtual machines created on the server;
2)在1)基础上,从用户请求创建虚拟机的时间到获得内存资源开始创建虚拟机的时间如何建模,即用户请求速率和服务速率之间是否符合某种概率分布;2) On the basis of 1), how to model the time from the time when the user requests to create a virtual machine to the time when the virtual machine is created after obtaining memory resources, that is, whether the user request rate and the service rate conform to a certain probability distribution;
3)在2)基础上,在采用宿主模型虚拟机架构下,如何从宿主操作系统内存资源调度子系统中分配内存资源给客户操作系统内存资源调度子系统,客户操作系统内存资源调度子系统如何释放内存资源给宿主操作系统内存资源调度子系统;3) On the basis of 2), how to allocate memory resources from the memory resource scheduling subsystem of the host operating system to the memory resource scheduling subsystem of the guest operating system under the host model virtual machine architecture, and how the memory resource scheduling subsystem of the guest operating system Release memory resources to the host operating system memory resource scheduling subsystem;
当然,在云数据中心中,如何在众多物理服务器集中解决上述3个问题也是非常棘手和复杂的。Of course, in a cloud data center, how to centrally solve the above three problems on many physical servers is also very tricky and complicated.
发明内容Contents of the invention
本发明的目的在于提供一种基于内存资源供给调度虚拟机数量的方法及系统,以解决在物理服务器上创建虚拟机时内存资源提供和调度时存在的问题。The purpose of the present invention is to provide a method and system for scheduling the number of virtual machines based on memory resource supply, so as to solve the problems existing in memory resource supply and scheduling when virtual machines are created on physical servers.
为解决上述技术问题,本发明提供一种基于内存资源供给调度虚拟机数量的系统,包括:宿主操作系统内存资源调度子系统和客户操作系统内存资源调度子系统;In order to solve the above technical problems, the present invention provides a system for scheduling the number of virtual machines based on memory resource supply, including: a host operating system memory resource scheduling subsystem and a guest operating system memory resource scheduling subsystem;
所述宿主操作系统内存资源调度子系统包括内存分配模块和内存回收模块,其中,所述内存分配模块用于由所述宿主操作系统内存资源调度子系统分配内存块给所述客户操作系统内存资源调度子系统,所述内存回收模块用于所述宿主操作系统内存资源调度子系统回收宕机后的客户操作系统内存资源调度子系统的内存;The host operating system memory resource scheduling subsystem includes a memory allocation module and a memory recovery module, wherein the memory allocation module is used to allocate memory blocks to the guest operating system memory resources by the host operating system memory resource scheduling subsystem The scheduling subsystem, the memory recovery module is used for the host operating system memory resource scheduling subsystem to recover the memory of the guest operating system memory resource scheduling subsystem after downtime;
所述客户操作系统内存资源调度子系统包括内存探测模块和内存释放模块,其中,所述内存探测模块用于所述客户操作系统内存资源调度子系统在启动过程中探测到从所述宿主操作系统内存资源调度子系统分派过来的内存块,所述内存释放模块用于所述客户操作系统内存资源调度子系统在宕机时刻将其占用的内存返回给宿主操作系统内存资源调度子系统。The guest operating system memory resource scheduling subsystem includes a memory detection module and a memory release module, wherein the memory detection module is used for the guest operating system memory resource scheduling subsystem to detect the For the memory block assigned by the memory resource scheduling subsystem, the memory release module is used for the memory resource scheduling subsystem of the guest operating system to return the occupied memory to the host operating system memory resource scheduling subsystem when it is down.
同时,本发明还提供一种基于内存资源供给调度虚拟机数量的方法,使用所述的基于内存资源供给调度虚拟机数量的系统,包括:At the same time, the present invention also provides a method for scheduling the number of virtual machines based on the supply of memory resources, using the system for scheduling the number of virtual machines based on the supply of memory resources, including:
获取虚拟机创建请求的到达率;获取系统创建虚拟机服务速率;根据虚拟机创建请求的到达率和系统创建虚拟机服务速率确定他们之间的数量关系,并确定系统允许创建的虚拟机的最优数量;Obtain the arrival rate of virtual machine creation requests; obtain the service rate of virtual machine creation by the system; determine the quantitative relationship between them according to the arrival rate of virtual machine creation requests and the service rate of virtual machine creation by the system, and determine the maximum number of virtual machines that the system allows to create Excellent quantity;
修改宿主操作系统内存资源调度子系统的伙伴算法参数,将系统的可用内存划分为k块;Modify the partner algorithm parameters of the memory resource scheduling subsystem of the host operating system, and divide the available memory of the system into k blocks;
宿主操作系统内存资源调度子系统调度k块内存的某一块给当前虚拟机的客户操作系统内存资源调度子系统;The host operating system memory resource scheduling subsystem schedules a certain block of k blocks of memory to the guest operating system memory resource scheduling subsystem of the current virtual machine;
宿主操作系统内存资源调度子系统回收虚拟机客户操作系统内存资源调度子系统的内存。The host operating system memory resource scheduling subsystem reclaims the memory of the virtual machine guest operating system memory resource scheduling subsystem.
进一步的,在所述的基于内存资源供给调度虚拟机数量的方法中,所述获取虚拟机创建请求的到达率通过以下公式获得:Further, in the method for scheduling the number of virtual machines based on memory resource supply, the arrival rate of obtaining virtual machine creation requests is obtained by the following formula:
当n->∞时,When n->∞,
其中 in
Pm(t)表示在时间间隔t时有m个虚拟机请求创建的概率,λ表示虚拟机请求创建时,新的虚拟机创建请求的到达率,n表示在时间间隔t内,将时间切分成n等分进行无穷小化。P m (t) represents the probability that there are m virtual machine requests to be created at time interval t, λ represents the arrival rate of new virtual machine creation requests when virtual machine requests are created, and n represents the time cut time within time interval t Divide into n equal parts for infinitesimal reduction.
进一步的,在所述的基于内存资源供给调度虚拟机数量的方法中,所述获取系统创建虚拟机服务速率通过以下公式获得:Further, in the method for scheduling the number of virtual machines based on the supply of memory resources, the service rate of virtual machines created by the acquisition system is obtained by the following formula:
P{X>t}=e-μt其中,μ表示虚拟机请求创建时,系统创建虚拟机服务速率。P{X>t}=e -μt wherein, μ represents the virtual machine service rate created by the system when the virtual machine requests to be created.
进一步的,在所述的基于内存资源供给调度虚拟机数量的方法中,所述根据虚拟机创建请求的到达率和系统创建虚拟机服务速率确定他们之间的数量关系过以下公式获得:Further, in the method for scheduling the number of virtual machines based on memory resource supply, the quantitative relationship between them is determined according to the arrival rate of virtual machine creation requests and the service rate of virtual machine creation by the system through the following formula:
k:宿主操作系统内存资源调度子系统提供的内存块k: The memory block provided by the memory resource scheduling subsystem of the host operating system
m:请求创建虚拟机的个数m: the number of virtual machines requested to be created
pm:请求创建m个虚拟机的概率p m : the probability of requesting to create m virtual machines
进一步的,在所述的基于内存资源供给调度虚拟机数量的方法中,所述的k块内存指内存的块之间连续或不连续,块内是连续的。Further, in the method for scheduling the number of virtual machines based on memory resource supply, the k blocks of memory refer to continuous or discontinuous memory blocks, and continuous within a block.
进一步的,在所述的基于内存资源供给调度虚拟机数量的方法中,所述修改宿主操作系统内存资源调度子系统的伙伴算法参数,将系统的可用内存划分为k块的步骤包括:Further, in the method for scheduling the number of virtual machines based on memory resource supply, the step of modifying the partner algorithm parameters of the memory resource scheduling subsystem of the host operating system and dividing the available memory of the system into k blocks includes:
在当前宿主操作系统内存资源调度子系统的伙伴系统中分配k块内存用于虚拟机的客户操作系统内存资源调度子系统,利用锁机制锁住所述k块内存;Allocating k blocks of memory in the partner system of the current host operating system memory resource scheduling subsystem for the guest operating system memory resource scheduling subsystem of the virtual machine, and locking the k blocks of memory by using a lock mechanism;
在每个虚拟机的客户操作系统内存资源调度子系统的物理内存描述区增加一项用于描述当前用于此虚拟机创建的内存块信息。An item is added in the physical memory description area of the guest operating system memory resource scheduling subsystem of each virtual machine to describe the memory block information currently used for creating the virtual machine.
进一步的,在所述的基于内存资源供给调度虚拟机数量的方法中,所述宿主操作系统内存资源调度子系统调度k块内存的某一块给当前虚拟机的客户操作系统内存资源调度子系统的步骤包括:Further, in the method for scheduling the number of virtual machines based on memory resource supply, the host operating system memory resource scheduling subsystem schedules a certain block of k blocks of memory to the guest operating system memory resource scheduling subsystem of the current virtual machine Steps include:
宿主操作系统内存资源调度子系统顺序选择k块内存的某一块,并标识这块内存的物理页表的起始页帧号;The memory resource scheduling subsystem of the host operating system sequentially selects a block of k blocks of memory, and identifies the starting page frame number of the physical page table of this block of memory;
虚拟机的客户操作系统内存资源调度子系统加载某一块内存,并读取该内存块信息,同时更新当前客户操作系统内存资源调度子系统内存管理模块的物理页帧数量、物理页表的起始页帧号、页表映射关系、内存区域、内存节点等数据结构,更新完成后,发送一个完成消息给宿主操作系统内存资源调度子系统;The guest operating system memory resource scheduling subsystem of the virtual machine loads a block of memory, reads the information of the memory block, and simultaneously updates the number of physical page frames and the starting point of the physical page table of the memory management module of the current guest operating system memory resource scheduling subsystem. Data structures such as page frame number, page table mapping relationship, memory area, memory node, etc., after the update is completed, send a completion message to the memory resource scheduling subsystem of the host operating system;
宿主操作系统内存资源调度子系统接收到完成的消息后,将该块内存从宿主操作系统内存资源调度子系统的内存管理池中清除出去。After receiving the completion message, the memory resource scheduling subsystem of the host operating system clears the block of memory from the memory management pool of the memory resource scheduling subsystem of the host operating system.
进一步的,在所述的基于内存资源供给调度虚拟机数量的方法中,所述宿主操作系统内存资源调度子系统回收虚拟机客户操作系统内存资源调度子系统的内存的步骤包括:Further, in the method for scheduling the number of virtual machines based on memory resource supply, the step of the host operating system memory resource scheduling subsystem reclaiming the memory of the virtual machine guest operating system memory resource scheduling subsystem includes:
虚拟机的客户操作系统内存资源调度子系统收到宕机调度后,将其已获得的物理页帧数量、物理页表的起始页帧号打包成一个消息;After the memory resource scheduling subsystem of the guest operating system of the virtual machine receives the downtime scheduling, it packs the number of physical page frames it has obtained and the starting page frame number of the physical page table into a message;
虚拟机的客户操作系统内存资源调度子系统发送一个处理器之间的中断给宿主操作系统内存资源调度子系统,并将所述消息投递给宿主操作系统内存资源调度子系统;The guest operating system memory resource scheduling subsystem of the virtual machine sends an interprocessor interrupt to the host operating system memory resource scheduling subsystem, and delivers the message to the host operating system memory resource scheduling subsystem;
宿主操作系统内存资源调度子系统接收到这个处理器之间的中断后,执行一个预先定义的处理器之间的中断处理函数,这个函数的功能是解析所述投递给宿主操作系统内存资源调度子系统的消息,并根据这个消息将当前需要宕机的虚拟机客户操作系统内存资源调度子系统的内存重新纳入宿主操作系统内存资源调度子系统的内存管理池中。After the host operating system memory resource scheduling subsystem receives the interrupt between the processors, it executes a predefined interrupt processing function between the processors. System message, and according to this message, the memory of the virtual machine guest operating system memory resource scheduling subsystem that needs to be shut down is reintroduced into the memory management pool of the host operating system memory resource scheduling subsystem.
本发明提供的一种基于内存资源供给调度虚拟机数量的方法及系统,具有以下有益效果:解决了在数据中心物理服务器上宿主操作系统内存资源调度子系统和客户操作系统内存资源调度子系统之间调度内存资源的方法和系统,同时建立了虚拟机创建的请求速率和系统的服务速率之间的关系,有效地指导了在物理服务器上调度虚拟机的数量,合理地降低了物理服务器的能耗。A method and system for scheduling the number of virtual machines based on memory resource supply provided by the present invention has the following beneficial effects: it solves the problem between the memory resource scheduling subsystem of the host operating system and the memory resource scheduling subsystem of the guest operating system on the physical server of the data center. The method and system for scheduling memory resources in between, and at the same time established the relationship between the request rate of virtual machine creation and the service rate of the system, effectively guiding the number of virtual machines to be scheduled on the physical server, and reasonably reducing the performance of the physical server consumption.
附图说明Description of drawings
图1是本发明较佳实施例的基于内存资源供给调度虚拟机数量的系统示意图;FIG. 1 is a schematic diagram of a system for scheduling the number of virtual machines based on memory resource supply in a preferred embodiment of the present invention;
图2是本发明较佳实施例的基于内存资源供给调度虚拟机数量的方法示意图;2 is a schematic diagram of a method for scheduling the number of virtual machines based on memory resource supply in a preferred embodiment of the present invention;
图3是是本发明较佳实施例的虚拟机创建请求的到达率分布曲线示意图。Fig. 3 is a schematic diagram of an arrival rate distribution curve of a virtual machine creation request according to a preferred embodiment of the present invention.
具体实施方式detailed description
以下结合附图和具体实施例对本发明提出的基于内存资源供给调度虚拟机数量的方法及系统作进一步详细说明。根据下面说明和权利要求书,本发明的优点和特征将更清楚。需说明的是,附图均采用非常简化的形式且均使用非精准的比例,仅用以方便、明晰地辅助说明本发明实施例的目的。The method and system for scheduling the number of virtual machines based on the supply of memory resources proposed by the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Advantages and features of the present invention will be apparent from the following description and claims. It should be noted that all the drawings are in a very simplified form and use imprecise scales, and are only used to facilitate and clearly assist the purpose of illustrating the embodiments of the present invention.
请参考图1,其是本发明较佳实施例的基于内存资源供给调度虚拟机数量的系统示意图。本实施例以ubuntu-12.04.3LTS为宿主操作系统内存资源调度子系统,ubuntu-12.04.3LTS为客户操作系统内存资源调度子系统实现一个如图1所示的应用系统,本应用系统的内核版本号为Linux-3.8.0,CPU型号为Intel(R)Xeon(R)E56202.4GHz。该系统在宿主操作系统内存资源调度子系统的内存管理中主要增加了内存分配模块和内存回收模块,其中,所述内存分配模块用于由宿主操作系统内存资源调度子系统分配内存块给客户操作系统内存资源调度子系统,所述内存回收模块用于宿主操作系统内存资源调度子系统回收宕机后的客户操作系统内存资源调度子系统的内存;该系统在客户操作系统内存资源调度子系统的内存管理中主要增加了内存探测模块和内存释放模块,其中,所述内存探测模块用于客户操作系统内存资源调度子系统在启动过程中探测到从宿主操作系统内存资源调度子系统分派过来的内存块,所述内存释放模块用于客户操作系统内存资源调度子系统在宕机时刻将其占用的内存返回给宿主操作系统内存资源调度子系统。Please refer to FIG. 1 , which is a schematic diagram of a system for scheduling the number of virtual machines based on memory resource supply in a preferred embodiment of the present invention. This embodiment uses ubuntu-12.04.3LTS as the host operating system memory resource scheduling subsystem, and ubuntu-12.04.3LTS implements an application system as shown in Figure 1 for the guest operating system memory resource scheduling subsystem. The kernel version of this application system The number is Linux-3.8.0, and the CPU model is Intel(R) Xeon(R) E56202.4GHz. The system mainly adds a memory allocation module and a memory recovery module in the memory management of the host operating system memory resource scheduling subsystem, wherein the memory allocation module is used for the host operating system memory resource scheduling subsystem to allocate memory blocks to client operations The system memory resource scheduling subsystem, the memory recovery module is used for the host operating system memory resource scheduling subsystem to reclaim the memory of the guest operating system memory resource scheduling subsystem after downtime; the system is installed in the guest operating system memory resource scheduling subsystem In the memory management, a memory detection module and a memory release module are mainly added, wherein the memory detection module is used for the memory resource dispatching subsystem of the guest operating system to detect the memory allocated from the memory resource dispatching subsystem of the host operating system during the startup process. Block, the memory release module is used for the memory resource scheduling subsystem of the guest operating system to return the occupied memory to the memory resource scheduling subsystem of the host operating system at the moment of downtime.
请参考图2,其是本发明较佳实施例的基于内存资源供给调度虚拟机数量的方法示意图。如图2所示,本发明提供一种基于内存资源供给调度虚拟机数量的方法,包括以下步骤:Please refer to FIG. 2 , which is a schematic diagram of a method for scheduling the number of virtual machines based on memory resource supply according to a preferred embodiment of the present invention. As shown in Figure 2, the present invention provides a method for scheduling the number of virtual machines based on memory resource supply, including the following steps:
A)获取虚拟机创建请求的到达率、获取系统创建虚拟机服务速率,根据所述虚拟机创建请求的到达率和系统创建虚拟机服务速率确定他们之间的数量关系,并确定系统允许创建的虚拟机的最优数量k;A) Obtain the arrival rate of the virtual machine creation request, obtain the service rate of the virtual machine created by the system, determine the quantitative relationship between them according to the arrival rate of the virtual machine creation request and the service rate of the virtual machine created by the system, and determine the allowed creation of the system The optimal number k of virtual machines;
A1)获取虚拟机创建请求的到达率;A1) Obtain the arrival rate of virtual machine creation requests;
S:单体物理服务器和其上创建的多个虚拟机组成的系统;S: A system consisting of a single physical server and multiple virtual machines created on it;
N(t):在某个时刻t,用户请求创建虚拟机的个数,其值也是此刻用户请求创建虚拟机的队列长;N(t): At a certain time t, the number of virtual machines requested by the user to be created, and its value is also the queue length of the virtual machine requested by the user at this moment;
Pm(t):在时间间隔t时有m个虚拟机请求创建的概率;P m (t): the probability that there are m virtual machine requests to create at time interval t;
λm:S中有m个虚拟机请求创建时,新的虚拟机创建请求的到达率;λ m : When there are m virtual machine requests in S, the arrival rate of new virtual machine creation requests;
μm:S中有m个虚拟机请求创建时,S创建虚拟机的服务速率。μ m : When there are m virtual machine requests in S, the service rate of creating virtual machines in S.
在时间间隔t内,将时间切分成n等分进行无穷小化,设Δt=t/n,若在Δt时间内,其到达率为λ,则有一个虚拟机创建请求到达时可以标识为λ*Δt,没有虚拟机请求创建的概率为1-λ*Δt。由于用户请求创建的时刻相互独立,即用户创建虚拟机的请求独立的随机到达,所以在有n个Δt的时间间隔t内,有创建虚拟机的请求或者没有创建虚拟机的请求可以认为是n次独立试验,所以在n个Δt中有m个虚拟机创建请求的概率为:In the time interval t, divide the time into n equal parts for infinitesimal minimization, set Δt=t/n, if the arrival rate is λ within Δt time, then a virtual machine creation request can be identified as λ* when it arrives Δt, the probability that no virtual machine request is created is 1-λ*Δt. Since the creation time of the user request is independent of each other, that is, the user's request to create a virtual machine arrives independently and randomly, so within the time interval t of n Δt, there is a request to create a virtual machine or no request to create a virtual machine can be considered as n independent experiments, so the probability of m virtual machine creation requests in n Δt is:
当n->∞时,When n->∞,
式Ⅰ Formula Ⅰ
其中,Pm(t)表示在时间间隔t时有m个虚拟机请求创建的概率,λ表示虚拟机请求创建时,新的虚拟机创建请求的到达率,n表示在时间间隔t内,将时间切分成n等分进行无穷小化。Among them, P m (t) represents the probability that there are m virtual machine requests to be created at time interval t, λ represents the arrival rate of new virtual machine creation requests when virtual machine requests are created, and n represents the number of virtual machine creation requests within time interval t. Time is divided into n equal parts for infinitesimal minimization.
由式Ⅰ表明在时间间隔t内,用户请求创建虚拟机的过程服从参数为λt的泊松过程。Formula I shows that within the time interval t, the process of user request to create a virtual machine obeys the Poisson process with parameter λt.
表1是如图1所示的系统中在某次试验时单位时间内(以30s为一个单位时间)虚拟机创建的请求数和出现频次的统计样本表。Table 1 is a statistical sample table of the number of requests created by virtual machines and the frequency of occurrence in a unit time (with 30s as a unit time) in the system shown in FIG. 1 .
表1Table 1
由表1得到如附图3所示的虚拟机创建请求的到达率分布曲线,该曲线反映了虚拟机创建请求的到达率符合泊松过程,对于泊松过程,样本均值是参数λ的极大似然估计,所以,The arrival rate distribution curve of the virtual machine creation request shown in Figure 3 is obtained from Table 1. This curve reflects that the arrival rate of the virtual machine creation request conforms to the Poisson process. For the Poisson process, the sample mean is the maximum of the parameter λ Likelihood estimates, so,
A2)获取系统创建虚拟机服务速率;A2) Obtain the service rate of the virtual machine created by the system;
由于在物理服务器上,系统创建虚拟机服务时间的先后是没有记忆性的,即在任意点的s,t内,系统创建虚拟机的服务时间没有相互影响,若系统创建虚拟机的服务速率为μ,根据概率论的有关知识,则可以断定系统创建虚拟机的服务时间是一个服从参数为μ的指数分布,即有下列式Ⅱ成立:Because on the physical server, the service time of the virtual machine created by the system has no memory, that is, within s and t at any point, the service time of the virtual machine created by the system does not affect each other. If the service rate of the virtual machine created by the system is μ, according to the relevant knowledge of probability theory, it can be concluded that the service time of the virtual machine created by the system is an exponential distribution with parameter μ, that is, the following formula II is established:
对于 for
式Ⅱ Formula II
表2是如图1所示的系统在某次试验时创建虚拟机的服务时间和出现频次的的统计样本表。Table 2 is a statistical sample table of the service time and occurrence frequency of the virtual machine created by the system in a certain test as shown in FIG. 1 .
表2Table 2
由表2系统的服务速率为:The service rate of the system from Table 2 is:
A3)根据所述虚拟机创建请求的到达率和系统创建虚拟机服务速率确定他们之间的数量关系。A3) Determine the quantitative relationship between them according to the arrival rate of the virtual machine creation request and the service rate of the virtual machine created by the system.
设在物理服务器上有k个服务线可以接受用户请求创建虚拟机,所述的k个服务线是指系统S能够提供k块可用内存用于满足用户创建虚拟机的请求。Assuming that there are k service lines on the physical server that can accept user requests to create virtual machines, the k service lines mean that the system S can provide k blocks of available memory to satisfy the user's request to create a virtual machine.
若λm>μm,则表明用户请求创建虚拟机的到达率超过了系统创建虚拟机的服务速率,这种情况累积下去必将导致系统S中有大量用户请求排队的情况发生,即系统S提供的可用内存块数是瓶颈;若λm<μm,则表明系统创建虚拟机的服务速率超过了用户请求创建虚拟机的到达率,这种情况累积下去必将导致系统S中有大量可用内存块闲置,即系统S发生了空转,浪费了电能。所以,为了避免上述两种情况发生,应该有下列式Ⅳ成立:If λ m > μ m , it indicates that the arrival rate of user requests to create virtual machines exceeds the service rate of virtual machines created by the system. If this situation accumulates, it will inevitably lead to a large number of user requests queuing in system S, that is, system S The number of available memory blocks provided is the bottleneck; if λ m < μ m , it indicates that the service rate of creating virtual machines by the system exceeds the arrival rate of user requests to create virtual machines. The memory block is idle, that is, the system S is idling, wasting electric energy. Therefore, in order to avoid the above two situations, the following formula IV should be established:
要使pm存在,则必须有 For p m to exist, there must be
当系统S提供k块可用内存时:,λm=λm≥0When system S provides k blocks of available memory: ,λ m =λ m ≥0
所以: so:
于是: then:
式Ⅳ Formula IV
A4)确定系统允许创建的虚拟机的最优数量k。A4) Determine the optimal number k of virtual machines that the system allows to create.
由式Ⅳ很容易得出,当用户请求创建虚拟机的个数m小于系统S提供的可用内存块k时,系统S的服务速率取决于m,当用户请求创建虚拟机的个数m大于系统S提供的可用内存块k时,系统S的服务速率取决于k,当用户请求创建虚拟机的个数m与系统S提供的可用内存块k相等时,单一物理服务器上运行的虚拟机个数达到了最优。It is easy to draw from Formula IV that when the number m of virtual machines requested by users is less than the available memory block k provided by system S, the service rate of system S depends on m, and when the number m of virtual machines requested by users is greater than that of system S When the available memory block k provided by S, the service rate of system S depends on k, when the number m of virtual machines requested by users is equal to the available memory block k provided by system S, the number of virtual machines running on a single physical server reached the optimum.
由A1)和A2)和得到λ>μ,即系统虚拟机创建请求的到达率大于系统的服务速率,系统允许创建的虚拟机的最优数量取决于当前进行试验的物理服务器的可用内存块(进行试验的物理服务器的内存为64GB,可用内存块30,每个虚拟机的客户操作系统内存资源调度子系统用2GB内存块)。降低虚拟机创建请求的到达率,使得λ接近于μ,可以确定系统允许创建的虚拟机的最优数量为30。From the sum of A1) and A2), it is obtained that λ>μ, that is, the arrival rate of system virtual machine creation requests is greater than the service rate of the system, and the optimal number of virtual machines that the system allows to create depends on the available memory block of the physical server currently being tested ( The memory of the physical server for the test is 64GB, and the available memory block is 30, and the guest operating system memory resource scheduling subsystem of each virtual machine uses a 2GB memory block). Reduce the arrival rate of virtual machine creation requests so that λ is close to μ, and it can be determined that the optimal number of virtual machines that the system allows to create is 30.
B)修改宿主操作系统内存资源调度子系统的伙伴算法参数,将系统的可用内存划分为k块,所述的k块内存指内存的块之间可以连续也可以不连续,但块内是连续的。其实现方法为:B) Modify the partner algorithm parameters of the host operating system memory resource scheduling subsystem, and divide the available memory of the system into k blocks. The k blocks of memory refer to that the blocks of memory can be continuous or discontinuous, but the block is continuous of. Its realization method is:
B1)在当前宿主操作系统内存资源调度子系统的伙伴系统中分配k块内存用于虚拟机的客户操作系统内存资源调度子系统,利用锁机制锁住这k块内存;B1) Allocate k blocks of memory in the partner system of the current host operating system memory resource scheduling subsystem for the guest operating system memory resource scheduling subsystem of the virtual machine, and use a lock mechanism to lock the k blocks of memory;
该步骤实施时在宿主操作系统内存资源调度子系统的内核文件如“include/linux/mmzone.h”等中调整MAX_ORDER等参数,这样使得系统能够分配大块连续内存,并利用内存锁防止这些内存换出到外存。When this step is implemented, adjust parameters such as MAX_ORDER in the kernel file of the host operating system memory resource scheduling subsystem, such as "include/linux/mmzone.h", so that the system can allocate large blocks of continuous memory, and use memory locks to prevent these memory Swap out to external storage.
B2)在每个虚拟机的客户操作系统内存资源调度子系统的物理内存描述符区增加一项用于描述当前用于此虚拟机创建的内存块信息。B2) An item is added in the physical memory descriptor area of the guest operating system memory resource scheduling subsystem of each virtual machine to describe the memory block information currently used for creating the virtual machine.
为了使虚拟机的客户操作系统内存资源调度子系统在启动时能够探测到当前能够提供的内存块的分布情况,该步骤实施时在客户操作系统内存资源调度子系统的内核文件如“arch/x86/kernel/E820.C”等文件中重新构造e820map等数据结构,说明该虚拟机的客户操作系统内存资源调度子系统可用的物理内存的起始地址,最大页帧号等信息,然后进行构造页表,初始化页目录等一系列操作。In order to enable the memory resource scheduling subsystem of the guest operating system of the virtual machine to detect the distribution of memory blocks that can be provided at present, when this step is implemented, the kernel file of the memory resource scheduling subsystem of the guest operating system such as "arch/x86 /kernel/E820.C" and other files to reconstruct data structures such as e820map, explain the starting address of the physical memory available to the guest operating system memory resource scheduling subsystem of the virtual machine, the maximum page frame number and other information, and then construct the page table, initialize the page directory and a series of operations.
C)宿主操作系统内存资源调度子系统调度k块内存的某一块给当前虚拟机的客户操作系统内存资源调度子系统。其实现方法为:C) The memory resource scheduling subsystem of the host operating system schedules a certain block of k blocks of memory to the guest operating system memory resource scheduling subsystem of the current virtual machine. Its realization method is:
C1)宿主操作系统内存资源调度子系统顺序选择k块内存的某一块,并标识这块内存的物理页表的起始页帧号;C1) The host operating system memory resource scheduling subsystem sequentially selects a certain block of k blocks of memory, and identifies the starting page frame number of the physical page table of this memory;
该步骤实施时在宿主操作系统内存资源调度子系统的内核文件如“mm/page_alloc.c”等中修改,从中分配一块可用内存。During the implementation of this step, modify the kernel file such as "mm/page_alloc.c" of the memory resource scheduling subsystem of the host operating system, and allocate a piece of available memory therefrom.
C2)虚拟机的客户操作系统内存资源调度子系统在获得C1分配的某一块内存开始加载,在加载的检测内存阶段读取B2步骤中内存块的描述信息,同时更新当前客户操作系统内存资源调度子系统内存管理模块的物理页帧数量、物理页表的起始页帧号、页表映射关系、内存区域、内存节点等数据结构,更新完成后,发送一个完成消息给宿主操作系统内存资源调度子系统;C2) The guest operating system memory resource scheduling subsystem of the virtual machine starts loading after obtaining a block of memory allocated by C1, reads the description information of the memory block in step B2 during the loading detection memory stage, and updates the current guest operating system memory resource scheduling Subsystem memory management module physical page frame number, physical page table start page frame number, page table mapping relationship, memory area, memory node and other data structures, after the update is completed, send a completion message to the host operating system memory resource scheduling subsystem;
C3)宿主操作系统内存资源调度子系统接收到这个完成的消息后,将C1分派出去的某一块内存从宿主操作系统内存资源调度子系统的内存管理池中清除出去。C3) After receiving the completion message, the memory resource scheduling subsystem of the host operating system clears a piece of memory assigned by C1 from the memory management pool of the memory resource scheduling subsystem of the host operating system.
上述C2)、C3)中客户操作系统内存资源调度子系统发送给宿主操作系统内存资源调度子系统的消息用处理器之间的中断(IPI)中断实现,需要在宿主操作系统内存资源调度子系统预先设置一个中断处理函数来处理这个消息。In the above C2) and C3), the message sent by the memory resource scheduling subsystem of the guest operating system to the memory resource scheduling subsystem of the host operating system is realized by an interrupt (IPI) interrupt between processors, which needs to be implemented in the memory resource scheduling subsystem of the host operating system Preset an interrupt handler to handle this message.
D)宿主操作系统内存资源调度子系统回收虚拟机客户操作系统内存资源调度子系统的内存。其实现方法为:D) The memory resource scheduling subsystem of the host operating system reclaims the memory of the guest operating system memory resource scheduling subsystem of the virtual machine. Its realization method is:
D1)虚拟机的客户操作系统内存资源调度子系统收到宕机调度后,将其已获得的物理页帧数量、物理页表的起始页帧号打包成一个消息;D1) After the guest operating system memory resource scheduling subsystem of the virtual machine receives the downtime scheduling, it packs the number of physical page frames it has obtained and the initial page frame number of the physical page table into a message;
D2)虚拟机的客户操作系统内存资源调度子系统发送一个处理器之间的中断(IPI)给宿主操作系统内存资源调度子系统,并将D1)中的消息投递给宿主操作系统内存资源调度子系统;D2) The guest operating system memory resource scheduling subsystem of the virtual machine sends an interprocessor interrupt (IPI) to the host operating system memory resource scheduling subsystem, and delivers the message in D1) to the host operating system memory resource scheduling subsystem system;
D3)宿主操作系统内存资源调度子系统接收到这个处理器之间的中断后,执行一个预先定义的处理器之间的中断处理函数,这个函数的功能是解析D2)投递给宿主操作系统内存资源调度子系统的消息,并根据这个消息将当前需要宕机的虚拟机客户操作系统内存资源调度子系统的内存重新纳入宿主操作系统内存资源调度子系统的内存管理池中。D3) After the host operating system memory resource scheduling subsystem receives the interrupt between the processors, it executes a predefined interrupt processing function between the processors. The function of this function is to analyze D2) and deliver it to the host operating system memory resource According to the message of the dispatching subsystem, the memory of the guest operating system memory resource dispatching subsystem of the virtual machine that needs to be shut down is brought back into the memory management pool of the memory resource dispatching subsystem of the host operating system according to the message.
综上所述,本发明解决了在数据中心物理服务器上宿主操作系统内存资源调度子系统和客户操作系统内存资源调度子系统之间调度内存资源的方法和系统,同时建立了虚拟机创建的请求速率和系统的服务速率之间的关系,有效地指导了在物理服务器上调度虚拟机的数量合理地降低了物理服务器的能耗。In summary, the present invention solves the method and system for scheduling memory resources between the memory resource scheduling subsystem of the host operating system and the memory resource scheduling subsystem of the guest operating system on the physical server of the data center, and at the same time establishes a request for creating a virtual machine The relationship between the rate and the service rate of the system effectively guides the scheduling of the number of virtual machines on the physical server to reasonably reduce the energy consumption of the physical server.
上述描述仅是对本发明较佳实施例的描述,并非对本发明范围的任何限定,本发明领域的普通技术人员根据上述揭示内容做的任何变更、修饰,均属于权利要求书的保护范围。The above description is only a description of the preferred embodiments of the present invention, and does not limit the scope of the present invention. Any changes and modifications made by those of ordinary skill in the field of the present invention based on the above disclosures shall fall within the protection scope of the claims.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410100308.3A CN103838634B (en) | 2014-03-18 | 2014-03-18 | Method and system for dispatching number of virtual machines based on internal storage resource supplying |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410100308.3A CN103838634B (en) | 2014-03-18 | 2014-03-18 | Method and system for dispatching number of virtual machines based on internal storage resource supplying |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103838634A CN103838634A (en) | 2014-06-04 |
CN103838634B true CN103838634B (en) | 2017-02-22 |
Family
ID=50802164
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410100308.3A Expired - Fee Related CN103838634B (en) | 2014-03-18 | 2014-03-18 | Method and system for dispatching number of virtual machines based on internal storage resource supplying |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103838634B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106484632A (en) * | 2015-09-01 | 2017-03-08 | 华耀(中国)科技有限公司 | Method of allocating continuous physical memory in user space of Linux system |
CN111506426B (en) * | 2020-04-17 | 2021-05-04 | 翱捷科技(深圳)有限公司 | Memory management method and device and electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101158924A (en) * | 2007-11-27 | 2008-04-09 | 北京大学 | A dynamic memory mapping method for a virtual machine manager |
US7433951B1 (en) * | 2000-09-22 | 2008-10-07 | Vmware, Inc. | System and method for controlling resource revocation in a multi-guest computer system |
CN101493781A (en) * | 2008-01-24 | 2009-07-29 | 中国长城计算机深圳股份有限公司 | Virtual machine system and start-up method thereof |
CN101976200A (en) * | 2010-10-15 | 2011-02-16 | 浙江大学 | Virtual machine system for input/output equipment virtualization outside virtual machine monitor |
-
2014
- 2014-03-18 CN CN201410100308.3A patent/CN103838634B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7433951B1 (en) * | 2000-09-22 | 2008-10-07 | Vmware, Inc. | System and method for controlling resource revocation in a multi-guest computer system |
CN101158924A (en) * | 2007-11-27 | 2008-04-09 | 北京大学 | A dynamic memory mapping method for a virtual machine manager |
CN101493781A (en) * | 2008-01-24 | 2009-07-29 | 中国长城计算机深圳股份有限公司 | Virtual machine system and start-up method thereof |
CN101976200A (en) * | 2010-10-15 | 2011-02-16 | 浙江大学 | Virtual machine system for input/output equipment virtualization outside virtual machine monitor |
Non-Patent Citations (2)
Title |
---|
Memory Resource Management in VMware ESX Server;Carl A. Waldspurger;《Fifth Symposium on Operating Systems Design and Implementation》;20021231;1-14 * |
虚拟机 Xen及其内存管理研究;郭晓琼;《中国优秀硕士学位论文全文数据库信息科技辑》;20080715(第07期);I138-425 * |
Also Published As
Publication number | Publication date |
---|---|
CN103838634A (en) | 2014-06-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2014309371B2 (en) | Virtual hadoop manager | |
CN111625331B (en) | Task scheduling method, device, platform, server and storage medium | |
CN103530189B (en) | It is a kind of towards the automatic telescopic of stream data and the method and device of migration | |
CN106502791B (en) | A kind of method for allocating tasks and device | |
US7844853B2 (en) | Methods and apparatus for restoring a node state | |
CN109564528B (en) | System and method for computing resource allocation in distributed computing | |
Guo et al. | Moving hadoop into the cloud with flexible slot management and speculative execution | |
CN107003887A (en) | Overloaded cpu setting and cloud computing workload schedules mechanism | |
US10545791B2 (en) | Methods to apply IOPS and MBPS limits independently using cross charging and global cost synchronization | |
US20140026147A1 (en) | Varying a characteristic of a job profile relating to map and reduce tasks according to a data size | |
CN107291550B (en) | A Spark platform resource dynamic allocation method and system for iterative applications | |
CN111190691A (en) | Automatic migration method, system, device and storage medium suitable for virtual machine | |
WO2015032201A1 (en) | Virtual machine placing method and device | |
CN103064746A (en) | Processor resource accurate distributing method for predictive scheduling based on current credit | |
CN102253857A (en) | Xen virtual machine scheduling control method in multi-core environment | |
US20150378782A1 (en) | Scheduling of tasks on idle processors without context switching | |
CN104636187A (en) | Virtual machine scheduling method in NUMA (non uniform memory access) architecture and based on load prediction | |
CN102999317B (en) | Towards the elasticity multi-process service processing method of many tenants | |
CN108153583A (en) | Method for allocating tasks and device, real-time Computational frame system | |
Zhang et al. | CloudGC: Recycling idle virtual machines in the cloud | |
CN103106112A (en) | Method and device based on maximum load and used for load balancing scheduling | |
CN103838634B (en) | Method and system for dispatching number of virtual machines based on internal storage resource supplying | |
US9612907B2 (en) | Power efficient distribution and execution of tasks upon hardware fault with multiple processors | |
CN113934525A (en) | Hadoop cluster task scheduling method based on positive and negative feedback load scheduling algorithm | |
CN106155782B (en) | Virtual machine migration method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170222 Termination date: 20200318 |
|
CF01 | Termination of patent right due to non-payment of annual fee |