CN117215779A - Resource calling method, device, computer equipment and storage medium - Google Patents

Resource calling method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN117215779A
CN117215779A CN202311146429.7A CN202311146429A CN117215779A CN 117215779 A CN117215779 A CN 117215779A CN 202311146429 A CN202311146429 A CN 202311146429A CN 117215779 A CN117215779 A CN 117215779A
Authority
CN
China
Prior art keywords
resource
target
target container
container
type
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
CN202311146429.7A
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.)
China Telecom Technology Innovation Center
China Telecom Corp Ltd
Original Assignee
China Telecom Technology Innovation Center
China Telecom Corp 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 China Telecom Technology Innovation Center, China Telecom Corp Ltd filed Critical China Telecom Technology Innovation Center
Priority to CN202311146429.7A priority Critical patent/CN117215779A/en
Publication of CN117215779A publication Critical patent/CN117215779A/en
Pending legal-status Critical Current

Links

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

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a resource calling method, a resource calling device, computer equipment and a storage medium, and relates to the technical field of containers. The method comprises the following steps: and responding to the initial resource calling instruction sent by the target container, determining the type of the target container from the priority allocation type and the dynamic allocation type, further determining the available computing resources corresponding to the target container according to the type of the target container, and allocating the target computing resources to the target container according to the current calling state of the available computing resources, thereby sending the target resource calling instruction carrying the resource identification of the target computing resources to the driver so as to enable the driver to call the target computing resources for the target container. The method can ensure the preferential calling of the container with the preferential allocation type to the binding calculation resource, does not influence the calling of the binding calculation resource by other containers in the residual time, can call the idle calculation resource from the global level for the container with the dynamic allocation type, and comprehensively improves the utilization rate of the calculation resource.

Description

