CN115794306A - Resource allocation method and device based on preemption instance, electronic equipment and medium - Google Patents

Resource allocation method and device based on preemption instance, electronic equipment and medium Download PDF

Info

Publication number
CN115794306A
CN115794306A CN202211442618.4A CN202211442618A CN115794306A CN 115794306 A CN115794306 A CN 115794306A CN 202211442618 A CN202211442618 A CN 202211442618A CN 115794306 A CN115794306 A CN 115794306A
Authority
CN
China
Prior art keywords
instance
nodes
preemption
node
target
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.)
Pending
Application number
CN202211442618.4A
Other languages
Chinese (zh)
Inventor
刘敏
梁小彪
刘心迪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianyi Cloud Technology Co Ltd
Original Assignee
Tianyi Cloud Technology Co Ltd
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 Tianyi Cloud Technology Co Ltd filed Critical Tianyi Cloud Technology Co Ltd
Priority to CN202211442618.4A priority Critical patent/CN115794306A/en
Publication of CN115794306A publication Critical patent/CN115794306A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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

Abstract

The invention provides a resource allocation method and device based on a preemption instance, electronic equipment and a medium. The resource allocation method based on the preemption example comprises the following steps: monitoring whether a first number of nodes of a first preempting instance node within the first preempting instance node group is greater than or equal to a specified number. And if the number of the first nodes is less than the designated number, sending an interrupt signal to alarm that the number of the first preemption instance nodes is insufficient. In response to receiving the interrupt signal, determining a quantity to be replenished according to a first difference between the specified quantity and the first node quantity. And acquiring target nodes with a second node number, wherein the second node number is greater than or equal to the number to be supplemented. Target nodes of the second number of nodes are allocated to the first preempt instance node group to provide target services in cooperation with the plurality of first preempt instance nodes in the first preempt instance node group. The utilization rate of the idle resources of the cloud resource provider can be improved, and therefore the purpose of cost optimization of the cloud resource provider is achieved.

Description