Resource calling method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of container technologies, and in particular, to a method and apparatus for calling resources, a computer device, and a storage medium.
Background
In the development scene, the container technology does not need to virtualize the whole operating system, only needs to virtualize a small-scale environment, and compared with a virtual machine, the starting speed is faster, and no extra system resources are basically consumed except the running of the application in the virtual machine. While K8S, kubernetes, is an open source system for automatically deploying, scaling and managing containerized applications, it combines the containers that make up the application into logical units for ease of management and service discovery.
Currently, when a cloud native framework represented by K8S allocates computing resources to a container, a CPU (Central Processing Unit ), a memory or a storage is mainly considered, and if the container uses other computing resources, such as heterogeneous computing resources, the container needs to rely on a device plug in allocation or a drive allocation. The device plug in is used for simply binding the heterogeneous computing resources with a specific container, so that the flexibility of calling the heterogeneous computing resources is reduced, the utilization rate of the bound heterogeneous computing resources is reduced, and the drive distribution gives the scheduling of the heterogeneous computing resources to the bottom hardware, so that the overall utilization rate of the global heterogeneous computing resources cannot be ensured.
Therefore, the current allocation method cannot achieve both the usage of heterogeneous computing resources by the important service container and the utilization rate of the heterogeneous computing resources.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a resource calling method, apparatus, computer device, and storage medium capable of ensuring the preferential use of heterogeneous computing resources by important business containers, and the overall utilization of heterogeneous computing resources.
In a first aspect, the present application provides a resource calling method, including:
responding to an initial resource calling instruction sent by a target container, and determining the type of the target container from the priority allocation type and the dynamic allocation type;
determining available computing resources corresponding to the target container according to the type of the target container;
distributing target computing resources to the target container according to the current calling state of the available computing resources;
and sending a target resource calling instruction carrying the resource identification of the target computing resource to the driver, so that the driver calls the target computing resource for the target container.
In one embodiment, determining the type of the target container from the priority allocation type and the dynamic allocation type includes:
acquiring a container identifier of a target container from an initial resource calling instruction;
Acquiring the resource binding information of the target container from the resource allocation record table according to the container identification of the target container;
and determining the type of the target container from the priority allocation type and the dynamic allocation type according to the resource binding information.
In one embodiment, determining the type of the target container from the priority allocation type and the dynamic allocation type according to the resource binding information includes:
if the resource binding information is binding information between the container identifier and the resource identifier, determining that the type of the target container is a priority allocation type;
if the resource binding information is the binding information between the container identification and the number of the resources, determining that the type of the target container is a dynamic allocation type.
In one embodiment, determining available computing resources corresponding to the target container according to the type of the target container includes:
and if the type of the target container is the priority allocation type, taking the computing resource bound by the target container as the available computing resource corresponding to the target container.
In one embodiment, allocating a target computing resource to a target container based on a current call state of the available computing resources comprises:
inquiring a resource call record table according to the resource identification of the available computing resource to acquire the current call state of the available computing resource;
If the current calling state is called, interrupting the current computing task of the available computing resource;
in the event that the available computing resources have interrupted the current computing task, the available computing resources are taken as target computing resources of the target container.
In one embodiment, determining available computing resources corresponding to the target container according to the type of the target container includes:
if the type of the target container is a dynamic allocation type, each computing resource in the computing node is used as an available computing resource corresponding to the target container.
In one embodiment, allocating a target computing resource to a target container based on a current call state of the available computing resources comprises:
inquiring a resource call record table to acquire the current call state of each available computing resource;
and determining the target computing resource of the target container from the available computing resources which are not called in the current calling state.
In one embodiment, after allocating the target computing resource to the target container according to the current call state of the available computing resource, the method further comprises:
and updating the current calling state of the target computing resource in the resource calling record table to be called.
In one embodiment, before responding to the initial resource call instruction sent by the target container, the method further comprises:
and responding to a target container creation instruction sent by the control node, and adding the resource binding information of the target container in the resource allocation record table according to the type of the target container.
In a second aspect, the present application also provides a resource calling device, where the device includes:
the type determining module is used for determining the type of the target container from the priority allocation type and the dynamic allocation type in response to an initial resource calling instruction sent by the target container;
the resource determining module is used for determining available computing resources corresponding to the target container according to the type of the target container;
the resource allocation module is used for allocating target computing resources for the target container according to the current calling state of the available computing resources;
and the resource calling module is used for sending a target resource calling instruction carrying the resource identification of the target computing resource to the driver so as to enable the driver to call the target computing resource for the target container.
In a third aspect, the application also provides a computer device comprising a memory storing a computer program and a processor implementing the steps of the method of the first aspect described above when the processor executes the computer program.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of the first aspect described above.
In a fifth aspect, the application also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of the first aspect described above.
The resource calling method, the device, the computer equipment and the storage medium are used for responding to the initial resource calling instruction sent by the target container, determining the type of the target container from the priority allocation type and the dynamic allocation type, further determining the available computing resources corresponding to the target container according to the type of the target container, further, distributing the target computing resources to the target container according to the current calling state of the available computing resources, and further sending the target resource calling instruction carrying the resource identification of the target computing resources to the driver so as to enable the driver to call the target computing resources for the target container. According to the method, the device and the system, different types of target containers correspond to available computing resources in different ranges, the types of the target containers are determined from the priority allocation types and the dynamic allocation types, the corresponding available computing resources are determined for the target containers, further, the target computing resources which are more suitable for the target containers are determined from the available computing resources based on the current calling state of the available computing resources, the target computing resources are allocated and called for the target containers, the use of the computing resources can be ensured for the different types of target containers, and meanwhile, the utilization rate of the global computing resources is effectively improved.
Drawings
FIG. 1 is an application scenario diagram of a resource invocation method in one embodiment;
FIG. 2 is a flow diagram of a method of resource invocation in one embodiment;
FIG. 3 is a flow diagram of determining a type of a target container in one embodiment;
FIG. 4 is a flow diagram of determining available computing resources in one embodiment;
FIG. 5 is a flow diagram of determining available computing resources in another embodiment;
FIG. 6 is a flow diagram of creating and destroying a target container in one embodiment;
FIG. 7 is a flow chart of a method for invoking resources according to another embodiment;
FIG. 8 is a block diagram of a resource calling device in one embodiment;
FIG. 9 is a block diagram of a resource calling device in another embodiment;
FIG. 10 is a block diagram of a resource calling device in yet another embodiment;
FIG. 11 is a block diagram of a resource calling device in yet another embodiment;
FIG. 12 is a block diagram of a resource calling device in yet another embodiment;
FIG. 13 is a block diagram of a computer device implementing a resource calling method in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The resource calling method provided by the embodiment of the application can be applied to an application environment shown in figure 1. The K8S cluster includes a control node 101 and several computing nodes, i.e., computing node 102 to computing node 10n, which may all be implemented by a server. The scheduling management module of the K8S cluster, i.e. Kubernetes Scheduler, is located at the control node 101 and is responsible for container management and resource allocation in the cluster, where the resource allocation situation of all computing nodes of the cluster is recorded, such as the total amount of computing resources on each computing node, the number of bound computing resources, and the number of dynamically allocated computing resources. Each computing node is provided with an improved plug-in Improved device plugin, which is responsible for managing the allocation of computing resources of the containers on each computing node, wherein the resource allocation record table is recorded with computing resource allocation information of each container, and the resource scheduling record table is recorded with computing resource calling information of each container. Specifically, the computing resources are heterogeneous computing resources XPU (X Processing Unit, X processor) that process a specific type of task, such as NPU (Neural network Processing Unit, neural network processor), GPU (Graphics Processing Unit, graphics processor) or TPU (Tensor Processing Unit, tensor processor), and one computing node is equipped with multiple heterogeneous computing resources.
The plug-in on the computing node can find out relevant basic information of the heterogeneous computing resource, such as digital information and identification information, by scanning the SDK (Software Development Kit ) or the driver of the heterogeneous computing resource of the computing node, thereby recording the relevant basic information of the heterogeneous computing resource locally and reporting the relevant basic information to the scheduling management module of the control node 101 at the same time, so that the scheduling management module gathers the relevant basic information of the heterogeneous computing resource in all the computing nodes in the cluster.
When a container with heterogeneous computing resources is created in the K8S cluster, the scheduling management module of the control node 101 can schedule the created new container to one of the computing nodes according to the global resource allocation situation, so that the plug-in of the computing node selects the available heterogeneous computing resources of the node to be allocated to the new container; when a container with heterogeneous computing resources is destroyed in the K8S cluster, the dispatch management module of the control node 101 may initiate a destroy instruction for the container to cause the plugin on the computing node to reclaim the heterogeneous computing resources.
Taking the computing node 102 as an example, when a container on the computing node 102 invokes a heterogeneous computing resource, the container sends the invoking information to a plugin of the computing node 102, so that the plugin allocates the heterogeneous computing resource to the container according to the corresponding relationship between the container and the heterogeneous computing resource and the operation condition of the heterogeneous computing resource, and invokes the allocated heterogeneous computing resource through an SDK or a driver.
Currently, if a container on each computing node in the K8S cluster needs to use heterogeneous computing resources, a privileged mode needs to be started, and in this mode, the container can call all the resources of the host, which is not beneficial to resource isolation. Therefore, various device plug in allocation modes are generated, the existing device plug in allocation modes simply bind heterogeneous computing resources to specific containers for use, the use rate of the bound heterogeneous computing resources is affected, and other containers are not utilized to call the heterogeneous computing resources, so that the flexibility of resource call is reduced. In addition, the mode of driving allocation gives the scheduling of the heterogeneous computing resources to the bottom hardware, so that the K8S cluster cannot better call the heterogeneous computing resources from the global level. It can be seen that none of the above-described ways of resource invocation can ensure the overall utilization of heterogeneous computing resources.
To solve the above technical problem, in one embodiment, as shown in fig. 2, a resource calling method is provided, which includes the following steps:
s201, determining the type of the target container from the priority allocation type and the dynamic allocation type in response to an initial resource call instruction sent by the target container.
The target container is a container created by the control node on the computing node, and performs its tasks based on heterogeneous computing resources on the computing node. Thus, in the event that the target container needs to perform its task, the computing node responds to an initial resource call instruction that the target container initiatively initiates, and determines the type of the target container based on the initial resource call instruction.
The containers include a priority allocation type and a dynamic allocation type, the containers with higher task priorities are containers with higher real-time tasks, such as voice conversations, and the containers with general task priorities are containers with dynamic allocation types, such as text translations. When a container of a prioritized allocation type conflicts with a container resource call of a dynamic allocation type, the container of the dynamic allocation type needs to yield computing resources to the container of the prioritized allocation type. It will be appreciated that the type of container is determined by the control node, for example, when the control node creates a container on a computing node, it indicates the type of container created.
Optionally, the initial resource call instruction may be sent to a plugin on the computing node by the target container, or may be actively captured by the plugin on the computing node.
S202, determining available computing resources corresponding to the target container according to the type of the target container.
The computing resources are heterogeneous computing resources XPU, such as NPU, GPU or TPU, which process specific types of tasks, and a computing node is provided with a plurality of heterogeneous computing resources.
And if the type of the target container is the priority allocation type, taking the computing resource bound by the target container as the available computing resource corresponding to the target container.
For a target container of a priority allocation type, the available computing resources corresponding to the target container are computing resources pre-bound with the container on the computing node. For example, when the control node creates a container with a container identifier 1 on the computing node, the control node indicates that the type of the container is a priority allocation type, and then the computing node binds the container with a computing resource with a resource identifier 0, and determines, based on the priority allocation type of the container, that an available computing resource corresponding to the container is a pre-bound computing resource, that is, a computing resource with a resource identifier 0, under the condition of responding to an initial resource call instruction sent by the container with the container identifier 1.
It will be appreciated that pre-bound computing resources do not refer to computing resources that can only be invoked by a particular container, but rather, computing resources that can be preferentially invoked for a particular container when the particular container needs to invoke the computing resources. Each container of the priority allocation type has pre-bound computing resources, and each computing resource can only be bound with one container of the priority allocation type at most, so that the containers of the priority allocation type can be ensured to be free of computing resources and called again when executing tasks, and task time delay or task errors caused by resource calling conflicts can be avoided when a plurality of containers of the priority allocation type execute tasks simultaneously.
If the type of the target container is a dynamic allocation type, each computing resource in the computing node is used as an available computing resource corresponding to the target container.
For the target container of the dynamic allocation type, the corresponding available computing resources are all computing resources on the computing node, and the container of the dynamic allocation type does not have pre-bound computing resources.
It should be noted that, the available computing resources corresponding to the container of the priority allocation type are computing resources pre-bound to the container, and the available computing resources corresponding to the container of the dynamic allocation type are global computing resources, which do not indicate that the available computing resource range of the container of the priority allocation type is smaller than the available computing resource range of the container of the dynamic allocation type. The priority of the task executed by the container of the priority allocation type is higher, and under the condition that the pre-bound computing resource is occupied by other containers, the computing node can exclude the occupied state of the other containers, so that the container of the priority allocation type can call the computing resource at any time; the task executed by the dynamic allocation type container has lower priority, the computing node is required to search idle computing resources in the global computing resources, and the dynamic allocation type container can be called after waiting for the idle computing resources to appear under the condition that the global computing resources are occupied by other containers.
S203, distributing target computing resources to the target container according to the current calling state of the available computing resources.
For the target container of the priority allocation type, if the current calling state of the corresponding available computing resource is not called, directly allocating the corresponding available computing resource as the target computing resource to the target container, if the current calling state of the corresponding available computing resource is called, suspending tasks of other containers which currently call the available computing resource, and migrating the tasks of other containers to other computing resources for execution, thereby taking the available computing resource corresponding to the target container as the target computing resource and allocating the target computing resource to the target container.
For a target container of a dynamic allocation type, determining a currently non-invoked computing resource from the available computing resources according to the current invoking state of the available computing resources, further determining a target computing resource from the currently non-invoked computing resources, and allocating the target computing resource for the target container.
Optionally, computing resource allocation information for allocating the target computing resource to the target container is added to the resource allocation record table of the computing node, for example, a mapping relationship between the container identifier of the target container and the resource identifier of the target computing resource is added.
S204, sending a target resource calling instruction carrying the resource identification of the target computing resource to the driver, so that the driver calls the target computing resource for the target container.
The plugin on the computing node sends a target resource calling instruction to the bottom layer driver, wherein the target resource calling instruction carries a resource identifier of a target computing resource, and the target resource calling instruction is used for indicating the driver to call the designated computing resource.
Optionally, the plugin on the computing node sends a target resource calling instruction to the bottom SDK, where the target resource calling instruction carries a resource identifier of the target computing resource, and the target resource calling instruction is used to instruct the SDK to call the specified computing resource.
Optionally, the current call state of the target computing resource in the resource call record table is updated to be called. In the call allocation record table of the computing node, computing resource call information for calling the target computing resource for the target container is added, for example, a mapping relationship between the container identifier of the target container and the resource identifier of the target computing resource is added.
It should be noted that, in this embodiment, the operation of the bottom layer may be implemented by the call controller, for example, under the instruction of the plugin on the computing node, the target computing resource is allocated to the target container according to the resource allocation record table and the resource call record table, the call condition of all the computing resources on the computing node is recorded, and the resource call record table is updated again after the call is ended.
According to the scheme, the type of the target container is determined from the priority allocation type and the dynamic allocation type in response to the initial resource calling instruction sent by the target container, then the available computing resources corresponding to the target container are determined according to the type of the target container, further, the target computing resources are allocated to the target container according to the current calling state of the available computing resources, and accordingly the target resource calling instruction carrying the resource identification of the target computing resources is sent to the driver, and the driver calls the target computing resources for the target container. According to the method and the device, the type of the target container is determined from the priority allocation type and the dynamic allocation type, the corresponding available computing resources are determined for the target container, further, the target computing resources which are more suitable for the target container are determined from the available computing resources based on the current calling state of the available computing resources, the target computing resources are allocated and called for the target container, the priority allocation and the calling of the binding computing resources can be ensured for the target container of the priority allocation type, so that the target container of the priority allocation type can execute important tasks at any time, the binding computing resources are not influenced to be called by other containers in the rest time, the utilization rate of the binding computing resources is improved, and the idle computing resources are allocated and called for the target container of the dynamic allocation type from the global level, so that the utilization rate of the global computing resources is improved.
In order to accurately determine the type of the target container, and thus select a reasonable resource allocation manner, in an embodiment, the resource allocation record table on the computing node may be queried to determine the type of the target container, as shown in fig. 3, and S201 may include:
s301, obtaining a container identification of the target container from the initial resource call instruction.
The initial resource calling instruction is actively initiated when the target container needs to call the computing resource to execute the task, and the container identifier of the target container can be carried in the initial resource calling instruction. And the plugin on the computing node responds to the initial resource calling instruction sent by the target container to acquire the container identification of the target container.
Optionally, the plug-in obtains the container identifier of the target container by determining the target container initiator of the captured initial resource call instruction.
S302, acquiring the resource binding information of the target container from the resource allocation record table according to the container identification of the target container.
And querying a local resource allocation record table by taking the container identifier of the target container as an index to obtain the resource binding information of the target container. Wherein the resource binding information of the target container may include a mapping relationship between the container identification of the target container and relevant base information of the computing resource.
Different types of containers correspond to different types of resource binding information. For example, the container of the priority allocation type, the resource binding information in the resource allocation record table includes a mapping relationship between the container identifier of the container and the resource identifier of the bound computing resource, the container identifier of the target container is 1, the resource identifier of the bound computing resource is 0, and the two are correspondingly stored in the resource allocation record table. The dynamic allocation type container, the resource binding information in the resource allocation record table comprises the mapping relation between the container identification of the container and the number of computing resources, the container identification of the target container is m, the number of the designated computing resources is 3, and the two are correspondingly stored in the resource allocation record table.
S303, determining the type of the target container from the priority allocation type and the dynamic allocation type according to the resource binding information.
Specifically, the type of the target container is determined according to the type of the resource binding information. If the resource binding information of the target container is the resource identifier of the computing resource, determining that the type of the target container is a priority allocation type, and the computing resource with the resource identifier is the bound computing resource of the target container. If the inquired resource binding information of the target container is the calculated resource quantity, determining that the type of the target container is a dynamic allocation type.
In an alternative embodiment, if the resource binding information is binding information between the container identifier and the resource identifier, determining that the type of the target container is a priority allocation type; if the resource binding information is the binding information between the container identification and the number of the resources, determining that the type of the target container is a dynamic allocation type.
In this embodiment, the container identifier of the target container is obtained from the initial resource calling instruction, the resource binding information of the target container is obtained from the resource allocation record table according to the container identifier of the target container, the type of the target container is determined from the priority allocation type and the dynamic allocation type according to the resource binding information, the type of the target container is judged through the resource allocation record table, and the method has more objectivity and reliability, and can ensure that reasonable target computing resources are allocated and called for the target container in the following process.
In order to allocate an appropriate target computing resource to a target container of a priority allocation type, in one embodiment, if the type of the target container is the priority allocation type, the computing resource bound to the target container is taken as an available computing resource corresponding to the target container, as shown in fig. 4, S202 may include:
S401, inquiring a resource call record table according to the resource identification of the available computing resources so as to acquire the current call state of the available computing resources.
And querying a local resource call record table by taking the resource identifier of the available computing resource corresponding to the target container as an index to obtain the current call state of the available computing resource.
For example, the container identifier of the target container of the priority allocation type is 1, the resource identifier of the corresponding available computing resource is 0, and the current call state of the computing resource with the resource identifier of 0 in the resource call record table is queried, so as to determine whether the available computing resource of the target container is currently called by other containers.
S402, if the current calling state is called, interrupting the current computing task of the available computing resources.
If the current call state is called, interrupting the current computing task of the available computing resources. It can be appreciated that, the priority of the computing task executed by the target container of the priority allocation type is higher, and in the case that the available computing resources of the target container, that is, the computing resources pre-bound by the target container, are occupied by other containers, the plug-in can interrupt the current computing task of the available computing resources and migrate the computing tasks of the other containers to the other computing resources for execution.
Specifically, when the computing resource running the current computing task of the other container receives the interrupt instruction, the context information of the current computing task needs to be saved, and when the other container is allocated to the new computing resource, the context information when the current computing task is interrupted is sent to the new computing resource.
S403, taking the available computing resources as target computing resources of a target container in the case that the available computing resources interrupt the current computing task.
Specifically, the available computing resource is taken as a target computing resource of the target container, the target computing resource is allocated to the target container, and further, a resource call record table is updated, for example, the container identifier of the current call container of the target computing resource in the resource call record table is updated to be the container identifier of the target container.
If the current call state is not called, the available computing resource is directly taken as the target computing resource of the target container, and further, a resource call record table is updated, for example, the container identifier of the current call container of the target computing resource, namely the container identifier of the target container, is added in the resource call record table.
In this embodiment, according to the resource identifier of the available computing resource, the resource call record table is queried to obtain the current call state of the available computing resource, if the current call state is called, the current computing task of the available computing resource is interrupted, and under the condition that the current computing task of the available computing resource has been interrupted, the available computing resource is used as the target computing resource of the target container, so as to ensure the priority of the target container of the priority allocation type to the computing resource, ensure the use of the important task to the computing resource, and preferentially allocate the computing resource bound by the target container of the type, and under the condition that the important task is not called by the target container, the current call state can also be called by other containers in the computing node, thereby improving the utilization rate of the bound computing resource and the flexibility of allocation computing resource.
In order to allocate an appropriate target computing resource to a target container of a dynamic allocation type, in one embodiment, if the type of the target container is a dynamic allocation type, each computing resource in the computing node is used as an available computing resource corresponding to the target container, as shown in fig. 5, S202 may further include:
s501, inquiring a resource call record table to acquire the current call state of each available computing resource.
When the type of the target container is a dynamic allocation type, the available computing resource corresponding to the target container is a global computing resource, directly inquiring a local resource call record table to obtain the current call state of the available computing resource, and specifically directly inquiring the current call state of the computing resource which is not called in the local resource call record table.
Optionally, only the resource calling condition that the current calling state is the called computing resource is stored in the local resource calling record table, the resource identifier in the resource calling record table is queried, and the computing resource corresponding to the resource identifier which does not exist in the query result is the computing resource that is not called in the current calling state.
S502, determining target computing resources of the target container from available computing resources which are not called in the current calling state.
If the current calling state is the non-called computing resource, determining the target computing resource of the target container from the non-called computing resource, and distributing the target computing resource for the target container. It will be appreciated that if there is only one computing resource whose current call state is not called, it is directly taken as the target computing resource of the target container, and if there are a plurality of computing resources whose current call states are not called, the target computing resource appropriate for the target container is determined therefrom.
If the current calling state is the non-called computing resource does not exist, when the non-called computing resource appears in the waiting computing node, the target computing resource is allocated to the target container.
Further, the resource call record table is updated, for example, a container identifier of a current call container of the target computing resource, that is, a container identifier of the target container, is added to the resource call record table.
In this embodiment, the resource call record table is queried to obtain the current call state of each available computing resource, the target computing resource of the target container is determined from the available computing resources whose current call state is not called, and the target computing resource of the target container is determined from the computing resources idle by the whole computing node, so that the utilization rate of the global computing resource and the flexibility of distributing the computing resources are improved.
In order to ensure the validity of the resource allocation record table, in one embodiment, based on the instruction for the target container sent by the control node, the type of the target container may be determined, and the resource allocation record table may be updated, as shown in fig. 6, where the resource calling method may further include:
s601, in response to a target container creation instruction sent by the control node, adding resource binding information of the target container in the resource allocation record table according to the type of the target container.
Before the target container initiates the initial resource call instruction, the computing node responds to a target container creation instruction sent by the control node, wherein the target container creation instruction is used for indicating to create the target container on the computing node. Specifically, the control node determines a suitable target computing node according to the overall resource usage condition of the K8S cluster, and sends a target container creation instruction to the target computing node.
The target container creation instruction carries the type of the target container, and the computing node updates the resource allocation record table according to the type of the target container. For example, the type of the target container is a priority allocation type, the computing resources which are not bound by the containers of other priority allocation types are allocated to the target container, the container identifier of the target container and the resource identifier of the bound computing resources are used as the resource binding information of the target container, and the resource binding information is correspondingly stored in a resource allocation record table. The type of the target container is a dynamic allocation type, the computing resource quantity is allocated to the target container, and the container identification of the target container and the computing resource quantity are used as resource binding information of the target container and are correspondingly stored in a resource allocation record table.
S602, deleting the resource binding information of the target container in the resource allocation record table in response to a target container destroying instruction sent by the control node.
After the control node initiates the target container creation instruction, the control node also sends a target container destruction instruction to the computing node, and the computing node responds to the target container destruction instruction sent by the control node, wherein the target container destruction instruction is used for indicating to destroy the target container on the computing node.
The computing node synchronously updates the resource allocation record table. For example, the type of the target container is a priority allocation type, the resource binding information of the target container is a mapping relationship between the container identifier of the target container and the resource identifier of the bound computing resource, and the resource binding information is queried and deleted by using the container identifier of the target container as an index. The type of the target container is a dynamic allocation type, the resource binding information of the target container is a mapping relation between the container identification of the target container and the number of computing resources, and the container identification of the target container is used as an index to inquire the resource binding information and delete the resource binding information.
In this embodiment, in response to a target container creation instruction sent by a control node, resource binding information of a target container is added in a resource allocation record table according to a type of the target container, in response to a target container destruction instruction sent by the control node, resource binding information of the target container is deleted in the resource allocation record table, resource binding information of the target container is added in a process of creating the target container, and resource binding information of the target container is deleted in a process of destroying the target container, so that timely updating of the resource allocation record table is realized, validity of the resource allocation record table on a computing node is ensured, and a precondition is provided for smooth execution of a resource calling method.
In one embodiment, an alternative example of a resource calling method is provided, as shown in fig. 7, and the specific procedure is as follows:
s701, responding to an initial resource calling instruction sent by a target container, and acquiring a container identification of the target container from the initial resource calling instruction.
S702, acquiring the resource binding information of the target container from the resource allocation record table according to the container identification of the target container.
S703, judging whether the resource binding information is the binding information between the container identifier and the resource identifier.
If yes, then execute S704; if not, S709 is performed.
S704, determining that the type of the target container is a priority allocation type, and taking the computing resource bound by the target container as the available computing resource corresponding to the target container.
S705, inquiring the resource call record table according to the resource identification of the available computing resource so as to acquire the current call state of the available computing resource.
S706, a determination is made as to whether the available computing resources are currently being invoked.
If yes, then execution S707; if not, S708 is performed directly.
S707 interrupts the current computing task of the available computing resources.
S708, taking the available computing resources as target computing resources of the target container.
S709, determining that the type of the target container is a dynamic allocation type, and taking each computing resource in the computing node as an available computing resource corresponding to the target container.
S710, inquiring the resource call record table to acquire the current call state of each available computing resource.
S711, determining the target computing resource of the target container from the available computing resources which are not called in the current calling state.
S712, a target resource calling instruction carrying the resource identification of the target computing resource is sent to the driver, so that the driver can call the target computing resource for the target container.
S713, updating the current calling state of the target computing resource in the resource calling record table to be called.
The specific process of the above steps may refer to the description of the above method embodiments, and its implementation principle and technical effects are similar, and are not repeated herein.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a resource calling device for realizing the above related resource calling method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of one or more resource calling devices provided below may refer to the limitation of the resource calling method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 8, there is provided a resource calling device 1 including: a type determination module 10, a resource determination module 20, a resource allocation module 30, and a resource call module 40, wherein:
the type determining module 10 is configured to determine a type of the target container from the priority allocation type and the dynamic allocation type in response to an initial resource call instruction sent by the target container.
The resource determining module 20 is configured to determine available computing resources corresponding to the target container according to the type of the target container.
The resource allocation module 30 is configured to allocate a target computing resource to the target container according to the current call state of the available computing resource.
The resource calling module 40 is configured to send a target resource calling instruction carrying a resource identifier of the target computing resource to the driver, so that the driver calls the target computing resource for the target container.
In one embodiment, based on fig. 8, as shown in fig. 9, the type determining module 10 may include:
a first obtaining unit 11, configured to obtain a container identifier of the target container from the initial resource call instruction.
And a second obtaining unit 12, configured to obtain the resource binding information of the target container from the resource allocation record table according to the container identifier of the target container.
A type determining unit 13, configured to determine the type of the target container from the priority allocation type and the dynamic allocation type according to the resource binding information.
In one embodiment, the type determining unit 13 is specifically configured to determine that the type of the target container is a priority allocation type when the resource binding information is binding information between the container identifier and the resource identifier; and determining that the type of the target container is a dynamic allocation type under the condition that the resource binding information is binding information between the container identification and the number of resources.
In one embodiment, on the basis of fig. 8, as shown in fig. 10, the resource determining module 20 may include:
the first resource determining unit 21 is configured to, when the type of the target container is the priority allocation type, use the computing resource bound by the target container as the available computing resource corresponding to the target container.
The second resource determining unit 22 is configured to, when the type of the target container is a dynamic allocation type, use each computing resource in the computing node as an available computing resource corresponding to the target container.
In one embodiment, the first resource determining unit 21 may further include:
and the first state query subunit is used for querying the resource call record table according to the resource identification of the available computing resource so as to acquire the current call state of the available computing resource.
And the task interrupt subunit is used for interrupting the current computing task of the available computing resource under the condition that the current calling state is called.
And the first resource determination subunit is used for taking the available computing resource as a target computing resource of the target container in the condition that the current computing task is interrupted by the available computing resource.
In one embodiment, the second resource determining unit 22 may further include:
and the second state determining subunit is used for querying the resource call record table to acquire the current call state of each available computing resource.
And the second resource determination subunit is used for determining target computing resources of the target container from available computing resources which are not called in the current calling state.
In one embodiment, on the basis of fig. 8, as shown in fig. 11, the resource calling device 1 may further include:
the state updating module 50 is configured to update the current call state of the target computing resource in the resource call record table to be called.
In one embodiment, on the basis of fig. 8, as shown in fig. 12, the resource calling device 1 may further include:
the container creation module 60 is configured to add the resource binding information of the target container in the resource allocation record table according to the type of the target container in response to the target container creation instruction sent by the control node.
The modules in the resource calling device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 13. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data such as a resource allocation record table, a resource call record table and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a resource calling method.
It will be appreciated by those skilled in the art that the structure shown in FIG. 13 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided that includes a memory having a computer program stored therein and a processor that implements the steps of the resource calling method described above when the computer program is executed.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, implements the steps of the resource calling method described above.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, implements the steps of the resource calling method described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (13)

1. A method for invoking a resource, comprising:
responding to an initial resource calling instruction sent by a target container, and determining the type of the target container from the priority allocation type and the dynamic allocation type;
determining available computing resources corresponding to the target container according to the type of the target container;
distributing target computing resources to the target container according to the current calling state of the available computing resources;
And sending a target resource calling instruction carrying the resource identification of the target computing resource to a driver, so that the driver calls the target computing resource for the target container.
2. The method of claim 1, wherein said determining the type of the target container from a priority allocation type and a dynamic allocation type comprises:
acquiring a container identifier of the target container from the initial resource calling instruction;
acquiring the resource binding information of the target container from a resource allocation record table according to the container identification of the target container;
and determining the type of the target container from the priority allocation type and the dynamic allocation type according to the resource binding information.
3. The method of claim 2, wherein determining the type of the target container from a priority allocation type and a dynamic allocation type according to the resource binding information comprises:
if the resource binding information is binding information between a container identifier and a resource identifier, determining that the type of the target container is a priority allocation type;
and if the resource binding information is the binding information between the container identification and the number of the resources, determining that the type of the target container is a dynamic allocation type.
4. A method according to claim 3, wherein said determining available computing resources corresponding to said target container according to the type of said target container comprises:
and if the type of the target container is the priority allocation type, taking the computing resource bound by the target container as the available computing resource corresponding to the target container.
5. The method of claim 4, wherein said allocating the target computing resource to the target container based on the current call state of the available computing resource comprises:
inquiring a resource call record table according to the resource identification of the available computing resource to acquire the current call state of the available computing resource;
if the current calling state is called, interrupting the current computing task of the available computing resource;
and taking the available computing resource as a target computing resource of the target container in the condition that the current computing task is interrupted by the available computing resource.
6. A method according to claim 3, wherein said determining available computing resources corresponding to said target container according to the type of said target container comprises:
And if the type of the target container is a dynamic allocation type, taking each computing resource in the computing node as an available computing resource corresponding to the target container.
7. The method of claim 6, wherein the allocating the target computing resource to the target container based on the current call state of the available computing resource comprises:
inquiring a resource call record table to acquire the current call state of each available computing resource;
and determining the target computing resource of the target container from the available computing resources which are not called in the current calling state.
8. The method of claim 1, wherein after allocating the target computing resource to the target container based on the current call state of the available computing resource, the method further comprises:
and updating the current calling state of the target computing resource in the resource calling record table to be called.
9. The method of claim 3, wherein prior to the responding to the initial resource call instruction sent by the target container, the method further comprises:
and responding to a target container creation instruction sent by the control node, and adding the resource binding information of the target container in a resource allocation record table according to the type of the target container.
10. A resource calling device, comprising:
the type determining module is used for responding to an initial resource calling instruction sent by a target container and determining the type of the target container from the priority allocation type and the dynamic allocation type;
the resource determining module is used for determining available computing resources corresponding to the target container according to the type of the target container;
the resource allocation module is used for allocating target computing resources to the target container according to the current calling state of the available computing resources;
and the resource calling module is used for sending a target resource calling instruction carrying the resource identifier of the target computing resource to a driver so that the driver can call the target computing resource for the target container.
11. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 10 when the computer program is executed.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1-9.
13. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1-9.
CN202311146429.7A 2023-09-06 2023-09-06 Resource calling method, device, computer equipment and storage medium Pending CN117215779A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311146429.7A CN117215779A (en) 2023-09-06 2023-09-06 Resource calling method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311146429.7A CN117215779A (en) 2023-09-06 2023-09-06 Resource calling method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117215779A true CN117215779A (en) 2023-12-12