Resource allocation method and device based on preemption instance, electronic equipment and medium
Technical Field
The invention relates to the field of cloud computing, in particular to a resource allocation method and device based on a preemption instance, electronic equipment and a medium.
Background
The preemption instance is a low-priced short-term instance, the price depending on the remaining inventory within the server. The customer may bid within a specified range, and when the market price of the specified instance specification is lower than the user's bid and the resource inventory is sufficient, the customer may successfully create a preempted instance and charge according to the current market price.
In the related art, the virtual machine instances provided by the cloud service provider are virtualized by a physical machine room of a manufacturer, and are used for providing computing power for each virtual instance so as to meet the use requirements of users. But as the number of the purchased instances of the user is floating, partial computing power is in an idle state, and the overall utilization rate of cloud resources is low.
Disclosure of Invention
Therefore, the technical problem to be solved by the present invention is to overcome the defect of low overall utilization of cloud resources in the prior art, and to provide a resource allocation method and apparatus, an electronic device, and a medium based on a preemption instance.
According to a first aspect, an embodiment of the present invention provides a resource allocation method based on a preemption instance, the method including:
monitoring whether the number of first nodes of first preemption instance nodes in a first preemption instance node group is more than or equal to a specified number, wherein the first preemption instance node group is a preemption instance node group used for providing target service;
if the number of the first nodes is less than the designated number, sending an interrupt signal to alarm that the number of the first preemption instance nodes is insufficient;
responding to the received interrupt signal, and determining the quantity to be supplemented according to a first difference value between the designated quantity and the first node quantity;
acquiring target nodes with a second node number, wherein the second node number is greater than or equal to the number to be supplemented;
allocating a target node of said second number of nodes into said first group of preempting instance nodes to provide said target service in conjunction with a plurality of said first preempting instance nodes within said first group of preempting instance nodes.
In this way, when the number of the first nodes in the first preemption instance node group is insufficient, the target nodes which are in an idle state and can be used for providing target service in the distributed cluster can be supplemented into the first preemption instance node group, and then the utilization rate of idle resources of a cloud resource provider can be improved, so that the purpose of cost optimization of the cloud resource provider is achieved.
With reference to the first aspect, in a first embodiment of the first aspect, the obtaining the target nodes of the second number of nodes includes:
judging whether the first to-be-allocated quantity of the second preemption instance node is greater than or equal to the to-be-supplemented quantity;
if the first quantity to be distributed is larger than or equal to the quantity to be supplemented, determining the second preemption instance node as a target node;
and acquiring the second preempting instance nodes of a second node quantity.
In combination with the first embodiment of the first aspect, in a second embodiment of the first aspect, the method further includes:
if the first quantity to be distributed is smaller than the quantity to be supplemented, determining a second difference value between the quantity to be supplemented and the first quantity to be distributed;
judging whether a second quantity to be distributed of on-demand instance nodes in the on-demand instance node group is larger than or equal to the second difference value or not, wherein the on-demand instance nodes and the preemption instance nodes belong to the same cluster;
and if the second quantity to be distributed is greater than or equal to the second difference, determining the on-demand instance nodes with the second difference quantity and the preemption instance nodes with the first quantity to be distributed as target nodes with the second quantity.
With reference to the first aspect, in a third embodiment of the first aspect, the obtaining the target nodes of the second number of nodes includes:
determining a target node group with high priority and corresponding to a target instance type to be distributed as a target node group to be distributed in the first preemption instance node group according to a corresponding relation between the instance type and the priority in a preset configuration file, wherein the instance type comprises a preemption instance or an on-demand instance, and the priority of the preemption instance is higher than that of the on-demand instance;
and acquiring target nodes with a second number of nodes from the target node group.
With reference to the first aspect, in a fourth embodiment of the first aspect, the method further includes:
and if the number of the stock nodes of the target node is less than the number to be supplemented, responding to the interrupt signal, executing interrupt processing on the first preemption instance node group, and recovering the first preemption instance node group.
With reference to the fourth embodiment of the first aspect, in a fifth embodiment of the first aspect, the executing interrupt processing on the first preempting instance node group and recycling the first preempting instance node group includes:
using a rolling eviction mode to evict copies of a plurality of containers in the first preemption instance node group, wherein the containers are used for supporting the first preemption instance node to provide the target service, and part of the containers are deployed in the same first preemption instance node;
in response to completion of eviction of copies of the plurality of containers, reclaiming the first set of preempting instance nodes.
In combination with the fifth embodiment of the first aspect, in the sixth embodiment of the first aspect, the method further comprises:
and if the current first preemption instance node is recovered by interruption, allocating the container resource with low priority in the current first preemption instance node to a container with high priority so as to restart the container with high priority.
According to a third aspect, the present invention further provides a resource allocation apparatus based on a preemption instance, the apparatus including:
a monitoring unit, configured to monitor whether a first node number of first preemption instance nodes in a first preemption instance node group is greater than or equal to a specified number, where the first preemption instance node group is a preemption instance node group for providing a target service;
a sending unit, configured to send an interrupt signal if the number of the first nodes is smaller than the specified number, so as to alert that the number of the first preemption instance nodes is insufficient;
a first determining unit, configured to determine, in response to receiving the interrupt signal, a quantity to be supplemented according to a first difference between the specified quantity and the first node quantity;
the acquisition unit is used for acquiring target nodes with a second node number, and the second node number is greater than or equal to the number to be supplemented;
a first allocating unit, configured to allocate target nodes of the second number of nodes to the first preempt instance node group, so as to provide the target service together with the plurality of first preempt instance nodes in the first preempt instance node group.
According to a third aspect, embodiments of the present invention further provide an electronic device, including a memory and a processor, where the memory and the processor are communicatively connected to each other, and the memory stores computer instructions, and the processor executes the computer instructions to perform the resource allocation method based on a preemption instance in any one of the first aspect and its optional embodiments.
According to a fourth aspect, embodiments of the present invention also provide a computer-readable storage medium storing computer instructions for causing a computer to perform the method for preemptive instance based resource allocation of any one of the first aspect and its optional embodiments.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flow chart of a method for resource allocation based on preemption instances in accordance with an exemplary embodiment.
Fig. 2 is a flowchart of a target node acquisition method according to an exemplary embodiment.
Fig. 3 is a flowchart of another target node acquisition method according to an example embodiment.
Fig. 4 is a flow diagram of another method for preemptive instance based resource allocation in accordance with an exemplary embodiment.
Fig. 5 is a schematic diagram of a resource allocation procedure based on a preemption instance, according to an example embodiment.
Fig. 6 is a flow chart of a method for creating a headspace according to an example embodiment.
Fig. 7 is a block diagram of a resource allocation apparatus based on a preemption instance in accordance with an exemplary embodiment.
Fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an exemplary embodiment.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the related art, the virtual machine instances provided by the cloud service provider are virtualized by a physical machine room of a manufacturer, and are used for providing computing power for each virtual instance so as to meet the use requirements of users. But as the number of the purchased instances of the user is floating, partial computing power is in an idle state, and the overall utilization rate of cloud resources is low.
In order to solve the above problem, an embodiment of the present invention provides a resource allocation method based on a preemption instance, which is used in a resource management operation and maintenance management platform. The resource management operation and maintenance management platform is used for globally managing and controlling resources of the distributed cluster, and includes but is not limited to selling and distributing instance nodes in the distributed cluster. It should be noted that the nodes in the distributed cluster may be implemented as part or all of the electronic device by software, hardware, or a combination of software and hardware. In the following embodiments of the method, the execution subject is a resource management operation and maintenance management platform.
The resource allocation method based on the preemption instance is suitable for application scenes for public clouds. In the resource allocation method based on the preemptive instance, whether the number of first nodes of first preemptive instance nodes in a first preemptive instance node group is larger than or equal to a specified number or not is monitored, and the first preemptive instance node group is a preemptive instance node group used for providing target service. And if the number of the first nodes is less than the designated number, sending an interrupt signal to alarm that the number of the first preemption instance nodes is insufficient. In response to receiving the interrupt signal, determining a quantity to be replenished according to a first difference between the specified quantity and the first node quantity. And acquiring target nodes with a second node number, wherein the second node number is greater than or equal to the number to be supplemented. Target nodes of the second number of nodes are allocated to the first preempt instance node group to provide target services in cooperation with the plurality of first preempt instance nodes in the first preempt instance node group. According to the resource allocation method based on the preemption instance, the utilization rate of idle resources of the node resource provider can be improved, so that the aim of optimizing the cost of the node resource provider is fulfilled.
Fig. 1 is a flow chart of a method for resource allocation based on preemption instances in accordance with an exemplary embodiment. As shown in fig. 1, the resource allocation method based on the preemption instance includes the following steps S101 to S105.
In step S101, it is monitored whether a first number of nodes of a first preempting instance node within the first preempting instance node group is greater than or equal to a specified number.
In an embodiment of the invention, the first preempt instance node group is a preempt instance node group for providing the target service. A first preempting instance node within the first preempting instance node group may be understood as a preempting instance node that has been purchased by a customer and is in use. The specified number may be understood as the minimum number of nodes for providing the target service.
Since the preempting instance node belongs to a common node, its inventory changes in real time. In order to avoid the situation that the target service cannot be normally provided due to the fact that the number of the first preemption instance nodes is insufficient in the process that a user provides the target service by using the first preemption instance node group, the number of the first nodes of the first preemption instance nodes in the first preemption instance node group is monitored in real time.
In step S102, if the number of first nodes is less than the specified number, an interrupt signal is sent to alert that the number of first preemption instance nodes is insufficient.
In the embodiment of the present invention, if the number of the first nodes is less than the specified number, it is characterized that the first preemption instance node in the first preemption instance node group may not meet the usage requirement of normally providing the target service. Therefore, in order to avoid the influence on the provision of the target service due to the insufficient number of the first preemption instance nodes, the interruption signal is sent to alarm the insufficient number of the first preemption instance nodes so as to prompt the user to adjust in time and reduce the influence caused by the interruption of the target service.
In step S103, in response to receiving the interrupt signal, the amount to be supplemented is determined according to a first difference between the designated amount and the first node amount.
In an embodiment of the invention the purpose of determining the number to be replenished is to determine the missing number of first preempting instance nodes within the first preempting instance node group. By determining the quantity to be supplemented, the node resources which are lacked when the target service is provided can be determined, and then the node resources can be allocated in a targeted manner.
In step S104, the target nodes of the second number of nodes are acquired.
In the embodiment of the invention, the number of the second nodes is greater than or equal to the number to be supplemented. A target node may be understood as a node in the distributed cluster that is idle and may be used to provide a target service.
In step S105, a second number of target nodes are assigned to the first preempt instance node group to provide a target service in cooperation with the plurality of first preempt instance nodes in the first preempt instance node group.
In the embodiment of the invention, the target nodes with the second node number are distributed into the first preemption instance node group to provide the target service together with the plurality of first preemption instance nodes in the first preemption instance node group, thereby ensuring that a user has sufficient resources and can perform targeted maintenance on the target service. Wherein the maintenance may include suspending the target service or migrating the target service.
Through the embodiment, when the number of the first nodes in the first preemption instance node group is not enough, the target nodes which are in an idle state and can be used for providing target service in the distributed cluster can be supplemented into the first preemption instance node group, so that the utilization rate of idle resources of a cloud resource provider can be improved, and the purpose of cost optimization of the cloud resource provider is achieved.
The following embodiment will specifically describe the acquisition process of the target node of the second node number.
Fig. 2 is a flowchart of a target node acquisition method according to an exemplary embodiment. As shown in fig. 2, the target node acquisition method includes the following steps.
In step S201, it is determined whether the first to-be-allocated number of the second preemption instance node is greater than or equal to the to-be-replenished number.
In an embodiment of the invention, the second preempting instance node may be understood as a preempting instance node that has not been purchased in an idle state. In order to make the idle resources available for sale at a reasonable price, when the number of the first nodes is insufficient, whether the first to-be-allocated number of the second preemption instance node is greater than or equal to the to-be-supplemented number is judged, so that when the first to-be-allocated number of the second preemption instance node is determined to be sufficient, the second preemption instance node can be used to cooperate with the first preemption instance node to provide the target service together.
In step S202, if the first to-be-allocated number is greater than or equal to the to-be-replenished number, the second preempting instance node is determined as the target node.
In the embodiment of the present invention, if the first to-be-allocated number is greater than or equal to the to-be-supplemented number, the first to-be-allocated number that represents the second preemption instance node is sufficient, and the second preemption instance node may be further used as a target node to provide a target service together with the plurality of first preemption instance nodes in the first preemption instance node group.
In step S203, a second preempting instance node for a second number of nodes is obtained.
Through the embodiment, the preemption instance nodes in the idle state can be fully utilized, so that the utilization rate of the preemption instance nodes is improved, and the aim of optimizing the cost of cloud resources is fulfilled.
Fig. 3 is a flowchart of another target node acquisition method according to an example embodiment. As shown in fig. 3, the target node acquisition method includes the following steps.
In step S301, it is determined whether the first to-be-allocated number of the second preemption instance node is greater than or equal to the to-be-replenished number.
In step S302, if the first to-be-allocated number is greater than or equal to the to-be-supplemented number, the second preemption instance node is determined as the target node.
In step S303, a second number of second preemption instance nodes is obtained.
In step S304, if the first amount to be allocated is smaller than the amount to be replenished, a second difference between the amount to be replenished and the first amount to be allocated is determined.
In the embodiment of the present invention, if the first to-be-allocated number is smaller than the to-be-supplemented number, the deficiency of the second preemption instance node in the distributed cluster is characterized, and if the second preemption instance node is acquired completely, the requirement for providing the target service cannot be met. Thus, a second difference between the quantity to be replenished and the first quantity to be dispensed is further determined.
In step S305, it is determined whether a second number to be allocated of on-demand instance nodes within the on-demand instance node group is greater than or equal to a second difference value.
In the embodiment of the invention, the on-demand instance node and the preemption instance node belong to the same cluster. An on-demand instance node may be understood to be an instance node that is used on demand. In order to fully utilize the resources in the distributed cluster and improve the resource utilization rate, whether the second quantity to be distributed of the on-demand instance nodes in the on-demand instance node group is larger than or equal to the second difference value or not is judged.
In step S306, if the second to-be-allocated number is greater than or equal to the second difference, the on-demand instance nodes of the second difference number and the preemption instance nodes of the first to-be-allocated number are determined as target nodes of the second node number.
In the embodiment of the present invention, if the second quantity to be allocated is greater than or equal to the second difference, the second quantity to be allocated of the on-demand instance nodes can meet the allocation demand, and the on-demand instance nodes of the second difference quantity and the preemption instance nodes of the first quantity to be allocated are determined as the target nodes of the second node quantity, so as to provide the target service together with the plurality of first preemption instance nodes in the first preemption instance node group.
By the embodiment, the node resources in the distributed cluster can be fully utilized, the resource utilization rate is improved, and the purpose of optimizing the node resource cost is achieved.
In yet another embodiment, according to the corresponding relationship between the instance type and the priority in the preset configuration file, a target node group with a high priority and corresponding to a target instance type to be allocated is determined as a target node group to be allocated to the first preemption instance node group, the instance type includes a preemption instance or an on-demand instance, and the priority of the preemption instance is higher than the priority of the on-demand instance. And acquiring target nodes with the second number of nodes from the target node group.
Specifically, the corresponding relationship between the instance type and the priority may be configured in advance in a configuration file of the distributed cluster, and further, when an instance node in an idle state needs to be allocated, allocation may be performed based on the priority, and a target node group with a high priority and corresponding to a target instance type to be allocated is determined as a target node group to be allocated to the first preemption instance node group.
In order to reduce the maintenance cost of the distributed cluster, when the corresponding relation between the instance type and the priority is set, the priority of the preemptive instance is higher than that of the on-demand instance. And when resource allocation is carried out, the node group of the preemption instance in the idle state can be allocated preferentially, so that the preemption instance can be utilized to the maximum extent, and meanwhile, the on-demand instance can be popped up in time when the inventory of the preemption instance is insufficient to ensure the stable operation of the service. For example: can be combined with
In an example, the configuration file may be deployed within a Cluster Autoscaler (CA) of the distributed Cluster.
Fig. 4 is a flow diagram of another method for preemptive instance based resource allocation in accordance with an exemplary embodiment. As shown in fig. 4, the resource allocation method based on the preemption instance includes the following steps.
In step S401, it is monitored whether the first number of nodes of the first preempting instance node within the first preempting instance node group is greater than or equal to a specified number.
In step S402, if the number of the first nodes is less than the specified number, an interrupt signal is sent to alert that the number of the first preemption instance nodes is insufficient.
In step S403, in response to receiving the interrupt signal, the amount to be supplemented is determined according to a first difference between the designated amount and the first node amount.
In step S404, target nodes of the second number of nodes are acquired.
In step S405, a second number of target nodes are allocated to the first preempt instance node group to provide a target service in cooperation with the plurality of first preempt instance nodes in the first preempt instance node group.
In step S406, if the number of stock nodes of the target node is less than the number to be supplemented, an interrupt signal is responded, interrupt processing is performed on the first preemption-instance node group, and the first preemption-instance node group is recovered.
In the embodiment of the invention, if the number of the stock nodes of the target node is less than the number to be supplemented, the distributed cluster is characterized in that the invokable node resources cannot be distributed in the first preemption instance node group, and then the interrupt processing is executed on the first preemption instance node group in response to the interrupt signal, and the first preemption instance node group is recovered.
Through the embodiment, the instance nodes in the idle state in the distributed cluster can be reasonably distributed, so that the node resources in the distributed cluster are fully utilized. When the instance node in the idle state does not meet the allocation requirement, interrupt processing is executed on the first preempting instance node group, so that the stability of the target service provided by the user by adopting the first preempting instance node group can be guaranteed to the maximum extent, and the use experience of the user can be improved.
In one example, if the distributed cluster is a managed cluster, the subject of the response interrupt signal is the cloud resource provider, and the first preempted instance node is reclaimed by creating a new instance node. In one example, the interrupt signal may be collected by a pre-developed notification handler (notify handler) for monitoring the interrupt frequency for subsequent alarms or triggering emergency plans.
In one implementation scenario, as shown in fig. 5, the cloud resource provider may determine whether to send an interrupt signal according to a change in the number of instance nodes within each instance node group. The change in the number of instance nodes within each instance node group may be controlled by an elastic shrinkage scaler. The cloud resource provider can forward the sent interrupt signal to the resource management operation and maintenance management platform through the notification processing program. And recovering the preempted instance nodes to be interrupted and creating new instance nodes by the resource management operation and maintenance management platform.
In another example, if the distributed cluster is a self-established cluster, the interrupt signal may be processed by the user's interrupt signal processing server.
In one embodiment, a rolling eviction is used to evict copies of containers in the first preempting instance node group. Wherein a container (Pod) is used to support the first preempting instance node to provide the target service, and a portion of the container is deployed within the same first preempting instance node. In response to completion of the eviction of the copy of the plurality of containers, the first set of preempting instance nodes is reclaimed.
Specifically, in order to ensure that the target service is in an available state during the eviction process, a container interruption budget (PDB) is preconfigured to ensure that when a single container supports the first preemption instance node to provide the target service, copies of a specified number of containers are in an available state, and then when the eviction is performed, the copies of multiple containers in the first preemption instance node group may be evicted in a rolling eviction manner. Preferably, it can be preconfigured that 70% of the copies are available when the target service is in a running state. The target service may be any service to be provided.
In an example, in order to avoid that all the first preemption instance nodes are interrupted at the same time when executing interrupt processing on the first preemption instance node group, and thus a target service is unavailable, affinity configuration is performed on containers in each first preemption instance node. And sequentially distributing weights from large to small to the available area, the example model and the example name according to the sequence. And multiple containers for the same target service may be separated into different available regions. If no suitable node can deploy the container of the target service, the containers are dispersed in different instance types. If no suitable instance type can be deployed, targeted deployment can be performed according to the instance name, so that multiple containers of the same target service can be scattered to the maximum, the situation that stability is affected due to sudden interruption of the target service can be effectively reduced, and the use experience of a user can be improved.
In another embodiment, if the recovery of the current first preemption instance node is interrupted, the container resource with low priority in the current first preemption instance node is allocated to the container with high priority to restart the container with high priority, thereby being beneficial to ensuring that the whole migration action can be completed before the instance node is recovered. To quickly drain the reclaimed first preemption instance node in a short time, a root container (pause pod) with a low preemption priority is used to create a headspace for the distributed cluster. The reserved space is used to run containers for evicted target services.
In an implementation scenario, as shown in fig. 6, some low-priority containers are respectively placed in instance node 1 and instance node 2, and after the instance node 1 is interrupted and recovered, the high-priority container directly preempts the low-priority container to implement quick start, so that it is not necessary to wait for the readiness of a new instance node, and all the low-priority containers become pending (pending) states to start after triggering capacity expansion or waiting for the readiness of a new node, thereby implementing creation of a reserved space.
Preferably, in the configuration file, the priority of the low priority container does not have to be-1 as long as a lower priority than the normal container is guaranteed. The low-priority container may be created by a nameless object (priority classname), and then the number of copies and the allocation request corresponding to the actual demand may be set.
In an embodiment, in order to reduce the occurrence of insufficient inventory of the preemption instance nodes, when the distributed cluster creates a node group, a plurality of available areas and instance models can be covered, thereby ensuring the inventory stability of the preemption instance nodes. The Central Processing Unit (CPU) and the memory of each instance node in the same instance node group are consistent.
Based on the same inventive concept, the invention also provides a resource allocation device based on the preemption example.
Fig. 7 is a block diagram of a resource allocation apparatus based on a preemption instance in accordance with an exemplary embodiment. As shown in fig. 7, the resource allocation apparatus based on the preemption instance includes a monitoring unit 701, a sending unit 702, a first determining unit 703, an obtaining unit 704, and a first allocating unit 705.
A monitoring unit 701, configured to monitor whether a number of first nodes of a first preemption instance node in a first preemption instance node group is greater than or equal to a specified number, where the first preemption instance node group is a preemption instance node group for providing a target service;
a sending unit 702, configured to send an interrupt signal if the number of the first nodes is smaller than the specified number, so as to alert that the number of the first preemption instance nodes is insufficient;
a first determining unit 703, configured to determine, in response to receiving the interrupt signal, the number to be supplemented according to a first difference between the specified number and the number of the first nodes;
an obtaining unit 704, configured to obtain target nodes of a second number of nodes, where the second number of nodes is greater than or equal to the number to be supplemented;
a first allocating unit 705, configured to allocate a second number of target nodes to the first preempt instance node group so as to provide a target service together with the plurality of first preempt instance nodes in the first preempt instance node group.
In one embodiment, the obtaining unit 704 includes: a first judging unit, configured to judge whether the first to-be-allocated number of the second preemption instance node is greater than or equal to the to-be-replenished number; a second determining unit, configured to determine, if the first to-be-allocated number is greater than or equal to the to-be-supplemented number, the second preemption instance node as a target node; and the first acquiring subunit is used for acquiring second preemption instance nodes of the second node quantity.
In another embodiment, the apparatus further comprises: a third determining unit, configured to determine a second difference between the amount to be replenished and the first amount to be replenished if the first amount to be replenished is smaller than the amount to be replenished; the second judging unit is used for judging whether a second quantity to be distributed of the on-demand instance nodes in the on-demand instance node group is larger than or equal to a second difference value or not, and the on-demand instance nodes and the preemption instance nodes belong to the same cluster; and a fourth determining unit, configured to determine, if the second to-be-allocated number is greater than or equal to the second difference, the on-demand instance nodes of the second difference number and the preemption instance nodes of the first to-be-allocated number as target nodes of the second node number.
In yet another embodiment, the obtaining unit 704 includes: a fifth determining unit, configured to determine, according to a correspondence between instance types and priorities in a preset configuration file, a target node group with a high priority and corresponding to a target instance type to be allocated as a target node group to be allocated to the first preemption instance node group, where the instance type includes a preemption instance or an on-demand instance, and the priority of the preemption instance is higher than the priority of the on-demand instance; and the second acquiring subunit is used for acquiring the target nodes with the second number of nodes from the target node group.
In yet another embodiment, the apparatus further comprises: and the interrupt control unit is used for responding to the interrupt signal and executing interrupt processing on the first preemption instance node group to recycle the first preemption instance node group if the inventory node number of the target node is less than the number to be supplemented.
In yet another embodiment, the interrupt control unit includes: an eviction unit, configured to evict copies of multiple containers in a first preemption instance node group by using a rolling eviction manner, where the containers are used to support the first preemption instance node to provide a target service, and part of the containers are deployed in the same first preemption instance node; a reclamation unit to reclaim the first preempting instance node group in response to a copy eviction of the plurality of containers being completed.
In yet another embodiment, the apparatus further comprises: and the second allocating unit is used for allocating the container resources with the low priority in the current first preemption instance node to the container with the high priority to restart the container with the high priority if the recovery of the current first preemption instance node is interrupted.
For specific limitations and advantageous effects of the resource allocation apparatus based on the preemption instance, reference may be made to the above limitations of the resource allocation method based on the preemption instance, and details are not described here again. The various modules described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules may be embedded in a hardware form or may be independent of a processor in the electronic device, or may be stored in a memory in the electronic device in a software form, so that the processor calls and executes operations corresponding to the modules.
Fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an exemplary embodiment. As shown in fig. 8, the apparatus includes one or more processors 810 and a storage 820, where the storage 820 includes a persistent memory, a volatile memory, and a hard disk, and one processor 810 is taken as an example in fig. 8. The apparatus may further include: an input device 830 and an output device 840.
The processor 810, memory 820, input device 830, and output device 840 may be connected by a bus or other means, such as by bus in fig. 8.
Processor 810 may be a Central Processing Unit (CPU). The Processor 810 may also be other general purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, or combinations thereof. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 820, which is a non-transitory computer-readable storage medium including a persistent memory, a volatile memory, and a hard disk, may be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions/modules corresponding to the service management method in the embodiment of the present application. The processor 810 executes various functional applications of the server and data processing by executing non-transitory software programs, instructions, and modules stored in the memory 820, that is, by implementing any one of the above resource allocation methods based on preemption instances.
The memory 820 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data used as needed or desired, and the like. Further, the memory 820 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 820 optionally includes memory located remotely from processor 810, which may be connected to a data processing device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 830 may receive input numeric or character information and generate key signal inputs related to user settings and function control. The output device 840 may include a display device such as a display screen.
One or more modules are stored in the memory 820 and, when executed by the one or more processors 810, perform the methods illustrated in fig. 1-6.
The product can execute the method provided by the embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For details of the technique not described in detail in the present embodiment, reference may be made to the related description in the embodiments shown in fig. 1 to fig. 6.
Embodiments of the present invention further provide a non-transitory computer storage medium, where a computer-executable instruction is stored in the computer storage medium, and the computer-executable instruction may execute the authentication method in any of the above method embodiments. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD), a Solid State Drive (SSD), or the like; the storage medium may also comprise a combination of memories of the kind described above.
It should be understood that the above examples are only for clarity of illustration and are not intended to limit the embodiments. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. This need not be, nor should it be exhaustive of all embodiments. And obvious variations or modifications therefrom are within the scope of the invention.

Claims (10)

1. A method for resource allocation based on preemption instances, the method comprising:
monitoring whether the number of first nodes of first preemption instance nodes in a first preemption instance node group is more than or equal to a specified number, wherein the first preemption instance node group is a preemption instance node group for providing target service;
if the number of the first nodes is less than the designated number, sending an interrupt signal to alarm that the number of the first preemption instance nodes is insufficient;
determining the quantity to be supplemented according to a first difference value between the specified quantity and the first node quantity in response to receiving the interrupt signal;
acquiring target nodes with a second node number, wherein the second node number is greater than or equal to the number to be supplemented;
allocating a target node of said second number of nodes into said first group of preempting instance nodes to provide said target service in conjunction with a plurality of said first preempting instance nodes within said first group of preempting instance nodes.
2. The method of claim 1, wherein obtaining the second number of target nodes comprises:
judging whether the first to-be-allocated quantity of the second preemption instance node is greater than or equal to the to-be-supplemented quantity;
if the first quantity to be distributed is larger than or equal to the quantity to be supplemented, determining the second preemption instance node as a target node;
and acquiring the second preempting instance nodes of a second node quantity.
3. The method of claim 2, further comprising:
if the first quantity to be distributed is smaller than the quantity to be supplemented, determining a second difference value between the quantity to be supplemented and the first quantity to be distributed;
judging whether a second quantity to be distributed of on-demand instance nodes in the on-demand instance node group is larger than or equal to the second difference value or not, wherein the on-demand instance nodes and the preemption instance nodes belong to the same cluster;
and if the second quantity to be distributed is greater than or equal to the second difference, determining the on-demand instance nodes with the second difference quantity and the preemption instance nodes with the first quantity to be distributed as target nodes with the second quantity of nodes.
4. The method of claim 1, wherein obtaining the second number of target nodes comprises:
determining a target node group with high priority and corresponding to a target instance type to be allocated as a target node group to be allocated to the first preemption instance node group according to a corresponding relation between instance types and priorities in a preset configuration file, wherein the instance type comprises a preemption instance or an on-demand instance, and the priority of the preemption instance is higher than that of the on-demand instance;
and acquiring target nodes with a second number of nodes from the target node group.
5. The method of claim 1, further comprising:
and if the number of the stock nodes of the target node is less than the number to be supplemented, responding to the interrupt signal, executing interrupt processing on the first preemption instance node group, and recovering the first preemption instance node group.
6. The method of claim 5, wherein said performing interrupt processing on said first preempting instance node group to reclaim said first preempting instance node group, comprises:
using a rolling eviction mode to evict copies of a plurality of containers in the first preemption instance node group, wherein the containers are used for supporting the first preemption instance node to provide the target service, and part of the containers are deployed in the same first preemption instance node;
in response to completion of eviction of copies of the plurality of containers, reclaiming the first set of preempting instance nodes.
7. The method of claim 6, further comprising:
and if the current first preemption instance node is recycled by interruption, allocating the container resource with low priority in the current first preemption instance node to a container with high priority so as to restart the container with high priority.
8. An apparatus for preemptive instance based resource allocation, the apparatus comprising:
a monitoring unit, configured to monitor whether a first node number of first preemption instance nodes in a first preemption instance node group is greater than or equal to a specified number, where the first preemption instance node group is a preemption instance node group for providing a target service;
a sending unit, configured to send an interrupt signal if the number of the first nodes is smaller than the specified number, so as to alert that the number of the first preemption instance nodes is insufficient;
a first determining unit, configured to determine, in response to receiving the interrupt signal, a quantity to be supplemented according to a first difference between the specified quantity and the first node quantity;
the acquisition unit is used for acquiring target nodes with a second node number, and the second node number is greater than or equal to the number to be supplemented;
a first allocating unit, configured to allocate target nodes of the second number of nodes to the first preempt instance node group, so as to provide the target service together with the plurality of first preempt instance nodes in the first preempt instance node group.
9. An electronic device, comprising a memory and a processor, wherein the memory and the processor are communicatively connected to each other, and the memory stores computer instructions, and the processor executes the computer instructions to perform the resource allocation method based on a preemptive instance according to any one of claims 1-7.
10. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the method of preemptive instance based resource allocation according to any of claims 1-7.
CN202211442618.4A 2022-11-17 2022-11-17 Resource allocation method and device based on preemption instance, electronic equipment and medium Pending CN115794306A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211442618.4A CN115794306A (en) 2022-11-17 2022-11-17 Resource allocation method and device based on preemption instance, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211442618.4A CN115794306A (en) 2022-11-17 2022-11-17 Resource allocation method and device based on preemption instance, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN115794306A true CN115794306A (en) 2023-03-14