Family

ID=89034637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311146429.7A Pending CN117215779A (en) 2023-09-06 2023-09-06 Resource calling method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117215779A (en)

Similar Documents

Publication Publication Date Title
US11086725B2 (en) Orchestration of heterogeneous multi-role applications
JP5932043B2 (en) Volatile memory representation of non-volatile storage set
US10579364B2 (en) Upgrading bundled applications in a distributed computing system
US11113158B2 (en) Rolling back kubernetes applications
CN110612705B (en) Method for service deployment under server-free architecture and function management platform
JP5510556B2 (en) Method and system for managing virtual machine storage space and physical hosts
US20170308398A1 (en) Mechanism for ssds to efficiently manage background activity with notify
US10356150B1 (en) Automated repartitioning of streaming data
US20210103554A1 (en) Rolling Back Kubernetes Applications Including Custom Resources
JP7467593B2 (en) Resource allocation method, storage device, and storage system - Patents.com
CN111061432B (en) Service migration method, device, equipment and readable storage medium
CN109992373B (en) Resource scheduling method, information management method and device and task deployment system
WO2016074130A1 (en) Batch processing method and device for system invocation commands
WO2018196462A1 (en) Resource scheduling apparatus, resource scheduling system and resource scheduling method
CN110162396A (en) Method for recovering internal storage, device, system and storage medium
WO2023160083A1 (en) Method for executing transactions, blockchain, master node, and slave node
CN113010265A (en) Pod scheduling method, scheduler, memory plug-in and system
WO2024041376A1 (en) Distributed graph data processing system, method, apparatus and device, and storage medium
CN110119308B (en) System for managing large-scale container applications
CN111459668A (en) Lightweight resource virtualization method and device for server
CN112015515B (en) Instantiation method and device of virtual network function
US20120151175A1 (en) Memory apparatus for collective volume memory and method for managing metadata thereof
US11687451B2 (en) Memory allocation manager and method performed thereby for managing memory allocation
CN117215779A (en) Resource calling method, device, computer equipment and storage medium
CN111475277A (en) Resource allocation method, system, equipment and machine readable storage medium

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