Family

ID=85438687

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211442618.4A Pending CN115794306A (en) 2022-11-17 2022-11-17 Resource allocation method and device based on preemption instance, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN115794306A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117331701A (en) * 2023-10-31 2024-01-02 中科驭数(北京)科技有限公司 Resource allocation recovery method, device, equipment and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117331701A (en) * 2023-10-31 2024-01-02 中科驭数(北京)科技有限公司 Resource allocation recovery method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN108965485B (en) Container resource management method and device and cloud platform
US9405563B2 (en) Resource management method and apparatus for virtual machine system, and virtual machine system
CN110888743B (en) GPU resource using method, device and storage medium
JP5417287B2 (en) Computer system and computer system control method
CN110941481A (en) Resource scheduling method, device and system
US20170017511A1 (en) Method for memory management in virtual machines, and corresponding system and computer program product
CN111338774B (en) Distributed timing task scheduling system and computing device
CN113037794B (en) Method, device and system for computing resource allocation scheduling
CN110389843B (en) Service scheduling method, device, equipment and readable storage medium
CN111209110A (en) Task scheduling management method, system and storage medium for realizing load balance
CN111427675A (en) Data processing method and device and computer readable storage medium
CN113886089A (en) Task processing method, device, system, equipment and medium
CN109582459A (en) The method and device that the trustship process of application is migrated
CN110609749A (en) Distributed task operation method, system and equipment
CN113032102A (en) Resource rescheduling method, device, equipment and medium
CN111538585B (en) Js-based server process scheduling method, system and device
CN115794306A (en) Resource allocation method and device based on preemption instance, electronic equipment and medium
CN108897603B (en) Memory resource management method and device
CN113626145B (en) Dynamic capacity expansion method and system for number of business virtual machines
CN107203256B (en) Energy-saving distribution method and device under network function virtualization scene
CN114816709A (en) Task scheduling method, device, server and readable storage medium
CN112965817B (en) Resource management method and device and electronic equipment
US20210019176A1 (en) Decentralized resource scheduling
CN109962941B (en) Communication method, device and server
CN114385366A (en) Elastic capacity expansion method, system, medium and equipment for container group of container cloud platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination